コード例 #1
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
        public static DataSet GetPagerData(int intPageSize, int intCurrentPageIndex)
        {
            int num  = 0;
            int num2 = 0;

            return(UserField.GetPagerData(intPageSize, intCurrentPageIndex, ref num, ref num2));
        }
コード例 #2
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
        public static IList <UserFieldInfo> GetCustomFieldListByModelID(int intGroupID)
        {
            IList <UserFieldInfo> list = BizBase.dbo.GetList <UserFieldInfo>(" SELECT * FROM cms_UserField WHERE UserGroupID=" + intGroupID + " AND IsSystem=0 ");

            list.Add(UserField.GetExistsFieldInfo());
            return(list);
        }
コード例 #3
0
        public static IList <UserFieldInfo> GetFieldListWithValue(int intUserID, int intGroupID)
        {
            IList <UserFieldInfo> fieldListByModelID = UserField.GetFieldListByModelID(intGroupID, true);
            IList <UserFieldInfo> usingFieldList     = UserField.GetUsingFieldList(intGroupID);
            UserGroupInfo         cacheUserGroupById = UserGroup.GetCacheUserGroupById(intGroupID);

            if (cacheUserGroupById != null)
            {
                DataTable dataTable = BizBase.dbo.GetDataTable(string.Concat(new object[]
                {
                    "SELECT * FROM cms_User AS A,",
                    cacheUserGroupById.TableName,
                    " AS B WHERE A.AutoID=",
                    intUserID,
                    " AND B.UserID=",
                    intUserID
                }));
                if (dataTable.Rows.Count == 1)
                {
                    foreach (UserFieldInfo current in fieldListByModelID)
                    {
                        if (dataTable.Columns.Contains(current.FieldName))
                        {
                            current.Value = dataTable.Rows[0][current.FieldName].ToString();
                        }
                        else
                        {
                            current.Value = current.DefaultValue;
                        }
                    }
                }
            }
            return(fieldListByModelID);
        }
コード例 #4
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
        public static bool Delete(int fieldID)
        {
            UserFieldInfo dataById  = UserField.GetDataById(fieldID);
            UserGroupInfo dataById2 = UserGroup.GetDataById(dataById.UserGroupID);

            if (BizBase.dbo.DeleteModel <UserFieldInfo>(dataById))
            {
                TableManager.DropTableColumn(dataById2.TableName, dataById.FieldName);
            }
            CacheUtils.Del("JsonLeeCMS_CacheForGetUserGroup");
            return(true);
        }
