Exemplo n.º 1
0
Arquivo: User.cs Projeto: TjcJose/Hi
        public bool Add(BasUser model)
        {
            if (model == null)
            {
                return false;
            }
            StringBuilder strb = new StringBuilder();
            strb.Append(" Insert Into bas_user ");
            strb.Append(" ( ");
            //strb.Append("userid, ");//主键是自动增长列,请屏蔽赋值
            strb.Append("orgid, ");
            strb.Append("orgname,");
            strb.Append("usercode, ");
            strb.Append("userpassword, ");
            strb.Append("realname, ");

            strb.Append("sex, ");
            strb.Append("usertelephone, ");
            strb.Append("email, ");
            strb.Append("qq, ");
            strb.Append("regtime, ");
            strb.Append("address, ");
            strb.Append("islocked, ");
            // strb.Append("lastloginip, ");
            // strb.Append("logintimes, ");
            // strb.Append("lastlogintime, ");
            strb.Append("remark ");
            strb.Append(" )");
            strb.Append(" Values( ");
            //strb.Append("'" + model.Userid + "', ");
            strb.Append("" + Hi.Common.Utils.IsNull(model.OrgId, "0") + ", ");
            strb.Append("'" + model.OrgName + "', ");
            strb.Append("'" + model.UserCode + "', ");
            strb.Append("'" + model.UserPassword + "', ");
            strb.Append("'" + model.RealName + "', ");

            strb.Append("'" + model.Sex + "', ");
            strb.Append("'" + model.UserTelephone + "', ");
            strb.Append("'" + model.Email + "', ");
            strb.Append("'" + model.Qq + "', ");
            strb.Append("'" + model.Regtime + "', ");
            strb.Append("'" + model.Address + "', ");
            strb.Append("" + model.IsLocked + ", ");
            //strb.Append("'" + model.Lastloginip + "', ");
            // strb.Append("" + model.Logintimes + ", ");
            // strb.Append("'" + model.Lastlogintime + "', ");
            strb.Append("'" + model.Remark + "' ");
            strb.Append(" )");
            try
            {
                return DataBase.ExecuteNonQuery(strb.ToString()) > 0 ? true : false;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 2
0
Arquivo: User.cs Projeto: TjcJose/Hi
        public BasUser Detail(string id)
        {
            DataRow dr = null;
            if (Hi.Common.Utils.StrToInt(id) > 0)
                dr = DetailFromId(id);
            else
                dr = DetailFromCode(id);
            if (dr == null)
                return null;
            BasUser model = new BasUser();

            model.UserId = dr["userid"].ToString().Trim();
            model.OrgId = dr["orgid"].ToString().Trim();
            model.OrgName = dr["orgname"].ToString().Trim();
            model.UserCode = dr["usercode"].ToString().Trim();
            model.UserPassword = dr["userpassword"].ToString().Trim();
            model.RealName = dr["realname"].ToString().Trim();
            model.RoleId = dr["roleid"].ToString().Trim();
            model.Sex = dr["sex"].ToString().Trim();
            model.UserTelephone = dr["usertelephone"].ToString().Trim();
            model.Email = dr["email"].ToString().Trim();
            model.Qq = dr["qq"].ToString().Trim();
            model.Regtime = dr["regtime"].ToString().Trim();
            model.Address = dr["address"].ToString().Trim();
            model.IsLocked = dr["islocked"].ToString().Trim();
            model.LastLoginIp = dr["lastloginip"].ToString().Trim();
            model.LoginTimes = dr["logintimes"].ToString().Trim();
            model.LastLoginTime = dr["lastlogintime"].ToString().Trim();
            model.Remark = dr["remark"].ToString().Trim();
            model.Purview = dr["purview"].ToString().Trim();
            model.PurviewDetail = dr["purview_detail"].ToString().Trim();

            return model;
        }
Exemplo n.º 3
0
Arquivo: User.cs Projeto: TjcJose/Hi
        public bool UpdateLogin(BasUser model)
        {
            try
            {
                StringBuilder strb = new StringBuilder();
                strb.Append(" Update bas_user ");
                strb.Append(" Set ");
                strb.Append("lastloginip    = '" + model.LastLoginIp + "',");
                strb.Append("logintimes     = " + model.LoginTimes + ",");
                strb.Append("lastlogintime  = '" + model.LastLoginTime + "'");

                strb.Append(" where userid = " + model.UserId.ToString());
                DataBase.ExecuteNonQuery(strb.ToString());
            }
            catch
            {
                return false;
            }
            return true;
        }
Exemplo n.º 4
0
Arquivo: User.cs Projeto: TjcJose/Hi
        //屏蔽注册、登录时间 Edited By Liangsx 2011-01-24
        public bool Update(BasUser model)
        {
            bool blFlag;
            try
            {
                StringBuilder strb = new StringBuilder();
                strb.Append(" Update bas_user ");
                strb.Append(" Set ");
                strb.Append("orgid   = " + Hi.Common.Utils.IsNull(model.OrgId, "0") + ",");
                strb.Append("orgname = '" + model.OrgName + "',");
                strb.Append("usercode       = '" + model.UserCode + "',");
                //strb.Append("userpassword   = '******',");
                strb.Append("realname       = '" + model.RealName + "',");

                strb.Append("sex            = '" + model.Sex + "',");
                strb.Append("usertelephone  = '" + model.UserTelephone + "',");
                strb.Append("email          = '" + model.Email + "',");
                strb.Append("qq             = '" + model.Qq + "',");
                //strb.Append("regtime        = '" + model.Regtime + "',");
                strb.Append("address        = '" + model.Address + "',");
                strb.Append("IsLocked       = " + model.IsLocked + ",");
                //strb.Append("lastloginip    = '" + model.Lastloginip + "',");
                //strb.Append("logintimes     = " + model.Logintimes + ",");
                //strb.Append("lastlogintime  = '" + model.Lastlogintime + "',");
                strb.Append("remark         = '" + model.Remark + "'");
                strb.Append(" where userid = " + model.UserId.ToString());
                blFlag = DataBase.ExecuteNonQuery(strb.ToString()) > 0 ? true : false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return blFlag;
        }
Exemplo n.º 5
0
        private void Save(bool isHide)
        {
            User bll = new User();
            BasUser model = new BasUser();

            int count = 0;

            string msg = "";

            if (Exists(model))
                return;

            if (count > 0)
            {

                ShowNotification("" + msg + "����ɹ���");
                this.GridPanel1.Reload();
                if (isHide)
                    this.winDetail.Hide();
            }
            else
            {
                ShowNotification(msg);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Ψһ����֤
        /// </summary>
        /// <returns>true</returns>
        private bool Exists(BasUser model)
        {
            User bll = new User();
            bool blFlag = false;
            string strWhere = "";
            strWhere = " UserCode='" + model.UserCode + "'";
            if (!string.IsNullOrEmpty(model.UserId.ToString()))
                strWhere += " and userid<>" + model.UserId;

            blFlag = bll.Exists(strWhere);
            if (blFlag)
                ShowNotification("����ʧ�ܣ���" + model.UserCode + "���Ѵ���");

            return blFlag;
        }
Exemplo n.º 7
0
Arquivo: User.cs Projeto: TjcJose/Hi
 /// <summary>
 /// ����һ������
 /// </summary>
 public bool Add(BasUser model)
 {
     return dal.Add(model);
 }
Exemplo n.º 8
0
Arquivo: User.cs Projeto: TjcJose/Hi
 /// <summary>
 /// ����һ������
 /// </summary>
 public bool Update(BasUser model)
 {
     return dal.Update(model);
 }