示例#1
0
 /// <summary>
 /// 用户注册
 /// </summary>
 private void Registration()
 {
     Model.UserInfoModel model = new Model.UserInfoModel();
     model.UserId     = ReStr("uid");
     model.Email      = ReStr("Email", "");
     model.Pwd        = ReStr("Pwd");
     model.Birthday   = DateTime.Parse("1900-01-01");
     model.Phone      = ReStr("phone", "");
     model.PicBig     = "boy1";
     model.PicMid     = "boy2";
     model.PicSmall   = "boy3";
     model.WxOpenID   = ReStr("WxOpenID", "");
     model.UserCode   = DAL.DalComm.ExInt(" select MAX(UserCode) + 1 FROM    dbo.UserInfo ");
     model.CreateTime = DateTime.Now;
     BLL.UserBLL bll = new BLL.UserBLL();
     try
     {
         bll.Registration(model);
         bll.LoginIn(model.UserId, model.Pwd);
         ReDict2.Add("UserId", model.UserId);
         ReTrue();
     }
     catch (Exception ex)
     {
         ReThrow(ex);
     }
 }
示例#2
0
        public async Task <ActionResult> LoginIndex(string userName, string userPwd)
        {
            if (ModelState.IsValid)
            {
                BLL.UserBLL user = new BLL.UserBLL();
                if (await BLL.UserBLL.Login(userName, userPwd))
                {
                    var dbData = await user.GetUserOne(userName);

                    //跳转
                    //判断是用Session还是用cookie
                    Session["loginName"] = userName;
                    string 用户组 = await BLL.UserGroupBLL.GetUserGroupName(dbData.UserGroup_Id);

                    Session["userGroupName"] = 用户组;
                    return(RedirectToAction("index", "Home"));
                    //登录成功
                }
                else
                {
                    //ModelState.AddModelError("", "用户名或密码有就误");
                    ViewBag.error = "no";
                    //return this.Content("<script>alert('操作成功')</script>");
                }
            }
            return(View());
        }
 /// <summary>
 /// 验证登陆
 /// </summary>
 private void chkLogin(string go2Url, int BackStep)
 {
     if (JumbotOA.Utils.Cookie.GetValue("oa_user") != null)
     {
         UserId   = Validator.StrToInt(JumbotOA.Utils.Cookie.GetValue("oa_user", "id"), 0);
         UserName = JumbotOA.Utils.Cookie.GetValue("oa_user", "name");
         if (UserId != 0 && UserName.Length != 0)
         {
             JumbotOA.Entity.UserEntity model = new JumbotOA.Entity.UserEntity();
             model = new BLL.UserBLL().GetEntity(UserId);
             if (model.Uipaddress.Length > 0)
             {
                 if (Request.UserHostAddress != model.Uipaddress)
                 {
                     showErrMsg("非法IP地址登录", go2Url, BackStep);
                     return;
                 }
             }
             this.UserIsLogin = true;
             UserPosition     = model.Position;
             UserPowerId      = model.Pid;
             UserDepartmentId = model.Did;
             UserSetting      = model.Setting;
         }
     }
 }
示例#4
0
        public ActionResult Login(MODEL.ViewModel.LoginUser user)
        {
            BLL.UserBLL ubll = new BLL.UserBLL();
            MODEL.USER utemp = ubll.GetListBy(u => u.USER_N == user.LoginName && u.USER_PWD == user.Pwd).FirstOrDefault();
            if (utemp != null)
            {

                if (user.IsAlways)
                {

                    HttpCookie cookie = new HttpCookie("userinfo", utemp.USER_ID);
                    cookie.Expires = DateTime.Now.AddDays(1);

                    Response.Cookies.Add(cookie);
                }
                Session["userinfo"] = utemp;
                return Content("ok");

            }

            else
            {
                return Content("error");
            }
        }
 protected void Button1_Click1(object sender, EventArgs e)
 {
     Model.User user = new Model.User();
     user.username = this.username.Text.Trim();
     BLL.UserBLL userBLL = new BLL.UserBLL();
     if (userBLL.Query(user))
     {
         if (this.email.Text.Trim() == user.email.ToString())
         {
             if (this.realname.Text.Trim() == user.realname)
             {
                 if (userBLL.UpdateUser(user))
                 {
                     Response.Write("<script>alert('重置密码成功,新密码为:123456.登陆后请立即修改密码!');location.href='../system/login.aspx'</script>");
                 }
             }
             else
             {
                 Response.Write("<script>alert('真实姓名错误!')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('邮箱错误!')</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('无该用户!')</script>");
     }
 }
示例#6
0
        public void xxupdate()
        {
            Model.User user = new Model.User();
            user.username = Session["account"].ToString();

            BLL.UserBLL userBLL = new BLL.UserBLL();
            if (userBLL.Query(user))
            {
                if (this.oldpwd.Text.Trim() == user.password.ToString())
                {
                    user.password = this.newpwd.Text.Trim();
                    if (userBLL.Updatepwd(user))
                    {
                        Response.Write("<script>alert('密码修改成功!');location.href='change_password.aspx'</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('旧密码错误!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('无该用户!')</script>");
            }
        }
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     BLL.UserBLL helper = new BLL.UserBLL();
     //判断Session,验证权限
     if (context.Session["User"] != null&&context.Session["Admin"] != null)
     {
         int id = -1;
         int.TryParse(context.Request["id"], out id);
         if (id > 0)
         {
             if (helper.Delete(id))
             {
                 context.Response.Write("true");
             }
             else
             {
                 context.Response.Write("false");
             }
         }
         else
         {
             context.Response.Write("parameters error!");
         }
     }
     else
     {
         context.Response.Write("no permission!");
     }
 }
示例#8
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.textBox2.Text))
     {
         MessageBox.Show("密码必须填写");
         return;
     }
     if (string.IsNullOrWhiteSpace(this.textBox3.Text))
     {
         MessageBox.Show("新密码必须填写");
         return;
     }
     if (string.IsNullOrWhiteSpace(this.textBox4.Text))
     {
         MessageBox.Show("旧密码必须填写");
         return;
     }
     if (!this.textBox3.Text.Equals(this.textBox4.Text))
     {
         MessageBox.Show("密码不一致");
         return;
     }
     BLL.UserBLL bll = new BLL.UserBLL();
     if (bll.UpdatePassword(this.textBox2.Text, this.textBox3.Text, this.checkBox1.Checked))
     {
         MessageBox.Show("修改密码成功");
     }
     else
     {
         MessageBox.Show("帐号或密码错误");
     }
 }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            DataTable dtAll   = us.BindMenuByJosn(); //查询全部菜单
            string    strjson = string.Empty;

            if (context.Request.QueryString["Type"] == "View" &&
                !string.IsNullOrEmpty(context.Request.QueryString["GA02001"]))                                               //判断是否是查看
            {
                DataTable dtPart = new BLL.UserBLL().SelectSystemMenuBySystemRoleId(context.Request.QueryString["GA02001"]); //根绝角色id查询菜单
                strjson = ToViewJson(dtAll, dtPart);
            }
            else if (context.Request.QueryString["Type"] == "Edit" &&
                     !string.IsNullOrEmpty(context.Request.QueryString["GA02001"]))                                          //判断是否是编辑
            {
                DataTable dtPart = new BLL.UserBLL().SelectSystemMenuBySystemRoleId(context.Request.QueryString["GA02001"]); //根绝角色id查询菜单
                strjson = ToEditJson(dtAll, dtPart);
            }
            else
            {
                strjson = ToInitJson(dtAll);
            }
            context.Response.Write(strjson);
        }
示例#10
0
 protected void btnOk_Click(object sender, ImageClickEventArgs e)
 {
     Model.User sessionUser = Session["User"] as Model.User;
     Model.User u = new Model.User() { UserName = sessionUser.UserName , UserPassword = txtOldPwd.Text};
     if (String.IsNullOrEmpty(u.UserName) || String.IsNullOrEmpty(u.UserPassword) || !cvPwd.IsValid)
     {
         return;
     }
     u.UserPassword = Common.SecurityHelper.Encrypt(u.UserPassword);
     if (!sessionUser.UserPassword.Equals(u.UserPassword))
     {
         Response.Write("<script>alert('密码修改失败!原密码有误')</script>");
         return;
     }
     BLL.UserBLL helper = new BLL.UserBLL();
     u.UserPassword = Common.SecurityHelper.Encrypt(txtPwd.Text);
     if (helper.Update(u))
     {
         Session.Abandon();
         Response.Write("<script>alert('密码修改成功!请重新登录~~');location.href='/Admin/login.html'</script>");
     }
     else
     {
         Response.Write("<script>alert('密码修改失败!请稍后重试')</script>");
     }
 }
示例#11
0
        //安全获得用户资料
        private void GetUserJson()
        {
            BLL.UserBLL bll = new BLL.UserBLL();


            try
            {
                string Ukey = ReStr("Ukey");
                if (Ukey == "")
                {
                    throw new Exception("登陆信息不存在,请重新登陆!");
                }
                Ukey = Common.JiaMi.DeCode(Ukey);
                string[]  i      = Ukey.Split('|');
                string    UserId = i[0];
                string    pwd    = i[1];
                DataTable dt     = bll.GetUserData(UserId, pwd).Tables[0];

                if (dt.Rows.Count == 0)
                {
                    throw new Exception("登陆信息不存在,请重新登陆!");
                }
                string json = Common.JsonHelper.ToJson(dt);

                ReDict.Add("Uj", json);
                ReTrue();
            }
            catch (Exception ex)
            {
                bll.LoginOut();
                ReThrow(ex);
            }
        }
示例#12
0
        public string GetUserList()
        {
            BLL.UserBLL bll = new BLL.UserBLL();
            DataSet     ds  = bll.GetList("");

            return(ds.Tables[0].ToJson());
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NowDate = DateTime.Now.ToString();
            BLL.UserBLL           ubll = new BLL.UserBLL();
            BLL.MerchantBLL       mbll = new BLL.MerchantBLL();
            Model.CurrentMerModel cm   = BLL.MerchantBLL.CurrentModel();



            CurrentUserId = cm.CurrentUserId;
            IsAdmin       = ubll.IsAdministrator();

            if (CurrentUserId.Trim() == "" || CurrentUserId == null)
            {
                IsLogin = false;
                Response.Write("<script src=\"/Script/jquery-1.8.2.js\"></script><script src = \"/Script/ZYUiPub.js\" ></script> ");
                Response.Write("<script>window.parent.LoginCookie(); setTimeout(function(){ shuaxin(); },1000)  </script>");
                Response.End();
                // throw new Exception("您还没有登录!");
            }
            else
            {
                IsLogin = true;
            }

            StringBuilder s = new StringBuilder();

            s.Append(" var CurrentUserId='" + CurrentUserId + "'; ");
            s.Append(" var IsAdmin=" + IsAdmin.ToString().ToLower() + "; ");
            s.Append(" var IsLogin="******"; ");

            try
            {
                decimal MerId = Convert.ToDecimal(Request.QueryString["MerId"]);
                if (MerId == 0)
                {
                    MerId = BLL.MerchantBLL.CurrentModel().CurrentMerId;
                }

                if (MerId == 0)
                {
                }
                else
                {
                    mbll.CheckChangeMerPower(MerId);
                }



                MerJson = Common.JsonHelper.ToJsonNo1(mbll.GetMerInfoFaseById(MerId));

                s.Append(" var MerJson=" + MerJson + "; ");
            }
            catch
            {
            }

            ScriptStr = s.ToString();
        }
        public ActionResult Reg(FormCollection form)
        {
            BLL.UserBLL user = new BLL.UserBLL();
            int isSuccess ;
            isSuccess = user.register(form["username"], form["password"], form["email"], form["address"]);

            ViewData["isSuccess"] = isSuccess;
            return View();
        }
示例#15
0
        protected void BindRepeater(int index)
        {
            PagedDataSource pd = new PagedDataSource();

            pd.AllowPaging = true;//是否启用分页
            pd.PageSize    = 5;

            BLL.UserBLL userBLL = new BLL.UserBLL();
            pd.DataSource = userBLL.
        }
示例#16
0
 protected void user_register_Click(object sender, EventArgs e)
 {
     Model.User user = new Model.User();
     user.username = Request["inputAccount"].ToString();
     user.password = Request["inputPassword"].ToString();
     user.email    = this.inputEmail.Text.Trim();
     user.realname = Request["realname"].ToString();
     BLL.UserBLL ub = new BLL.UserBLL();
     ub.Register(user);
 }
示例#17
0
        /// <summary>
        /// 后台用户登录
        /// </summary>
        private void UserLogin()
        {
            try
            {
                Model.UserInfoModel model = new Model.UserInfoModel();
                string inputStr           = ReStr("inputStr", "");
                if (inputStr == "")
                {
                    throw new Exception("必须填写登录名!");
                }

                string Pwd           = ReStr("Pwd");
                int    RememberMouth = ReInt("RememberMouth", 120);
                string WxOpenID      = ReStr("WxOpenID", "");


                BLL.UserBLL bll = new BLL.UserBLL();


                string UserId = bll.UserLoginBackUserId(inputStr, Pwd, RememberMouth);
                if (UserId == null || UserId == "")
                {
                    throw new Exception("用户名不存在或密码不正确!");
                }
                else
                {
                    if (WxOpenID.Trim() != "")
                    {
                        DAL.DalComm.ExStr("update CORE.dbo.UserInfo set WxOpenID='" + WxOpenID + "' where UserId='" + UserId + "' ");
                    }


                    ReDict2.Add("WxOpenID", WxOpenID);
                    ReDict2.Add("UserId", UserId);

                    string sourse = ReStr("s", "");
                    if (sourse == "app")
                    {
                    }
                    else
                    {
                    }
                    DataSet   ds = DAL.DalComm.BackData(" select * from CORE.dbo.UserMerRoleView where UserId='" + UserId + "' ");
                    DataTable dt = ds.Tables[0];
                    ReDict.Add("MerRoleList", Common.JsonHelper.ToJson(dt));
                    ReTrue();
                }

                string s = ReStr("s", "");
            }
            catch (Exception ex)
            {
                ReThrow(ex);
            }
        }