コード例 #5
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
        public static bool Update(UserFieldInfo field)
        {
            UserGroupInfo dataById  = UserGroup.GetDataById(field.UserGroupID);
            UserFieldInfo dataById2 = UserField.GetDataById(field.AutoID);
            bool          result;

            if (BizBase.dbo.UpdateModel <UserFieldInfo>(field))
            {
                if (!dataById2.IsSystem)
                {
                    try
                    {
                        string text = field.DataType;
                        if (string.Compare(text, "nvarchar", true) == 0)
                        {
                            object obj = text;
                            text = string.Concat(new object[]
                            {
                                obj,
                                "(",
                                field.DataLength,
                                ")"
                            });
                        }
                        TableManager.AlterTableColumn(dataById.TableName, dataById2.FieldName, field.FieldName, text, true, field.DefaultValue);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                CacheUtils.Del("JsonLeeCMS_CacheForGetUserGroup");
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
コード例 #6
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
        public static bool DeleteByModelID(int modelID)
        {
            bool result;

            if (modelID <= 0)
            {
                result = false;
            }
            else
            {
                IList <UserFieldInfo> fieldListByModelID = UserField.GetFieldListByModelID(modelID);
                bool flag = BizBase.dbo.ExecSQL(" DELETE FROM cms_UserField WHERE UserGroupID=" + modelID);
                if (flag)
                {
                    CacheUtils.Del("JsonLeeCMS_CacheForGetUserGroup");
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
コード例 #7
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
        public static IList <UserFieldInfo> GetList(int intTopCount, string strCondition)
        {
            string strSort = " Sort asc,AutoID desc ";

            return(UserField.GetList(intTopCount, strCondition, strSort));
        }
コード例 #8
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static IList <UserFieldInfo> GetTopNList(int intTopCount, string strSort)
 {
     return(UserField.GetList(intTopCount, string.Empty, strSort));
 }
コード例 #9
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static IList <UserFieldInfo> GetAllList()
 {
     return(UserField.GetList(0, string.Empty));
 }
コード例 #10
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static UserFieldInfo GetTopData()
 {
     return(UserField.GetTopData(" Sort ASC,AutoID desc "));
 }
コード例 #11
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static IList <UserFieldInfo> GetUsingFieldList(int modelID)
 {
     return(UserField.GetFieldListByModelID(modelID, true));
 }
コード例 #12
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static IList <UserFieldInfo> GetPagerList(int intCurrentPageIndex, int intPageSize, ref int intTotalCount, ref int intTotalPage)
 {
     return(UserField.GetPagerList("", "Sort ASC,AutoID DESC", intCurrentPageIndex, intPageSize, ref intTotalCount, ref intTotalPage));
 }
コード例 #13
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static DataSet GetPagerData(string strFilter, string strCondition, int intPageSize, int intCurrentPageIndex, ref int intTotalCount, ref int intTotalPage)
 {
     return(UserField.GetPagerData(strFilter, strCondition, " Sort asc,AutoID desc ", intPageSize, intCurrentPageIndex, ref intTotalCount, ref intTotalPage));
 }
コード例 #14
0
ファイル: UserField.cs プロジェクト: ngochoanhbr/dahuco
 public static DataSet GetPagerData(string strCondition, int intPageSize, int intCurrentPageIndex, ref int intTotalCount, ref int intTotalPage)
 {
     return(UserField.GetPagerData("*", strCondition, intPageSize, intCurrentPageIndex, ref intTotalCount, ref intTotalPage));
 }
コード例 #15
0
        public static UserStatus Update(UserInfo userMain, Dictionary <string, UserFieldInfo> dicField)
        {
            userMain.RealName    = User.GetStringFromDic("RealName", dicField);
            userMain.Gender      = User.GetStringFromDic("Gender", dicField);
            userMain.Birthday    = User.GetDateTimeFromDic("Birthday", dicField, new DateTime(1900, 1, 1));
            userMain.NickName    = User.GetStringFromDic("NickName", dicField);
            userMain.HeaderPhoto = User.GetStringFromDic("HeaderPhoto", dicField);
            userMain.CreditLine  = User.GetDecimalFromDic("CreditLine", dicField, 0.0m);
            userMain.Area        = User.GetStringFromDic("Area", dicField);
            userMain.Country     = User.GetStringFromDic("Country", dicField);
            userMain.Province    = User.GetStringFromDic("Province", dicField);
            userMain.City        = User.GetStringFromDic("City", dicField);
            userMain.County      = User.GetStringFromDic("County", dicField);
            string[] array = userMain.Area.Split(new char[]
            {
                ','
            });
            if (array.Length > 0)
            {
                userMain.Province = array[0];
            }
            if (array.Length > 1)
            {
                userMain.City = array[1];
            }
            if (array.Length > 2)
            {
                userMain.County = array[2];
            }
            userMain.Address   = User.GetStringFromDic("Address", dicField);
            userMain.PostCode  = User.GetStringFromDic("PostCode", dicField);
            userMain.TelePhone = User.GetStringFromDic("TelePhone", dicField);
            userMain.Remark    = User.GetStringFromDic("Remark", dicField);
            UserStatus result;

            if (User.IsExistsByName(userMain.UserName, userMain.AutoID))
            {
                result = UserStatus.ExistsUserName;
            }
            else if (User.IsExistsByEmail(userMain.Email, userMain.AutoID))
            {
                result = UserStatus.ExistsEmail;
            }
            else if (User.IsExistsByMobile(userMain.Mobile, userMain.AutoID))
            {
                result = UserStatus.ExistsMobile;
            }
            else if (User.Update(userMain))
            {
                UserGroupInfo         cacheUserGroupById       = UserGroup.GetCacheUserGroupById(userMain.GroupID);
                IList <UserFieldInfo> customFieldListByModelID = UserField.GetCustomFieldListByModelID(userMain.GroupID);
                foreach (UserFieldInfo current in customFieldListByModelID)
                {
                    if (current.FieldName == "UserID")
                    {
                        current.Value = userMain.AutoID.ToString();
                    }
                    else
                    {
                        current.Value = User.GetStringFromDic(current.FieldName, dicField);
                    }
                }
                User.UpdateCustomUser(userMain.AutoID, cacheUserGroupById.TableName, customFieldListByModelID);
                result = UserStatus.Success;
            }
            else
            {
                result = UserStatus.Error;
            }
            return(result);
        }
コード例 #16
0
        public static UserStatus Reg(UserInfo userMain, Dictionary <string, UserFieldInfo> dicField, ref int intUserID)
        {
            userMain.RealName    = User.GetStringFromDic("RealName", dicField);
            userMain.Gender      = User.GetStringFromDic("Gender", dicField);
            userMain.Birthday    = User.GetDateTimeFromDic("Birthday", dicField, new DateTime(1900, 1, 1));
            userMain.NickName    = User.GetStringFromDic("NickName", dicField);
            userMain.HeaderPhoto = User.GetStringFromDic("HeaderPhoto", dicField);
            userMain.CreditLine  = User.GetDecimalFromDic("CreditLine", dicField, 0.0m);
            userMain.Area        = User.GetStringFromDic("Area", dicField);
            userMain.Country     = User.GetStringFromDic("Country", dicField);
            userMain.Province    = User.GetStringFromDic("Province", dicField);
            userMain.City        = User.GetStringFromDic("City", dicField);
            userMain.County      = User.GetStringFromDic("County", dicField);
            userMain.Address     = User.GetStringFromDic("Address", dicField);
            userMain.PostCode    = User.GetStringFromDic("PostCode", dicField);
            userMain.TelePhone   = User.GetStringFromDic("TelePhone", dicField);
            userMain.Remark      = User.GetStringFromDic("Remark", dicField);
            string[] array = userMain.Area.Split(new char[]
            {
                ','
            });
            if (array.Length > 0)
            {
                userMain.Province = array[0];
            }
            if (array.Length > 1)
            {
                userMain.City = array[1];
            }
            if (array.Length > 2)
            {
                userMain.County = array[2];
            }
            userMain.Sort          = User.MaxSort + 1;
            userMain.AutoTimeStamp = DateTime.Now;
            userMain.LastLoginTime = DateTime.Now;
            if (userMain.FileSpace.Equals(0))
            {
                userMain.FileSpace = ConfigUtils.GetAppSetting <int>("FileCapacity");
            }
            UserStatus result;

            if (User.IsExistsByName(userMain.UserName))
            {
                result = UserStatus.ExistsUserName;
            }
            else if (User.IsExistsByEmail(userMain.Email))
            {
                result = UserStatus.ExistsEmail;
            }
            else if (User.IsExistsByMobile(userMain.Mobile))
            {
                result = UserStatus.ExistsMobile;
            }
            else
            {
                int num = User.Add(userMain);
                intUserID = num;
                if (num > 0)
                {
                    UserGroupInfo         cacheUserGroupById       = UserGroup.GetCacheUserGroupById(userMain.GroupID);
                    IList <UserFieldInfo> customFieldListByModelID = UserField.GetCustomFieldListByModelID(userMain.GroupID);
                    foreach (UserFieldInfo current in customFieldListByModelID)
                    {
                        if (current.FieldName == "UserID")
                        {
                            current.Value = num.ToString();
                        }
                        else
                        {
                            current.Value = User.GetStringFromDic(current.FieldName, dicField);
                        }
                    }
                    User.AddCustomContent(cacheUserGroupById, customFieldListByModelID);
                    result = UserStatus.Success;
                }
                else
                {
                    result = UserStatus.Error;
                }
            }
            return(result);
        }