Exemplo n.º 1
0
        public bool SaveUserInfo(UserInfo info)
        {
            Hashtable ht = new Hashtable();

            if (info.id > 0)
            {
                ht["id"] = info.id;
            }

            if (!string.IsNullOrEmpty(info.Password))
            {
                ht["Password"] = StringHelper.Sha256(info.Password);
            }

            ht["UserName"]         = info.UserName;
            ht["CompanyId"]        = info.CompanyId;
            ht["CompanyName"]      = info.CompanyName;
            ht["CompanyShortName"] = info.CompanyShortName;
            ht["LoginName"]        = info.LoginName;
            ht["PermissonLevel"]   = info.PermissonLevel;
            //   ht["LastLoginIp"] = info.LastLoginIp;
            ht["IsActive"]         = info.IsActive;
            ht["CompanyShortName"] = info.CompanyShortName;
            if (info.id > 0)
            {
                ht["ModifyUserId"] = info.ModifyUserId;
                ht["Modifytime"]   = comm.GetDBDate();
                return(comm.UpdateTable(ht, "users") > 0 ? true : false);
            }
            else
            {
                ht["AddUserId"] = info.AddUserId;
                return(comm.InsertTable(ht, "users") > 0 ? true : false);
            }
        }