示例#18
0
 public void xxupdate()
 {
     Model.User user = new Model.User();
     user.username = s;
     user.email    = this.email.Text.ToString();
     user.realname = this.realname.Text.ToString();
     BLL.UserBLL userBLL = new BLL.UserBLL();
     if (userBLL.Updateinfo(user))
     {
         Response.Write("<script>alert('信息更新成功!');location.href='user_information.aspx'</script>");
     }
 }
        public ActionResult Login(FormCollection form)
        {
            BLL.UserBLL user = new BLL.UserBLL();
            bool isSuccess;
            isSuccess = user.login(form["username"], form["password"]);
            string message;
            if (isSuccess == true)
            {

            }
            ViewData["isSuccess"] = isSuccess;
            return View();
        }
        protected void ibtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string sQuestion;

                 if(!string.IsNullOrEmpty(ddlSecurityQuestion.SelectedValue))
                {
                    sQuestion = ddlSecurityQuestion.SelectedValue;
                }
                else
                {
                    sQuestion = txtOtherSecurityQuestion.Text;
                }

                string sAnswer = txtAnswer.Text;
                if (sAnswer.Trim().Length == 0)
                {
                    lblMessage.Text = "Debe ingresar una respuesta";
                    return;
                }

                // Comprobar la contraseña con el usuario logueado
                AdamHelper MemberProv = new AdamHelper();
                string sUser;

                sUser =  SPContext.Current.Web.CurrentUser.LoginName;
                string sPassword = txtPwd.Text.Trim();
                if (MemberProv.ValidateUser(sUser.Substring(sUser.IndexOf(":") + 1), sPassword))
                {
                    // Update in Profile!!
                    BLL.UserBLL MyUserBLL = new BLL.UserBLL(SPContext.Current.Web);
                    Entities.User MyUser = MyUserBLL.GetUser(sUser);
                    MyUser.SecurityQuestion = sQuestion;
                    MyUser.SecurityAnswer = sAnswer;
                    MyUserBLL.ModifyUser(MyUser);

                    ibtnSubmit.Enabled = false;

                    lblMessage.Text = "La pregunta de seguridad se ha actualizado correctamente";
                }
                else
                {
                    lblMessage.Text = "Uno o más datos requeridos no han sido diligenciados correctamente"; //  "La contraseña no es correcta";
                }
            }
            catch (Exception Ex)
            {
                CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(Ex, ref lblMessage, ConfigurationSettings.AppSettings["LogInEventViewer"]);
            }
        }
示例#21
0
        public string ResetPwd(int id)
        {
            BLL.UserBLL bll    = new BLL.UserBLL();
            bool        result = bll.UpdatePwd(id);

            if (result)
            {
                return("重置密码成功".ToJson());
            }
            else
            {
                return("重置密码失败!".ToJson());
            }
        }
示例#22
0
        public string DeleteUser(int id)
        {
            BLL.UserBLL bll    = new BLL.UserBLL();
            bool        result = bll.Delete(id);

            if (result)
            {
                return("删除用户成功".ToJson());
            }
            else
            {
                return("删除用户失败!".ToJson());
            }
        }
示例#23
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.User user = new Model.User();
     user.username = Request["search"].ToString().Trim();
     BLL.UserBLL userBLL = new BLL.UserBLL();
     if (userBLL.Query(user))
     {
         this.SqlDataSource1.SelectCommand = user.sql;
     }
     else
     {
         Response.Write("<script>alert('无该用户!')</script>");
     }
 }
示例#24
0
        private void bind()
        {
            BLL.UserBLL bll = new BLL.UserBLL();
            this.dataGridView2.DataSource = bll.GetData();
            BLL.DeviceDataAreaBLL bll1  = new BLL.DeviceDataAreaBLL();
            DataTable             table = bll1.GetData();

            Models.DeviceDataArea area = null;
            if (table.Rows.Count > 0)
            {
                area = bll1.GetModelByRow(table.Rows[0]);
                this.textBox6.Text = area.MaxValue.ToString();
                this.textBox5.Text = area.MinValue.ToString();
            }
        }
示例#25
0
 public void query(string id)
 {
     Model.User user = new Model.User();
     user.username = id;
     BLL.UserBLL userBLL = new BLL.UserBLL();
     if (userBLL.Query(user))
     {
         this.Label2.Text = user.email.ToString();
         this.Label3.Text = user.realname.ToString();
     }
     else
     {
         Response.Write("<script>alert('查询失败')</script>");
     }
 }
示例#26
0
        /// <summary>
        /// 忘记密码
        /// </summary>
        private void ForgetPwdForEmail()
        {
            string UserId = DAL.DalComm.ExStr(" select top 1 UserId from dbo.UserInfo WITH(NOLOCK) where Email ='" + ReStr("EmailOrUserId") + "' or  UserId ='" + ReStr("EmailOrUserId") + "' ");

            if (UserId == "")
            {
                throw new Exception("用户名或邮箱填写不正确!");
            }
            else
            {
                BLL.UserBLL bll   = new BLL.UserBLL();
                string      Email = bll.BackPwdMail(UserId);
                ReDict2.Add("Email", Email);
                ReTrue();
            }
        }
示例#27
0
 protected void Button1_Click1(object sender, EventArgs e)
 {
     Model.User user = new Model.User();
     user.username = Request["inputAccount"].ToString().Trim();
     user.password = Request["inputPassword"].ToString().Trim();
     BLL.UserBLL ub = new BLL.UserBLL();
     if (ub.Login(user))
     {
         Session["account"] = Request["inputAccount"].ToString().Trim();
         Response.Redirect("../../main.aspx?account=" + Session["account"].ToString());
     }
     else
     {
         Response.Write("<script>alert('登陆失败')</script>");
     }
 }
示例#28
0
        private void CheckEmail()
        {
            BLL.UserBLL bll = new BLL.UserBLL();

            string Email = ReStr("Email");

            DataSet ds = bll.GetUserList(" Email='" + Email + "' ");

            if (ds.Tables[0].Rows.Count > 0)
            {
                throw new Exception("邮件已经存在!");
            }
            else
            {
                ReTrue();
            }
        }
示例#29
0
 private void SaveUser()
 {
     Model.UserInfoModel model = new Model.UserInfoModel();
     model.Birthday     = ReTime("Birthday", DateTime.Parse("1900-01-01"));
     model.CreateTime   = DateTime.Now;
     model.Currency     = 0;
     model.Email        = ReStr("Email", "");
     model.FlagMerchant = true;
     model.IdNo         = ReStr("IdNo", "");
     model.Memo         = ReStr("Memo", "");
     model.Phone        = ReStr("Phone", "");
     model.PicBig       = ReStr("PicBig", "");
     model.PicMid       = ReStr("PicMid", "");
     model.PicSmall     = ReStr("PicSmall", "");
     model.Power        = 0;
     model.Pwd          = ReStr("Pwd", "");
     model.PwdMd5       = ReStr("PwdMd5", "");
     model.qq           = ReStr("qq", "");
     model.RealName     = ReStr("RealName", "");
     model.Sex          = ReStr("sex", "未知");
     model.StreetId     = 0;
     model.Tell         = ReStr("Tell", "");
     model.TownId       = 1;
     model.UserCode     = ReInt("UserCode", 0);
     model.UserId       = ReStr("uid", "");
     if (model.UserId.Trim() == "")
     {
         throw new Exception("不能为空!");
     }
     model.UserLv     = ReInt("UserLv", 90);
     model.UserTitle  = ReStr("UserTitle", "");
     model.UserTypeId = 3;
     model.Validated  = ReBool("Validated", true);
     model.WxOpenID   = ReStr("WxOpenID", "");
     BLL.MerchantBLL mbll = new BLL.MerchantBLL();
     BLL.UserBLL     ubll = new BLL.UserBLL();
     if (model.UserId == "小王")
     {
         if (ubll.CurrentUserId() != "小王")
         {
             throw new Exception("小王不是一般人能改的!-_-!");
         }
     }
     ubll.SaveMyUserInfo(model);
     ReTrue();
 }
示例#30
0
        private void CheckUserId()
        {
            BLL.UserBLL bll = new BLL.UserBLL();

            string UserId = ReStr("UserId");

            DataSet ds = bll.GetUserData(UserId);

            if (ds.Tables[0].Rows.Count > 0)
            {
                throw new Exception("用户名已经存在!");
            }
            else
            {
                ReTrue();
            }
        }
