コード例 #1
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            int      uid = -1;
            UserInfo ui  = new UserInfo();

            postusername = Utils.ChkSQL(HTTPRequest.GetString("username"));
            postpassword = Utils.ChkSQL(HTTPRequest.GetString("password"));

            if (!ispost)
            {
                if (this.userid > 0)
                {
                    AddErrLine("您已经登录,无需重复登录。");
                    AddScript("window.setTimeout(function(){top.location='Default.aspx';},1500);");
                    SetShowMsgLink(false);
                }
            }
            else
            {
                try
                {
                    if (postpassword.Equals(""))
                    {
                        AddErrLine("密码不能为空");
                    }
                    else
                    {
                        if (postusername.Equals(""))
                        {
                            AddErrLine("用户名不能为空");
                        }
                        else
                        {
                            if (BLL.tbUserInfo.ExistsUserInfo(postusername))
                            {
                                uid = BLL.tbUserInfo.CheckPassword(postusername, postpassword, true);
                                if (uid != -1)
                                {
                                    UserInfo tui = BLL.tbUserInfo.GetUserInfoModel(uid);
                                    if (tui.uEstate == 1)
                                    {
                                        AddErrLine("抱歉, 您的用户身份尚未得到验证");
                                    }
                                    if (!IsErr())
                                    {
                                        BLL.tbUserInfo.DeleteErrLoginRecord(this.GetIP());
                                        tui.uLastIP       = this.GetIP();
                                        tui.uUpAppendTime = DateTime.Now;
                                        BLL.tbUserInfo.UpdateUserInfo(tui);
                                        UsersUtils.WriteUserCookie(uid, Utils.StrToInt(HTTPRequest.GetString("expires"), -1), config.Passwordkey, HTTPRequest.GetInt("loginmode", -1));
                                        UsersUtils.WriteCookie("UserPKey", DES.Encode(postpassword, config.Passwordkey));

                                        AddMsgLine("登录成功,页面转接中,请稍后!");

                                        AddScript("window.setTimeout(function(){top.location='Default.aspx';},1000);");

                                        SetShowMsgLink(false);
                                    }
                                }
                                else
                                {
                                    CheckPassErrorCount();
                                }
                            }
                            else
                            {
                                AddErrLine("用户不存在");
                            }
                        }
                    }
                    if (IsErr())
                    {
                        AddScript("window.setTimeout(function(){window.history.go(-1);},1500);");
                        SetShowMsgLink(false);
                    }
                }
                finally
                {
                    ui = null;
                }
            }
        }
コード例 #2
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            pagesize    = 20;
            PageBarHTML = "";
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("3-4-1-2"))
                {
                    pagecode = Utils.GetRanDomCode().Trim();
                    UsersUtils.WriteCookie("OrderPageCode", pagecode);

                    if (HTTPRequest.GetString("page").Trim() != "" && Utils.IsInt(HTTPRequest.GetString("page").Trim()))
                    {
                        pageindex = int.Parse(HTTPRequest.GetString("page").Trim());
                    }
                    else
                    {
                        pageindex = 1;
                    }
                    if (Act == "Edit")
                    {
                        StockID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);
                        si      = tbStockProductInfo.GetInventoryInfoModel(StockID);

                        if (ispost)
                        {
                            DateTime sDate         = Utils.IsDateString(Utils.ChkSQL(HTTPRequest.GetString("dtime"))) ? DateTime.Parse(Utils.ChkSQL(HTTPRequest.GetString("dtime"))) : DateTime.Now;
                            string   InventoryName = Utils.ChkSQL(HTTPRequest.GetString("InventoryName")); //盘点人
                            string   ManagerName   = Utils.ChkSQL(HTTPRequest.GetString("ManagerName"));   //仓管员
                            string   sTel          = Utils.ChkSQL(HTTPRequest.GetString("sTel"));
                            string   sAddress      = Utils.ChkSQL(HTTPRequest.GetString("sAddress"));
                            string   reValue       = HTTPRequest.GetString("reValue");

                            si.SAppendTime   = sDate;
                            si.StorageStaff  = ManagerName;
                            si.StaffPhoneNum = sTel;
                            si.StaffAdress   = sAddress;
                            si.InventoryName = InventoryName;

                            si.GetWarehouseDateJson = (GetWarehouseDateJsonList)JavaScriptConvert.DeserializeObject(reValue, typeof(GetWarehouseDateJsonList));

                            bool state = tbStockProductInfo.UpdateWarehouseList(si);
                            if (state)
                            {
                                AddErrLine("修改数据成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            else
                            {
                                AddErrLine("修改数据失败!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                        else
                        {
                            //ssi = tbStorageInfo.GetStorageInfoModel(si.StorageID);
                            dList       = tbStockProductInfo.getInventoryInfoList(si.StorageID, si.SDateTime);
                            PageBarHTML = Utils.TenPage(pageindex, pagetotal, 0);
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足! ");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }