判断是否从指定页面进入

        /// <summary>
        
/// 检查进入当前页面 是否从指定页面过来的 
        
/// </summary>
        
/// <param name="Request">Request对象</param>
        
/// <param name="FileName">文件名 不区分大小写</param>
        
/// <returns></returns>

        public static bool CheckUrl(System.Web.HttpRequest Request,string FileName)
        
{
            
bool Flag = false;
            
try
            
{
                
string Path = Request.UrlReferrer.LocalPath;
                
string[] ArrayPath = Path.Split('/');
                Path 
= ArrayPath[ArrayPath.Length-1];
                Path 
= Path.Trim().ToLower();
                FileName 
= FileName.Trim().ToLower();
                
if(Path == FileName)
                
{
                    Flag 
= true;
                }

            }

            
catch{}
            
return Flag;
        }

        private void CheckLimit()
        
{
            
if(!systemcode.CheckUrl(Request,"DiscountManagePwd.aspx"))
            
{
                Response.Redirect(
"../ErrorPage.aspx?err=58",true);
                Response.End();
            }


            
if(!Common.Limit.CheckLimit(5,8))
            
{
                Response.Redirect(
"../ErrorPage.aspx?err=58",true);
            }

        }
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace ERP1._0
{
    
/// <summary>
    
/// ErrorPage 的摘要说明。
    
/// </summary>

    public class ErrorPage : System.Web.UI.Page
    
{
        
protected System.Web.UI.WebControls.Label lbErrorInfo;
        
protected System.Web.UI.HtmlControls.HtmlInputButton btnBack;
    
        
private void Page_Load(object sender, System.EventArgs e)
        
{
            
// 在此处放置用户代码以初始化页面
            if(!Page.IsPostBack)
            
{
                
string ErrInfo = "<ol type='1'>";

                
if(Request.QueryString["err"]!=null)
                
{
                    
string ErrorInfo = Request.QueryString["err"].Trim();
                    
string[] Info = ErrorInfo.Split('|');
                    
for(int i = 0;i<Info.Length;i++)
                    
{
                        ErrInfo 
+= "<li><font color='red'>" + GetErrorInfo(Info[i]) + "</font>;";
                    }

                }

                
else
                
{
                    ErrInfo 
= "<li><font color='red'>未知错误</font>";
                }


                ErrInfo 
+= "</ol>";
                lbErrorInfo.Text 
= ErrInfo;

                
string strUrl = Request.QueryString["url"];
                
if(strUrl==null||strUrl==String.Empty)
                
{
                    btnBack.Attributes[
"onclick"= "javascript:location.href='Finance/AccountInfo.aspx'";
                }

                
else
                
{
                    btnBack.Attributes[
"onclick"= "javascript:location.href='" + strUrl + "'";
                }

            }

        }


        
#region Web 窗体设计器生成的代码
        
override protected void OnInit(EventArgs e)
        
{
            
//
            
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
            
//
            InitializeComponent();
            
base.OnInit(e);
        }

        
        
/// <summary>
        
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
        
/// 此方法的内容。
        
/// </summary>

        private void InitializeComponent()
        
{    
            
this.Load += new System.EventHandler(this.Page_Load);

        }

        
#endregion


        
private string GetErrorInfo(string ErrorID)
        
{
            
string strError = "未知错误";
            
if(ErrorID != String.Empty)
            
{
                
switch(ErrorID)
                
{
                    
case "11":/*错误代码从11-13为客户管理操作权限错误*/
                    
{
                        strError 
= "对不起,您没有获取商家操作权限";
                        
break;
                    }

                    
case "12":
                    
{
                        strError 
= "对不起,您没有销售组长操作权限";
                        
break;
                    }

                    
case "13":
                    
{
                        strError 
= "对不起,您没有销售总监操作权限";
                        
break;
                    }

                    
case "21":/*错误代码从21-23为销售管理操作权限错误*/
                    
{
                        strError 
= "对不起,您没有执行定单操作权限";
                        
break;
                    }

                    
case "22":
                    
{
                        strError 
= "对不起,您没有审核关键词操作权限";
                        
break;
                    }

                    
case "23":
                    
{
                        strError 
= "对不起,您没有索要发票操作权限";
                        
break;
                    }

                    
case "40":/*错误代码从40-48为财务管理操作权限错误*/
                    
{
                        strError 
= "对不起,您没有款项操作权限";
                        
break;
                    }

                    
case "41":
                    
{
                        strError 
= "对不起,您没有入款操作权限";
                        
break;
                    }

                    
case "42":
                    
{
                        strError 
= "对不起,您没有款项转移操作权限";
                        
break;
                    }

                    
case "43":
                    
{
                        strError 
= "对不起,您没有扣款操作权限";
                        
break;
                    }

                    
case "44":
                    
{
                        strError 
= "对不起,您没有退货操作权限";
                        
break;
                    }

                    
case "45":
                    
{
                        strError 
= "对不起,您没有入款审核操作权限";
                        
break;
                    }

                    
case "46":
                    
{
                        strError 
= "对不起,您没有扣款审核操作权限";
                        
break;
                    }

                    
case "47":
                    
{
                        strError 
= "对不起,您没有款项查询操作权限";
                        
break;
                    }

                    
case "48":
                    
{
                        strError 
= "对不起,您没有显示帐户信息权限";
                        
break;
                    }

                    
case "49":
                    
{
                        strError 
= "对不起,您没有商家结算操作权限";
                        
break;
                    }

                    
case "51":/*错误代码从51-56为卡部管理操作权限错误*/
                    
{
                        strError 
= "对不起,您没有发卡申请操作权限";
                        
break;
                    }

                    
case "52":
                    
{
                        strError 
= "对不起,您没有发卡审核操作权限";
                        
break;
                    }

                    
case "53":
                    
{
                        strError 
= "对不起,您没有制卡发行操作权限";
                        
break;
                    }

                    
case "54":
                    
{
                        strError 
= "对不起,您没有发卡录入操作权限";
                        
break;
                    }

                    
case "55":
                    
{
                        strError 
= "对不起,您没有停卡、挂失、查询、激活操作权限";
                        
break;
                    }

                    
case "56":
                    
{
                        strError 
= "对不起,您没有转账、修改密码操作权限";
                        
break;
                    }

                    
case "57":
                    
{
                        strError 
= "对不起,您没有终端商家管理的权限";
                        
break;
                    }

                    
case "58":
                    
{
                        strError 
= "对不起,您没有折扣管理的权限";
                        
break;
                    }

                    
case "59":
                    
{
                        strError 
= "对不起,您没有用户申请管理的权限";
                        
break;
                    }

                    
case "71":/*错误代码从71-78为统计分析管理操作权限错误*/
                    
{
                        strError 
= "对不起,您没有销售分析操作权限";
                        
break;
                    }

                    
case "72":
                    
{
                        strError 
= "对不起,您没有客户分析操作权限";
                        
break;
                    }

                    
case "73":
                    
{
                        strError 
= "对不起,您没有会员分析操作权限";
                        
break;
                    }

                    
case "74":
                    
{
                        strError 
= "对不起,您没有产品分析操作权限";
                        
break;
                    }

                    
case "75":
                    
{
                        strError 
= "对不起,您没有投诉分析操作权限";
                        
break;
                    }

                    
case "76":
                    
{
                        strError 
= "对不起,您没有售后分析操作权限";
                        
break;
                    }

                    
case "77":
                    
{
                        strError 
= "对不起,您没有咨询分析操作权限";
                        
break;
                    }

                    
case "78":
                    
{
                        strError 
= "对不起,您没有欠费分析操作权限";
                        
break;
                    }

                    
case "81":/*错误代码从81-87为系统管理操作权限错误*/
                    
{
                        strError 
= "对不起,您没有用户管理操作权限";
                        
break;
                    }

                    
case "82":
                    
{
                        strError 
= "对不起,您没有公司、部门管理操作权限";
                        
break;
                    }

                    
case "83":
                    
{
                        strError 
= "对不起,您没有会员等级管理操作权限";
                        
break;
                    }

                    
case "84":
                    
{
                        strError 
= "对不起,您没有产品信息管理操作权限";
                        
break;
                    }

                    
case "85":
                    
{
                        strError 
= "对不起,您没有产品定价管理操作权限";
                        
break;
                    }

                    
case "86":
                    
{
                        strError 
= "对不起,您没有角色管理操作权限";
                        
break;
                    }

                    
case "87":
                    
{
                        strError 
= "对不起,您没有销售阶段管理操作权限";
                        
break;
                    }

                    
default:
                    
{
                        
break;
                    }

                }

            }

            
return strError;
        }

    }

}

posted on 2005-04-26 11:54  №阿儒№  阅读(550)  评论(0编辑  收藏  举报