示例#31
0
        private void CheckCurrentPwd()
        {
            BLL.UserBLL bll = new BLL.UserBLL();

            string pwd    = ReStr("OldPwd");
            string UserId = bll.CurrentUserId();

            if (bll.CheckUserIdAndPwd(UserId, pwd))
            {
                //用户密码正确!
                ReTrue();
            }
            else
            {  //用户密码错误!
                throw new Exception("密码输入错误!");
            }
        }
示例#32
0
        private void login_btn_Click(object sender, EventArgs e)
        {
            string username = this.userName_txb.Text.Trim();
            string passwd   = this.passwd_txb.Text.Trim();

            BLL.UserBLL instance = BLL.UserBLL.GetUserBLL();
            string      msg      = "";

            if (instance.Login(username, passwd, out msg)) //通过调用UserBLL的Login方法检测用户名密码是否正确
            {
                if (remenber_ckb.Checked)                  //若成功登陆,则检测是否勾选记住密码
                {
                    //勾选则将用户名密码保存到user.xml文件中,该文件为xml文件
                    if (!XmlRW.GetXmlRW().UpdateXML(@"user.xml", "1", username, passwd))
                    {
                        MessageBoxBuilder.buildbox("保存失败!", "错误!");
                    }
                }
                else
                {
                    XmlRW.GetXmlRW().UpdateXML(@"user.xml", "0", "", "");//没有勾选则将上次保存记录删除
                }
                UserHelper.userName = username;
                UserHelper.password = passwd; //将用户名密码保存为static全局变量,让其能在程序任意地方调用
                UserHelper.id       = BLL.UserBLL.GetUserBLL().GetIdByName(username);
                this.Hide();
                MainUI r = new MainUI();  //将界面切换至主界面
                r.Show();
            }
            //检测失败则给用户显示错误信息
            else if (!"".Equals(msg))
            {
                MessageBoxBuilder.buildbox(msg, "错误!");
                this.userName_txb.Text = "";
                this.passwd_txb.Text   = "";
                this.userName_txb.Focus();
            }
            else
            {
                MessageBoxBuilder.buildbox("登录失败!", "错误!");
                this.userName_txb.Text = "";
                this.passwd_txb.Text   = "";
                this.userName_txb.Focus();
            }
        }
示例#33
0
        /// <summary>
        /// 完善资料
        /// </summary>
        private void SaveMyUserInfo()
        {
            BLL.UserBLL ubll = new BLL.UserBLL();


            Model.UserInfoModel model = ubll.GetModel(ubll.CurrentUserId());
            if (model.UserId.Trim() != "")
            {
                model = ubll.GetModel(model.UserId);
            }

            model.Birthday   = ReTime("Birthday");
            model.CreateTime = DateTime.Now;
            model.Memo       = ReStr("Memo");
            model.RealName   = ReStr("RealName");
            model.Sex        = ReStr("Sex");
            model.TownId     = ReDecimal("TownId");
            if (model.UserTitle != ReStr("UserTitle"))
            {
                try
                {
                    //用户修改了状态
                    Model.DynamicModel dyModel = new Model.DynamicModel();
                    dyModel.DynamicLv     = 80;
                    dyModel.DynamicMerId  = 0;
                    dyModel.DynamicTitle  = "" + model.UserId + "修改了自己的状态: '" + Common.StringPlus.GetLeftStr(ReStr("UserTitle"), 100, "...") + "'";
                    dyModel.DynamicType   = "用户状态";
                    dyModel.DynamicUserId = model.UserId;
                    BLL.CommBLL.AddDynamic(dyModel);
                }
                catch (Exception ex)
                {
                    //什么都不做,失败就算了,不重要.
                }
            }

            model.UserTitle = ReStr("UserTitle");
            model.PicBig    = ReStr("PicBig");
            model.PicMid    = model.PicBig;
            model.PicSmall  = model.PicBig;

            model.qq = ReStr("qq", "");
            ubll.SaveMyUserInfo(model);
            ReTrue();
        }
示例#34
0
        //删除数据
        protected void lbDel_Click(object sender, CommandEventArgs e)
        {
            User_Load("sch-list");
            string oname = Getoname();

            Daiv_OA.BLL.SchoolGradeBLL SchoolGradeBll = new Daiv_OA.BLL.SchoolGradeBLL();
            Daiv_OA.BLL.UserBLL        userBll        = new BLL.UserBLL();
            int sid = Convert.ToInt32(e.CommandArgument);

            Entity.SchoolGradeEntity SchoolGradeEntity = SchoolGradeBll.GetEntity(sid);
            SchoolGradeBll.Delete(sid);
            logHelper.logInfo("删除年级成功!操作人:" + oname);
            string stuStr = Newtonsoft.Json.JsonConvert.SerializeObject(SchoolGradeEntity);

            logHelper.logInfo("删除年级:" + stuStr);
            Adminlogadd(oname);
            Bind();
        }
