예제 #1
0
        /// <summary>
        /// 部分修改保存
        /// </summary>
        /// <param name="model">对象clsUserInfo的一个实例参数</param>
        /// <returns></returns>
        public int UpdatePart(clsUserInfo model, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                string updateSql = "update tUserInfo set "
                                   + "LoginID='" + model.LoginID + "',"
                                   + "[Name]='" + model.Name + "',"
                                   + "[PassWord]='" + model.PassWord + "',"
                                   + "UnitCode='" + model.UnitCode + "',"
                                   //+ "WebLoginID='" + model.WebLoginID + "',"
                                   //+ "WebPassWord='******',"
                                   + "IsAdmin=" + model.IsAdmin + ","
                                   + "IsLock=" + model.IsLock + ","
                                   + "Remark='" + model.Remark + "'"
                                   + " where UserCode='" + model.UserCode + "' ";
                DataBase.ExecuteCommand(updateSql, out errMsg);

                rtn = 1;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }

            return(rtn);
        }
예제 #2
0
        /// <summary>
        /// 插入一条明细记录
        /// </summary>
        /// <param name="userModel"></param>
        /// <returns></returns>
        public int Insert(clsUserInfo userModel, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                //WebLoginID,WebPassWord,
                //+ userModel.WebLoginID + "','"
                //+ userModel.WebPassWord + "',"
                string insertSql = "INSERT INTO tUserInfo(UserCode,[LoginID],[Name],[PassWord],UnitCode,IsAdmin,IsLock,[Remark])"
                                   + " VALUES('"
                                   + userModel.UserCode + "','"
                                   + userModel.LoginID + "','"
                                   + userModel.Name + "','"
                                   + userModel.PassWord + "','"
                                   + userModel.UnitCode + "',"
                                   + userModel.IsAdmin + ","
                                   + userModel.IsLock + ",'"
                                   + userModel.Remark + "')";
                DataBase.ExecuteCommand(insertSql, out errMsg);

                rtn = 1;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }

            return(rtn);
        }
예제 #3
0
        /// <summary>
        /// 获取用户实例
        /// </summary>
        /// <param name="whereSql"></param>
        /// <returns></returns>
        public clsUserInfo GetInfo(string whereSql)
        {
            string      errMsg   = string.Empty;
            DataTable   dt       = null;
            clsUserInfo userInfo = null;

            try
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("SELECT UserCode,LoginID,Name,PassWord,UnitCode,WebLoginID,WebPassWord,IsLock,IsAdmin,Remark FROM tUserInfo");

                if (!whereSql.Equals(string.Empty))
                {
                    sb.Append(" WHERE ");
                    sb.Append(whereSql);
                }

                string[] cmd = new string[1] {
                    sb.ToString()
                };
                string[] names = new string[1] {
                    "UserInfo"
                };
                dt = DataBase.GetDataSet(cmd, names, out errMsg).Tables["UserInfo"];
                if (dt.Rows.Count > 0)
                {
                    userInfo             = new clsUserInfo();
                    userInfo.UserCode    = dt.Rows[0]["UserCode"].ToString();
                    userInfo.LoginID     = dt.Rows[0]["LoginID"].ToString();
                    userInfo.Name        = dt.Rows[0]["Name"].ToString();
                    userInfo.PassWord    = dt.Rows[0]["PassWord"].ToString();
                    userInfo.UnitCode    = dt.Rows[0]["UnitCode"].ToString();
                    userInfo.WebLoginID  = dt.Rows[0]["WebLoginID"].ToString();
                    userInfo.WebPassWord = dt.Rows[0]["WebPassWord"].ToString();
                    userInfo.Remark      = dt.Rows[0]["Remark"].ToString();
                    userInfo.IsLock      = Convert.ToBoolean(dt.Rows[0]["IsLock"]);
                    userInfo.IsAdmin     = Convert.ToBoolean(dt.Rows[0]["IsAdmin"]);
                }
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }

            return(userInfo);
        }
예제 #4
0
 private CurrentUser()
 {
     _UserInfo = new clsUserInfo();
 }