Exemplo n.º 1
0
        /// <summary>
        /// 新增党支部用户
        /// </summary>
        public static int AddDzb(string pkid, string bmbh, string dzbbh, string dzbmc, string uid, string pwd)
        {
            try
            {
                Model.Account_user u = new Model.Account_user();
                //u.Pkid = Guid.NewGuid().ToString().Replace(DefSort = "Bmdm,Dzbdm,Bjmc,Xh", "").ToUpper();
                u.Pkid     = pkid;
                u.DeptID   = TU.Globals.BindSystemCode(Globals.SystemCode.DtJd_bm, "Pkid", "Bmdm", bmbh, "");
                u.UserID   = uid;
                u.UserName = dzbmc;
                u.Password = BLL.Globals.MD5Encrypt(pwd);
                u.Level    = "02";
                int r = TUD.SQLHelper.Insert <Model.Account_user>(u);

                return(r);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("CI") >= 0)
                {
                    throw new Exception("帐号已存在 !");
                }
                else
                {
                    throw err;
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 保存登录信息
 /// </summary>
 public static void SaveSession(Model.Account_user user)
 {
     if (user != null)
     {
         TU.Globals.SetObject(user, "$SystemCode$UserInfo", false);
     }
 }
Exemplo n.º 3
0
 public static bool ValidatePhone(string uid, string phone)
 {
     Model.Account_user u = GetEntityByUserId(uid);
     if (!String.IsNullOrEmpty(u.Pkid) && (u.Mobile == phone))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 public static bool ValidateCode(string uid, string code)
 {
     Model.Account_user u = GetEntityByUserId(uid);
     if (code == u.VerifyCode && DateTime.Now.Ticks <= u.Timestamp)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
        public static Model.Account_user Validate(string uid, string pwd)
        {
            pwd = BLL.Globals.MD5Encrypt(pwd);

            Model.Account_user u = GetEntityByUserId(uid);
            if (!String.IsNullOrEmpty(u.Pkid) && u.Status == "01" && u.Password == pwd)
            {
                return(u);
            }
            return(null);
        }
Exemplo n.º 6
0
 private void ShowUI()
 {
     if (!isNew)
     {
         Model.Account_user u = BLL.Account.GetEntity(Pkid);
         if (String.IsNullOrEmpty(u.Pkid))
         {
             PageContext.RegisterStartupScript(Alert.GetShowInParentReference("页面参数不正确 !", "打开失败", MessageBoxIcon.Error) + ActiveWindow.GetHideReference());
             return;
         }
         this.hfdPkid.Text = u.Pkid;
         this.tbxUid.Text  = u.UserID;
     }
 }
Exemplo n.º 7
0
            /// <summary>
            /// 检查登录信息
            /// </summary>
            public static void CheckAuthority()
            {
                if (Globals.debug && UserInfo == null)
                {
                    UserInfo = TUD.SQLHelper.GetEntity <Model.Account_user>("UserID", csyh);//Admin xxxy Director 201705011101 600372 600928
                    Model.Jcgl.V_jc_lxr l = null;
                    switch (TStar.Utility.Common.ConvertHelper.EnumParse <TStar.Web.Globals.SystemSetting.UserLevel>(UserInfo.Level))
                    {
                    case TStar.Web.Globals.SystemSetting.UserLevel.Student:
                        Model.Jcgl.V_jc_xs xs = TUD.SQLHelper.GetEntity <Model.Jcgl.V_jc_xs>(UserInfo.Pkid);
                        UserInfo.Dzbbh  = xs.Dzbbh;
                        UserInfo.Dzbmc  = xs.Dzbmc;
                        UserInfo.Fzztdm = xs.Fzztdm;
                        UserInfo.Fzzt   = xs.Fzzt;
                        break;

                    case TStar.Web.Globals.SystemSetting.UserLevel.Contacts:
                        l = TUD.SQLHelper.GetEntity <Model.Jcgl.V_jc_lxr>(UserInfo.Pkid);
                        UserInfo.Dzbbh  = l.Dzbbh;
                        UserInfo.Dzbmc  = l.Dzbmc;
                        UserInfo.Fzztdm = "0";
                        UserInfo.Fzzt   = "联系人";
                        break;

                    case TStar.Web.Globals.SystemSetting.UserLevel.Branch:
                        l = TUD.SQLHelper.GetEntity <Model.Jcgl.V_jc_lxr>(UserInfo.Pkid);
                        UserInfo.Dzbbh  = l.Dzbbh;
                        UserInfo.Dzbmc  = l.Dzbmc;
                        UserInfo.Fzztdm = "0";
                        UserInfo.Fzzt   = "党支部";
                        break;

                    case TStar.Web.Globals.SystemSetting.UserLevel.Committee:
                        l = TUD.SQLHelper.GetEntity <Model.Jcgl.V_jc_lxr>(UserInfo.Pkid);
                        UserInfo.Dzbbh  = l.Dzbbh;
                        UserInfo.Dzbmc  = l.Dzbmc;
                        UserInfo.Fzztdm = "0";
                        UserInfo.Fzzt   = "分党委";
                        break;
                    }
                }

                if (!IsLogined())
                {
                    Page.Response.Redirect("~/logout.aspx");
                }
            }
Exemplo n.º 8
0
        private static void GetExtendInfo(Model.Account_user u)
        {
            Model.Jcgl.V_jc_lxr l = null;
            switch (TStar.Utility.Common.ConvertHelper.EnumParse <TStar.Web.Globals.SystemSetting.UserLevel>(u.Level))
            {
            case TStar.Web.Globals.SystemSetting.UserLevel.Student:
                Model.Jcgl.V_jc_xs xs = BLL.Global.Base.GetEntity <Model.Jcgl.V_jc_xs>(u.Pkid);
                u.Dzbbh  = xs.Dzbbh;
                u.Dzbmc  = xs.Dzbmc;
                u.Fzztdm = xs.Fzztdm;
                u.Fzzt   = xs.Fzzt;
                break;

            case TStar.Web.Globals.SystemSetting.UserLevel.Contacts:
                l        = BLL.Global.Base.GetEntity <Model.Jcgl.V_jc_lxr>(u.Pkid);
                u.Dzbbh  = l.Dzbbh;
                u.Dzbmc  = l.Dzbmc;
                u.Fzztdm = "0";
                u.Fzzt   = "联系人";
                break;

            case TStar.Web.Globals.SystemSetting.UserLevel.Branch:
                l        = BLL.Global.Base.GetEntity <Model.Jcgl.V_jc_lxr>(u.Pkid);
                u.Dzbbh  = l.Dzbbh;
                u.Dzbmc  = l.Dzbmc;
                u.Fzztdm = "0";
                u.Fzzt   = "党支部";
                break;

            case TStar.Web.Globals.SystemSetting.UserLevel.Committee:
                l        = BLL.Global.Base.GetEntity <Model.Jcgl.V_jc_lxr>(u.Pkid);
                u.Dzbbh  = l.Dzbbh;
                u.Dzbmc  = l.Dzbmc;
                u.Fzztdm = "0";
                u.Fzzt   = "分党委";
                break;

            case TStar.Web.Globals.SystemSetting.UserLevel.Party:
                u.Dzbbh  = "";
                u.Dzbmc  = "党总支";
                u.Fzztdm = "0";
                u.Fzzt   = "党总支";
                break;
            }
        }
Exemplo n.º 9
0
 public static void Insert(Model.Jcgl.Jc_xs m)
 {
     Model.Account_user au = new Model.Account_user();
     au.DeptID   = TU.Globals.BindSystemCode(Globals.SystemCode.DtJd_bm, "Pkid", "Bmdm", m.Bmbh, "");
     au.UserID   = m.Xh;// ("Xs" + DateTime.Now.Ticks.ToString() + Guid.NewGuid().ToString().Replace("-", "")).Substring(0, 32);
     au.UserName = m.Xm;
     au.Level    = "00";
     try
     {
         Insert <Model.Account_user>(au);
         m.Pkid = au.Pkid;
         m.Sfzh = DateTime.Now.Ticks.ToString();
         Insert <Model.Jcgl.Jc_xs>(m);
     }
     catch (Exception err)
     {
         string s = err.Message;
     }
 }
Exemplo n.º 10
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            TStar.Web.Globals.Account.RemoveSession();

            string uid    = this.tbxUserID.Text.Trim();
            string pwd    = this.tbxPassword.Text.Trim();
            string errMsg = "";

            if (String.IsNullOrEmpty(uid))
            {
                errMsg += "请输入用户名 !\n";
            }
            if (String.IsNullOrEmpty(pwd))
            {
                errMsg += "请输入密码 !\n";
            }
            if (errMsg.Length > 0)
            {
                Alert.Show(errMsg, "提示", MessageBoxIcon.Warning);
                return;
            }

            try
            {
                Model.Account_user user = BLL.Account.Validate(uid, pwd);
                if (user == null)
                {
                    Alert.Show("用户名或密码不正确 !", "提示", MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    TStar.Web.Globals.Account.SaveSession(user);
                    //Response.Redirect("Frame.aspx");
                    Page.Response.Redirect("./Frame.aspx");
                }
            }
            catch (Exception err)
            {
                string s = err.Message;
            }
        }
Exemplo n.º 11
0
 public static bool Update(Model.Jcgl.Jc_xs m, bool modUser)
 {
     try
     {
         if (modUser)
         {
             Model.Account_user au = new Model.Account_user();
             au.Pkid     = m.Pkid;
             au.UserID   = m.Xh;
             au.UserName = m.Xm;
             au.Mobile   = m.Sjhm;
             UpdateFields <Model.Account_user>(au, "UserId", "UserName", "Mobile");
         }
         return(Update <Model.Jcgl.Jc_xs>(m) > 0);
     }
     catch (Exception err)
     {
         throw err;
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// 修改党支部用户
 /// </summary>
 public static int ModDzb(string pkid, string uid, string pwd)
 {
     try
     {
         Model.Account_user u = new Model.Account_user();
         u.Pkid     = pkid;
         u.UserID   = uid;
         u.Password = BLL.Globals.MD5Encrypt(pwd);
         int r = string.IsNullOrEmpty(pwd) ? TUD.SQLHelper.UpdateFields <Model.Account_user>(u, "UserID") : TUD.SQLHelper.UpdateFields <Model.Account_user>(u, "UserID", "Password");
         return(r);
     }
     catch (Exception err)
     {
         if (err.Message.IndexOf("CI") >= 0)
         {
             throw new Exception("帐号已存在 !");
         }
         else
         {
             throw err;
         }
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 新增联系人用户
        /// </summary>
        public static int AddLxr(string pkid, string bmbh, string dzbbh, string gh, string xm, string sjhm, bool issj)
        {
            try
            {
                Model.Account_user u = new Model.Account_user();
                u.Pkid     = pkid;
                u.DeptID   = TU.Globals.BindSystemCode(Globals.SystemCode.DtJd_bm, "Pkid", "Bmdm", bmbh, "");;
                u.UserID   = gh;
                u.UserName = xm;
                u.Password = BLL.Globals.MD5Encrypt(sjhm.Substring(5, 6));
                u.Mobile   = sjhm;
                u.Level    = "01";
                int r = TUD.SQLHelper.Insert <Model.Account_user>(u);

                if (issj)
                {
                    string sql = string.Format("UPDATE Account_user SET Mobile='{0}' WHERE Pkid=(SELECT Pkid FROM jc_lxr WHERE Lbdm=0 AND Dzbbh='{1}')", u.Pkid, dzbbh);
                    DAL.Globals.Execute(sql);
                }
                return(r);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("CI") >= 0)
                {
                    throw new Exception("工号已存在 !");
                }
                else if (err.Message.IndexOf("Mobile") > 0)
                {
                    throw new Exception("手机号码已存在 !");
                }
                else
                {
                    throw err;
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 修改联系人用户
        /// </summary>
        public static int ModLxr(string pkid, string dzbbh, string gh, string xm, string sjhm, bool issj)
        {
            try
            {
                Model.Account_user u = new Model.Account_user();
                u.Pkid     = pkid;
                u.UserID   = gh;
                u.UserName = xm;
                u.Mobile   = sjhm;
                int r = TUD.SQLHelper.UpdateFields <Model.Account_user>(u, "UserID", "UserName", "Mobile");

                string sql = string.Format("UPDATE Account_user SET Mobile=Pkid WHERE [Level]='02' AND Mobile='{0}';", u.Pkid);
                if (issj)
                {
                    sql += string.Format("UPDATE Account_user SET Mobile='{0}' WHERE Pkid=(SELECT Pkid FROM jc_lxr WHERE Lbdm=0 AND Dzbbh='{1}')", u.Pkid, dzbbh);
                }
                DAL.Globals.Execute(sql);

                return(r);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("CI") >= 0)
                {
                    throw new Exception("工号已存在 !");
                }
                else if (err.Message.IndexOf("Mobile") > 0)
                {
                    throw new Exception("手机号码已存在 !");
                }
                else
                {
                    throw err;
                }
            }
        }
Exemplo n.º 15
0
        protected bool Save()
        {
            bool   pwdOk  = true;
            string errmsg = "";
            string pkid   = TStar.Web.Globals.Account.Pkid;
            string pwdold = this.tbxPwdOld.Text.Trim();
            string pwd    = this.tbxPwd.Text.Trim();
            string pwd2   = this.tbxPwd2.Text.Trim();
            string phone  = this.hfdCode.Text.Substring(6);
            string code   = this.tbxYzm.Text.Trim().ToUpper();

            if (String.IsNullOrEmpty(pwdold))
            {
                errmsg += "请输入原始密码 !<br/>";
            }
            else
            {
                string encpwd = BLL.Globals.MD5Encrypt(pwdold);
                if (encpwd != TStar.Web.Globals.Account.Password)
                {
                    errmsg += "原始密码不正确 !<br/>";
                }
            }
            if (pwd.Length > 0 || pwd2.Length > 0)
            {
                if (String.IsNullOrEmpty(pwd))
                {
                    pwdOk   = false;
                    errmsg += "请设置新的登录密码 !<br/>";
                }
                else if (pwd.Length < 6)
                {
                    errmsg += "密码长度至少 6 位 !<br/>";
                }
                if (String.IsNullOrEmpty(pwd2))
                {
                    pwdOk   = false;
                    errmsg += "请再次确认密码 !<br/>";
                }
                if (pwdOk && pwd != pwd2)
                {
                    errmsg += "两次输入的密码不一致 !<br/>";
                }
            }
            if (String.IsNullOrEmpty(phone))
            {
                errmsg += "请输入手机号码 !<br/>";
            }
            if (String.IsNullOrEmpty(code))
            {
                errmsg += "请输入验证码 !<br/>";
            }
            else if (code != this.hfdCode.Text.Substring(0, 6))
            {
                errmsg += "输入的验证码不正确 !<br/>";
            }
            if (errmsg.Length > 0)
            {
                Alert.Show(errmsg, MessageBoxIcon.Warning);
                return(false);
            }

            try
            {
                Model.Account_user u = BLL.Account.GetEntity(pkid);
                //if (u.Mobile.Substring(0,11) != phone)
                //{
                //    errmsg += "\n手机号码不匹配 !";
                //}
                if (code != u.VerifyCode)
                {
                    errmsg += "\n验证码不正确 !";
                }
                else if (DateTime.Now.Ticks > u.Timestamp)
                {
                    errmsg += "\n验证码已过期 !";
                }
                if (errmsg.Length > 0)
                {
                    Alert.Show(errmsg, MessageBoxIcon.Error);
                    return(false);
                }
                if (pwd.Length > 0)
                {
                    BLL.Account.UpdatePwd(u.Pkid, pwd);
                }
                if (phone != TStar.Web.Globals.Account.UserInfo.Mobile)
                {
                    BLL.Account.UpdateMobile(u.Pkid, phone);
                }
                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, OperTitle + "失败", MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 16
0
        protected bool Save()
        {
            bool   pwdOk  = true;
            string errmsg = "";
            string uid    = this.tbxXh.Text.Trim().ToUpper();
            string pwd    = this.tbxPwd.Text.Trim();
            string pwd2   = this.tbxPwd2.Text.Trim();
            string phone  = this.hfdCode.Text.Substring(6);
            string code   = this.tbxYzm.Text.Trim().ToUpper();

            if (String.IsNullOrEmpty(uid))
            {
                errmsg += "请输入用户名 !<br/>";
            }
            if (String.IsNullOrEmpty(pwd))
            {
                pwdOk   = false;
                errmsg += "请设置新的登录密码 !<br/>";
            }
            else if (pwd.Length < 6)
            {
                errmsg += "密码长度至少 6 位 !<br/>";
            }
            if (String.IsNullOrEmpty(pwd2))
            {
                pwdOk   = false;
                errmsg += "请再次确认密码 !<br/>";
            }
            if (pwdOk && pwd != pwd2)
            {
                errmsg += "两次输入的密码不一致 !<br/>";
            }
            if (String.IsNullOrEmpty(phone))
            {
                errmsg += "请输入手机号码 !<br/>";
            }
            if (String.IsNullOrEmpty(code))
            {
                errmsg += "请输入验证码 !<br/>";
            }
            else if (code != this.hfdCode.Text.Substring(0, 6))
            {
                errmsg += "输入的验证码不正确 !<br/>";
            }
            if (errmsg.Length > 0)
            {
                Alert.Show(errmsg, MessageBoxIcon.Warning);
                return(false);
            }

            try
            {
                Model.Account_user u = BLL.Account.GetEntityByUserId(uid);
                if (string.IsNullOrEmpty(u.Pkid))
                {
                    Alert.Show("此用户不存在,请与学院管理员联系 !", MessageBoxIcon.Error);
                    return(false);
                }
                if (u.Mobile.Substring(0, 11) != phone)
                {
                    errmsg += "\n手机号码不匹配 !";
                }
                if (code != u.VerifyCode)
                {
                    errmsg += "\n验证码不正确 !";
                }
                else if (DateTime.Now.Ticks > u.Timestamp)
                {
                    errmsg += "\n验证码已过期 !";
                }
                if (errmsg.Length > 0)
                {
                    Alert.Show(errmsg, MessageBoxIcon.Error);
                    return(false);
                }

                BLL.Account.UpdatePwd(u.Pkid, pwd);
                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, OperTitle + "失败", MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 17
0
        protected bool Save()
        {
            bool   modPhone = false;
            string errmsg   = "";
            string pkid     = TStar.Web.Globals.Account.Pkid;
            string pwdold   = this.tbxPwdOld.Text.Trim();
            string phone    = string.IsNullOrEmpty(this.hfdCode.Text) ? "" : this.hfdCode.Text.Substring(6);
            string code     = this.tbxYzm.Text.Trim().ToUpper();

            // 修改手机号码
            if (!String.IsNullOrEmpty(phone))
            {
                modPhone = true;
                if (String.IsNullOrEmpty(pwdold))
                {
                    errmsg += "请输入原始密码 !<br/>";
                }
                else
                {
                    string encpwd = BLL.Globals.MD5Encrypt(pwdold);
                    if (encpwd != TStar.Web.Globals.Account.Password)
                    {
                        errmsg += "原始密码不正确 !<br/>";
                    }
                }
                if (String.IsNullOrEmpty(code))
                {
                    errmsg += "请输入验证码 !<br/>";
                }
                else if (code != this.hfdCode.Text.Substring(0, 6))
                {
                    errmsg += "输入的验证码不正确 !<br/>";
                }
            }
            if (errmsg.Length > 0)
            {
                Alert.Show(errmsg, MessageBoxIcon.Warning);
                return(false);
            }

            try
            {
                Model.Account_user u = BLL.Account.GetEntity(pkid);
                if (modPhone)
                {
                    if (code != u.VerifyCode)
                    {
                        errmsg += "\n验证码不正确 !";
                    }
                    else if (DateTime.Now.Ticks > u.Timestamp)
                    {
                        errmsg += "\n验证码已过期 !";
                    }
                    if (errmsg.Length > 0)
                    {
                        Alert.Show(errmsg, MessageBoxIcon.Error);
                        return(false);
                    }

                    BLL.Account.UpdateMobile(u.Pkid, phone);
                }
                if (this.hfdImg.Text != this.imgPhoto.ImageUrl)
                {
                    string photourl = ChangeFile(this.imgPhoto.ImageUrl);
                    BLL.Account.UpdatePhoto(u.Pkid, photourl);
                }
                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, OperTitle + "失败", MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 18
0
        ///// <summary>
        ///// 删除党支部用户
        ///// </summary>
        //public static int DelDzb(string pkid)
        //{
        //    try
        //    {
        //        int r = TUD.SQLHelper.Delete<Model.Account_user>(pkid);

        //        string sql = string.Format("UPDATE Account_user SET Mobile=Pkid WHERE [Level]='02' AND Mobile='{0}'", pkid);
        //        DAL.Globals.Execute(sql);

        //        return r;
        //    }
        //    catch (Exception err)
        //    {
        //        throw err;
        //    }
        //}

        /// <summary>
        /// 新增记录
        /// </summary>
        private static int Insert(Model.Account_user u)
        {
            return(TUD.SQLHelper.Insert <Model.Account_user>(u));
        }
Exemplo n.º 19
0
 /// <summary>
 /// 根据给定的Pkid修改一条记录
 /// </summary>
 public static int Update(Model.Account_user u)
 {
     return(TUD.SQLHelper.Update <Model.Account_user>(u));
 }
Exemplo n.º 20
0
 /// <summary>
 /// 根据给定的Pkid获取实体
 /// </summary>
 public static Model.Account_user GetEntity(string pkid)
 {
     Model.Account_user u = TUD.SQLHelper.GetEntity <Model.Account_user>(pkid);
     GetExtendInfo(u);
     return(u);
 }
Exemplo n.º 21
0
 public static Model.Account_user GetEntityByUserId(string uid)
 {
     Model.Account_user u = TUD.SQLHelper.GetEntity <Model.Account_user>("UserID", uid);
     GetExtendInfo(u);
     return(u);
 }