示例#35
0
        private void GetUserData()
        {
            BLL.UserBLL bll = new BLL.UserBLL();


            try
            {
                DataTable dt   = bll.GetUserData(ReStr("uid")).Tables[0];
                string    json = Common.JsonHelper.ToJsonNo1(dt);

                ReDict.Add("UserInfo", json);
                ReTrue();
            }
            catch (Exception ex)
            {
                ReThrow(ex);
            }
        }
示例#36
0
        //删除数据
        protected void lbDel_Click(object sender, CommandEventArgs e)
        {
            User_Load("mech-list");
            string oname = Getoname();

            Daiv_OA.BLL.MechanicalBLL MechanicalBll = new Daiv_OA.BLL.MechanicalBLL();
            Daiv_OA.BLL.UserBLL       userBll       = new BLL.UserBLL();
            int sid = Convert.ToInt32(e.CommandArgument);

            Entity.MechanicalEntity MechanicalEntity = MechanicalBll.GetEntity(sid);
            MechanicalBll.Delete(sid);
            logHelper.logInfo("删除设备成功!操作人:" + oname);
            string stuStr = Newtonsoft.Json.JsonConvert.SerializeObject(MechanicalEntity);

            logHelper.logInfo("删除设备:" + stuStr);
            Adminlogadd(oname);
            Bind();
        }
示例#37
0
 protected void btnAdd_Click(object sender, ImageClickEventArgs e)
 {
     Model.User u = new Model.User() { UserName= txtUid.Text,UserPassword=txtPwd.Text,AddTime=DateTime.Now};
     if (String.IsNullOrEmpty(u.UserName)||String.IsNullOrEmpty(u.UserPassword)||!cvPwd.IsValid)
     {
         return;
     }
     u.UserPassword = Common.SecurityHelper.Encrypt(u.UserPassword);
     BLL.UserBLL helper = new BLL.UserBLL();
     if (helper.ExistUserName(u.UserName))
     {
         Response.Write("<script>alert('添加失败!该用户名已经存在')</script>");
         return;
     }
     if (helper.Add(u))
     {
         Response.Redirect("UserManage.aspx");
     }
     else
     {
         Response.Write("<script>alert('添加失败!请稍后重试')</script>");
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                SPWeb web = SPContext.Current.Web;
                BLL.UserBLL userBLL = new BLL.UserBLL(web);
                string message;

                Entities.User userEntity = AssignDataToEntity();
                if (userBLL.GetUserByIdentificationtAndCompanyCompanyUser(userEntity.IdentificationType, userEntity.IdentificationNumber, userEntity.NIT, userEntity.SubNIT) == null)
                {
                    if (!userBLL.CreateUser(userEntity, out message))
                    {
                        lblError.Text = message;
                    }
                    else
                    {
                        lblError.Text = "El proceso de registro ha finalizado exitosamente. ";
                        lblError.Visible = true;
                        lnkGoHome.Visible = true;
                        tblPrincipal.Visible = false;

                        Commons.EmailHelper emailHelper = new CAFAM.WebPortal.Commons.EmailHelper(SPContext.Current.Web);

                        //emailHelper.SendMailNewCompanyUserData(ConfigurationSettings.AppSettings["ContactNewUserCompanyFrom"], ConfigurationSettings.AppSettings["SMTPServer"], userEntity);
                        emailHelper.SendMailNewCompanyUserData(ConfigurationSettings.AppSettings["ContactNewUserCompanyFrom"], userEntity);
                    }
                }
                else
                {
                    lblError.Text = "Ya existe un usuario registrado para esta empresa. ";
                }
                lblError.Visible = true;

            }
            catch (Exception ex)
            {
                CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(ex, ref lblError, ConfigurationSettings.AppSettings["LogInEventViewer"]);
            }
        }
示例#39
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                WebUI.CaptchaValidator captchaControl = (WebUI.CaptchaValidator)pnlCaptcha.FindControl("captchaControl");

                if (captchaControl != null)
                {
                    captchaControl.Validate();
                    if (captchaControl.IsValid)
                    {
                        SPWeb web = SPContext.Current.Web;

                        Entities.User userEntity = AssignDataToEntity();
                        BLL.UserBLL userBLL = new BLL.UserBLL(web);

                        userBLL.AddNewUserCompany(userEntity);

                        lblError.Text = "El proceso de registro ha finalizado. Usted recibirá un correo electrónico con el usuario y contraseña. ";
                        lblError.Visible = true;
                        lnkCommon.Visible = true;
                        lnkCommon.Text = "Volver al Home.";
                        lnkCommon.NavigateUrl = "~/default.aspx";
                        tblPrincipal.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(ex, ref lblError, ConfigurationSettings.AppSettings["LogInEventViewer"]);
            }
        }
