protected void register_Click(object sender,EventArgs e)
        {
            Model.SB_User user = new Model.SB_User();
            user.User_Email = tbEmail.Text;
            user.User_OriginPsw = tbPass.Text;
            user.User_NickName = tbNickName.Text;
            user.User_BlogName = tbBlogName.Text;

            if(Factory.BLLFactory.CreateSB_UserBLL().Register(user) != 0)
            {
                Int32 id = Factory.BLLFactory.CreateSB_UserBLL().GetID(user);
                Session["logined"] = id;

                Response.Redirect("../Default.aspx");
            }
            Response.Write("<script language='javascript'>alert('注册失败');</script>");
        }
Beispiel #2
0
        public ActionResult Login(int Number = 0)
        {
            if (Number == 1)
            {
                Model.SB_User model = (Model.SB_User)Session[Keys.userInfo];
                new OperatRecord().operating(null, "0", "2", "/Home/MainPage", model);
            }


            Model.ModelViews.LoginInfo userinfo = new LoginInfo();
            if (Request.Cookies["UserName"] != null)
            {
                var namecookie = Request.Cookies["UserName"];
                userinfo.ULoginName = namecookie.Value;
            }

            Session["URL"] = "";
            return(View(userinfo));
        }
        protected void submit_Click(object sender, EventArgs e)
        {
            if (tbValid.Text.ToLower() == ((String)Session["valid"]).ToLower())
            {

                Model.SB_User user = new Model.SB_User();
                user.User_Email = tbEmail.Text;
                user.User_OriginPsw = tbPass.Text;

                if (Factory.BLLFactory.CreateSB_UserBLL().Login(user) != 0)
                {
                    Int32 id = Factory.BLLFactory.CreateSB_UserBLL().GetID(user);
                    Session["logined"] = id;

                    Response.Redirect("../Default.aspx");
                }
                Response.Write("<script language='javascript'>alert('登录失败');</script>");
            }
            else
            {
                Response.Write("<script language='javascript'>alert('验证码错误');</script>");
            }
        }
Beispiel #4
0
        public int operating(int?InstrumentID, string OperateType, string OperateChildType, string pageURL, Model.SB_User model)
        {
            //GetIpHelper ipmodel = new GetIpHelper();
            var ip   = "";
            var time = DateTime.Now;

            if (OperateType == "0")
            {
                var      pageres   = pmodel.QueryWhere(p => p.URL.Equals(pageURL)).FirstOrDefault();
                string[] str       = new string[] { "未知", "登录", "退出", "查询", "新增", "修改", "删除" };
                string   childType = "";
                switch (OperateChildType)
                {
                case "0":
                    childType += model.Name + "在时间" + time + "进行了未知的操作";
                    break;

                case "1":
                    childType += model.Name + "在时间" + time + "进行了" + str[1] + "的操作";
                    break;

                case "2":
                    childType += model.Name + "在时间" + time + "进行了" + str[2] + "的操作";
                    break;

                case "3":
                    childType += model.Name + "在时间" + time + "进行了" + str[3] + "的操作";
                    break;

                case "4":
                    childType += model.Name + "在时间" + time + "进行了" + str[4] + "的操作";
                    break;

                case "5":
                    childType += model.Name + "在时间" + time + "进行了" + str[5] + "的操作";
                    break;

                case "6":
                    childType += model.Name + "在时间" + time + "进行了" + str[6] + "的操作";
                    break;
                }

                Model.SB_OperateHistory operatmodel = new Model.SB_OperateHistory()
                {
                    UserId           = model.ID,
                    UserName         = model.Name,
                    IPAddress        = ip,
                    PageURL          = pageURL,
                    PageNameCN       = pageres.PageNameCN,
                    OperateTime      = time,
                    OperateChildType = OperateChildType,
                    OperateRecord    = childType,
                    OperateType      = OperateType,
                    ClientID         = model.ClientID,
                    Remark           = "等待",
                    Valid            = "1"
                };
                omodel.Add(operatmodel);
                int a = omodel.SaveChanges();
                if (a > 0)
                {
                    return(a);
                }
                else
                {
                    return(0);
                }
            }
            else if (OperateType == "1")
            {
                var      instrures = imodel.QueryWhere(i => i.ID == InstrumentID).FirstOrDefault();
                string[] str       = new string[] { "空压机操作", "干燥机操作", "过滤器操作", "冷干机操作", "", "", "" };
                string   record    = "";
                switch (OperateChildType)
                {
                case "7":
                    record += model.Name + "在时间" + time + "进行了" + str[0] + "的操作";
                    break;

                case "8":
                    record += model.Name + "在时间" + time + "进行了" + str[1] + "的操作";
                    break;

                case "9":
                    record += model.Name + "在时间" + time + "进行了" + str[2] + "的操作";
                    break;

                case "10":
                    record += model.Name + "在时间" + time + "进行了" + str[3] + "的操作";
                    break;
                }
                Model.SB_OperateHistory operatmodel = new Model.SB_OperateHistory()
                {
                    UserId           = model.ID,
                    UserName         = model.Name,
                    IPAddress        = ip,
                    PageURL          = pageURL,
                    OperateTime      = time,
                    OperateChildType = OperateChildType,
                    OperateRecord    = record,
                    OperateType      = OperateType,
                    ClientID         = instrures.ClientID,
                    AreaID           = instrures.AreaID,
                    StationID        = instrures.StationID,
                    FactoryID        = instrures.FactoryID,
                    InstrumentID     = instrures.ID,
                    Remark           = "等待",
                    Valid            = "1"
                };
                omodel.Add(operatmodel);
                int a = omodel.SaveChanges();
                if (a > 0)
                {
                    return(a);
                }
                else
                {
                    return(0);
                }
            }
            return(0);
        }