コード例 #1
0
    public void Page_Error(object sender, EventArgs e)
    {
        Exception objErr = base.Server.GetLastError().GetBaseException();
        string    err    = string.Concat(new string[]
        {
            "Error Caught in PageBase_Error event\r\nError in:",
            base.Request.Url.ToString(),
            "\r\nError Message:",
            objErr.Message.ToString(),
            "\r\nStack Trace:",
            objErr.StackTrace.ToString()
        });

        try
        {
            Chain.Model.SysError mdSysError  = new Chain.Model.SysError();
            Chain.BLL.SysError   bllSysError = new Chain.BLL.SysError();
            mdSysError.ErrorTime    = DateTime.Now;
            mdSysError.ErrorContent = err;
            mdSysError.Ipaddress    = PubFunction.ipAdress;
            mdSysError.UserID       = this._UserID;
            mdSysError.ShopID       = this._UserShopID;
            bllSysError.Add(mdSysError);
        }
        catch
        {
        }
        base.Server.ClearError();
    }
コード例 #2
0
ファイル: Global.asax.cs プロジェクト: mlj0381/VipCard
        protected void Application_Error(object sender, EventArgs e)
        {
            Exception objErr = base.Server.GetLastError().GetBaseException();
            string    err    = string.Concat(new string[]
            {
                "会员系统 Caught in Application_Error event\r\nError in:",
                base.Request.Url.ToString(),
                "\r\nError Message:",
                objErr.Message.ToString(),
                "\r\nStack Trace:",
                objErr.StackTrace.ToString()
            });

            try
            {
                Chain.Model.SysError mdSysError  = new Chain.Model.SysError();
                Chain.BLL.SysError   bllSysError = new Chain.BLL.SysError();
                mdSysError.ErrorTime    = DateTime.Now;
                mdSysError.ErrorContent = err;
                mdSysError.Ipaddress    = PubFunction.ipAdress;
                LoginLogic login = LoginLogic.LoginStatus();
                if (login.IsLoggedOn && login.LoginUser != null)
                {
                    mdSysError.UserID = login.LoginUser.UserID;
                    mdSysError.ShopID = login.LoginUser.UserShopID;
                }
                bllSysError.Add(mdSysError);
            }
            catch
            {
            }
        }
コード例 #3
0
 public static void Add(string Content, string IP, int UserID, int ShopID)
 {
     Chain.Model.SysError model = new Chain.Model.SysError();
     model.ErrorTime    = DateTime.Now;
     model.ErrorContent = Content;
     model.Ipaddress    = IP;
     model.UserID       = UserID;
     model.ShopID       = ShopID;
     new SysError().Add(model);
 }
コード例 #4
0
        public List <Chain.Model.SysError> DataTableToList(DataTable dt)
        {
            List <Chain.Model.SysError> modelList = new List <Chain.Model.SysError>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.SysError model = new Chain.Model.SysError();
                    if (dt.Rows[i]["ID"] != null && dt.Rows[i]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[i]["ID"].ToString());
                    }
                    if (dt.Rows[i]["ErrorContent"] != null && dt.Rows[i]["ErrorContent"].ToString() != "")
                    {
                        model.ErrorContent = dt.Rows[i]["ErrorContent"].ToString();
                    }
                    if (dt.Rows[i]["ErrorTime"] != null && dt.Rows[i]["ErrorTime"].ToString() != "")
                    {
                        model.ErrorTime = DateTime.Parse(dt.Rows[i]["ErrorTime"].ToString());
                    }
                    if (dt.Rows[i]["Ipaddress"] != null && dt.Rows[i]["Ipaddress"].ToString() != "")
                    {
                        model.Ipaddress = dt.Rows[i]["Ipaddress"].ToString();
                    }
                    if (dt.Rows[i]["ErrorType"] != null && dt.Rows[i]["ErrorType"].ToString() != "")
                    {
                        model.ErrorType = dt.Rows[i]["ErrorType"].ToString();
                    }
                    if (dt.Rows[i]["UserID"] != null && dt.Rows[i]["UserID"].ToString() != "")
                    {
                        model.UserID = Convert.ToInt32(dt.Rows[i]["UserID"]);
                    }
                    if (dt.Rows[i]["ShopID"] != null && dt.Rows[i]["ShopID"].ToString() != "")
                    {
                        model.ShopID = Convert.ToInt32(dt.Rows[i]["ShopID"]);
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #5
0
 public bool Update(Chain.Model.SysError model)
 {
     return(this.dal.Update(model));
 }
コード例 #6
0
 public int Add(Chain.Model.SysError model)
 {
     return(this.dal.Add(model));
 }
コード例 #7
0
        public void ProcessRequest(HttpContext context)
        {
            this.currentContext = context;
            string savePath = string.Empty;
            string saveName = string.Empty;

            try
            {
                if (context.Request.Files["MicroWebsiteIndex"] != null)
                {
                    Match          match  = Regex.Match(context.Request["name"], "(/.*/)(.*)");
                    HttpPostedFile sourse = context.Request.Files["MicroWebsiteIndex"];
                    savePath = match.Groups[1].Value;
                    saveName = match.Groups[2].Value;
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write("1");
                }
                else if (context.Request.Files["Cert"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["Cert"];
                    savePath = "~/cert/";
                    saveName = "apiclient_cert.p12";
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["ShopPhoto"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["ShopPhoto"];
                    savePath = "~/Upload/ShopPhoto/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsiteNews"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsiteNews"];
                    savePath = "~/Upload/MicroWebsite/MicroWebsiteNews/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsiteAlbum"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsiteAlbum"];
                    savePath = "~/Upload/MicroWebsite/MicroWebsiteAlbum/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsitePhoto"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsitePhoto"];
                    savePath = "~/Upload/MicroWebsite/MicroWebsitePhoto/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsitePromotions"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsitePromotions"];
                    savePath = "~/Upload/MicroWebsite/MicroWebsitePromotions/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsiteBackground"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsiteBackground"];
                    savePath = "~/Upload/WeiXin/Images/";
                    saveName = "wxindex_bg.png";
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["IndexLogo"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["IndexLogo"];
                    savePath = "~/images/";
                    saveName = "logo.png";
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MemPhoto"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MemPhoto"];
                    savePath = "~/Upload/MemPhoto/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsiteProductCenter"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsiteProductCenter"];
                    savePath = "~/Upload/MicroWebsite/MicroWebsiteProductCenter/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroWebsiteSymbol"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroWebsiteSymbol"];
                    savePath = "~/Upload/MicroWebsite/MicroWebsiteSymbol/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request.Files["MicroGoods"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["MicroGoods"];
                    savePath = "~/Upload/MicroWebsite/MicroGoods/";
                    saveName = DateTime.Now.ToString("yyMMddhhmmssffff") + Path.GetExtension(sourse.FileName);
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else if (context.Request["type"] != null && context.Request["type"] == "index")
                {
                    int MerchantID = Convert.ToInt32(context.Request["MerchantID"]);
                    this.DrawImage(MerchantID);
                }
                else if (context.Request.Files["WeiXinPhoto"] != null)
                {
                    HttpPostedFile sourse = context.Request.Files["WeiXinPhoto"];
                    savePath = "~/Upload/WeiXin/Images/";
                    string name = context.Request["name"];
                    if (!string.IsNullOrEmpty(name))
                    {
                        string text = name;
                        if (text != null)
                        {
                            if (!(text == "1"))
                            {
                                if (!(text == "2"))
                                {
                                    if (text == "3")
                                    {
                                        saveName = "memCard.jpg";
                                    }
                                }
                                else
                                {
                                    saveName = "wwz.jpg";
                                }
                            }
                            else
                            {
                                saveName = "bg.jpg";
                            }
                        }
                    }
                    this.SaveImg(sourse, savePath, saveName);
                    context.Response.Write(saveName);
                }
                else
                {
                    context.Response.Write("0");
                }
            }
            catch (Exception e)
            {
                Chain.Model.SysError err = new Chain.Model.SysError();
                err.UserID       = 0;
                err.ShopID       = 0;
                err.ErrorTime    = DateTime.Now;
                err.ErrorContent = e.ToString();
                err.Ipaddress    = PubFunction.ipAdress;
                new Chain.BLL.SysError().Add(err);
                throw e;
            }
        }