示例#40
0
        protected void btnModify_Click(object sender, EventArgs e)
        {
            try
            {
                SPWeb web = SPContext.Current.Web;

                AssignDataToEntity();
                BLL.UserBLL userBLL = new BLL.UserBLL(web);
                userBLL.ModifyUser(UserEntity);
                lblError.Text = "Los cambios fueron guardados con éxito. ";
                lblError.Visible = true;
                lnkGoHome.Visible = true;
            }
            catch (Exception ex)
            {
                CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(ex, ref lblError, ConfigurationSettings.AppSettings["LogInEventViewer"]);
            }
        }
 void showlist()
 {
     if (txtid.Text.Trim() != "")
     {
         qs.Visible = true;
         JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
         int id = Convert.ToInt32(txtid.Text.Trim());
         model = new BLL.TaskBLL().GetEntity(id);
         if (id == 4 || id == 8)
         { Workprogress.SelectedValue = model.Workprogress.ToString(); }
         this.txtBegintime.Text = model.Nowtime.ToString();
         this.txtEndtime.Text = model.Plantime.ToString();
         this.txtTitle.Text = model.Tasktitle.ToString();
         JumbotOA.Entity.UserEntity userEntity = new JumbotOA.Entity.UserEntity();
         userEntity = new BLL.UserBLL().GetEntity(model.Uid);
         Uidtxt.Text = userEntity.Uname.ToString();
     }
     else
         qs.Visible = false;
 }
 /// <summary>
 /// 验证登陆
 /// </summary>
 private void chkLogin(string go2Url, int BackStep)
 {
     if (JumbotOA.Utils.Cookie.GetValue("oa_user") != null)
     {
         UserId = Validator.StrToInt(JumbotOA.Utils.Cookie.GetValue("oa_user", "id"), 0);
         UserName = JumbotOA.Utils.Cookie.GetValue("oa_user", "name");
         if (UserId != 0 && UserName.Length != 0)
         {
             JumbotOA.Entity.UserEntity model = new JumbotOA.Entity.UserEntity();
             model = new BLL.UserBLL().GetEntity(UserId);
             if (model.Uipaddress.Length > 0)
             {
                 if (Request.UserHostAddress != model.Uipaddress)
                 {
                     showErrMsg("非法IP地址登录", go2Url, BackStep);
                     return;
                 }
             }
             this.UserIsLogin = true;
             UserPosition = model.Position;
             UserPowerId = model.Pid;
             UserDepartmentId = model.Did;
             UserSetting = model.Setting;
         }
     }
 }
        //信息绑定
        void Bind()
        {
            JumbotOA.Entity.TaskEntity model = new JumbotOA.Entity.TaskEntity();
            model = new BLL.TaskBLL().GetEntity(Str2Int(q("id")));
            if (model.Ttype == "锁定")
            {
                Response.Redirect("Locked.aspx");

            }
            JumbotOA.Entity.UserEntity userEntity = new JumbotOA.Entity.UserEntity();
            userEntity = new BLL.UserBLL().GetEntity(model.Uid);
            this.txtBegintime.Text = model.Nowtime.ToString();
            this.txtEndtime.Text = model.Plantime.ToString();
            this.txtTitle.Text = model.Tasktitle;
            this.ddlWorker.SelectedValue = userEntity.Uid.ToString();
            txt.Text = model.Content;
            questext.Text = model.Question;
            this.ddlWorker.Enabled = false;
            this.classse.SelectedValue = model.Classse;
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                WebUI.CaptchaValidator captchaControl = (WebUI.CaptchaValidator)pnlCaptcha.FindControl("captchaControl");

                if (captchaControl != null)
                {
                    captchaControl.Validate();
                    if (captchaControl.IsValid)
                    {
                        SPWeb web = SPContext.Current.Web;
                        string message;

                        BLL.UserBLL userBLL = new BLL.UserBLL(web);

                        AssignDataToEntity();

                        if (!userBLL.CreateUser(UserEntity, out message))
                        {
                            lblError.Text = message;
                        }
                        else
                        {
                            lblError.Text = "El proceso de registro ha finalizado exitosamente. ";
                            lnkGoHome.Visible = true;
                            tblPrincipal.Visible = false;
                        }

                        lblError.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(ex, ref lblError, ConfigurationSettings.AppSettings["LogInEventViewer"]);
            }
        }