Exemplo n.º 1
0
 public static Mall_CheckRequestRuleDetail[] GetMall_CheckRequestRuleDetailListShiLi(Mall_CheckRequestRuleDetail[] list)
 {
     if (list.Length > 0)
     {
         var category_list  = Mall_CheckCategory.GetMall_CheckCategories();
         var checkinfo_list = Mall_CheckInfo.GetMall_CheckInfos();
         foreach (var item in list)
         {
             item.CategoryType = item.EarnType;
             var my_checkinfo = checkinfo_list.FirstOrDefault(p => p.ID == item.RuleID);
             if (my_checkinfo != null)
             {
                 item.CheckName  = my_checkinfo.CheckName;
                 item.StartPoint = my_checkinfo.StartPoint;
                 item.EndPoint   = my_checkinfo.EndPoint;
                 var my_category = category_list.FirstOrDefault(p => p.ID == my_checkinfo.CheckCategoryID);
                 if (my_category != null)
                 {
                     item.CategoryName = my_category.CategoryName;
                 }
             }
             else
             {
                 item.CheckName    = "固定积分";
                 item.CategoryName = item.Title;
                 item.StartPoint   = 0;
                 item.EndPoint     = 0;
             }
         }
     }
     return(list);
 }
Exemplo n.º 2
0
 public static Mall_CheckRequestDetail[] GetMall_CheckRequestDetailShiLi(Mall_CheckRequestDetail[] list, List <string> conditions, List <SqlParameter> parameters)
 {
     if (list.Length > 0)
     {
         var check_rule_list = Mall_CheckRequestRule.GetMall_CheckRequestRules().ToArray();
         var rule_list       = GetList <Mall_CheckInfoDetail>("select * from [Mall_CheckInfo] where [ID] in (select [RuleID] from [Mall_CheckRequestRule] where [RequestID] in (select ID from [Mall_CheckRequest] where " + string.Join(" and ", conditions.ToArray()) + "))", parameters).ToArray();
         var check_user_list = Mall_CheckRequestUser.GetMall_CheckRequestUsers().ToArray();
         var user_list       = GetList <User>("select * from [User] where [UserID] in (select [UserID] from [Mall_CheckRequestUser] where [RequestID] in (select ID from [Mall_CheckRequest] where " + string.Join(" and ", conditions.ToArray()) + "))", parameters).ToArray();
         var category_list   = Mall_CheckCategory.GetMall_CheckCategories();
         foreach (var item in list)
         {
             var my_check_user_list = check_user_list.Where(p => p.RequestID == item.ID).ToArray();
             if (my_check_user_list.Length > 0)
             {
                 List <int> UserIDList   = my_check_user_list.Select(p => p.UserID).ToList();
                 var        my_user_list = user_list.Where(p => UserIDList.Contains(p.UserID)).ToArray();
                 item.CheckUserInfo     = string.Join(",", my_user_list.Select(p => p.FinalRealName));
                 item.CheckUserPosition = string.Join(",", my_user_list.Where(p => !string.IsNullOrEmpty(p.PositionName)).Select(p => p.PositionName));
             }
             var my_check_rule_list = check_rule_list.Where(p => p.RequestID == item.ID).ToArray();
             if (my_check_rule_list.Length > 0)
             {
                 List <int> RuleIDList       = my_check_rule_list.Select(p => p.RuleID).ToList();
                 var        my_rule_list     = rule_list.Where(p => RuleIDList.Contains(p.ID)).ToArray();
                 List <int> CategoryIDList   = my_rule_list.Select(p => p.CheckCategoryID).ToList();
                 var        my_category_list = category_list.Where(p => CategoryIDList.Contains(p.ID)).ToList();
                 if (item.RequestType <= 1)
                 {
                     if (my_category_list.Count > 0)
                     {
                         item.CheckCategoryName = string.Join(",", my_category_list.Select(p => p.CategoryName));
                     }
                     if (my_rule_list.Length > 0)
                     {
                         item.CheckRule = string.Join(",", my_rule_list.Select(p => p.CheckName));
                     }
                 }
                 else
                 {
                     item.CheckCategoryName = my_check_rule_list[0].Title;
                     item.CheckRule         = item.RequestTypeDesc;
                 }
                 item.UserEarnPoint   = my_check_rule_list.Where(p => p.EarnType == 1).Sum(p => p.PointValue);
                 item.UserReducePoint = my_check_rule_list.Where(p => p.EarnType == 2).Sum(p => p.PointValue);
             }
         }
     }
     return(list);
 }
Exemplo n.º 3
0
        public static Ui.DataGrid GetMall_CheckInfoDetailGridByKeywords(string Keywords, List <int> CategoryIDList, string orderBy, long startRowIndex, int pageSize, int CategoryType)
        {
            long totalRows = 0;
            List <SqlParameter> parameters = new List <SqlParameter>();
            List <string>       conditions = new List <string>();

            conditions.Add("1=1");
            if (CategoryType > 0)
            {
                conditions.Add("[CheckCategoryID] in (select [ID] from [Mall_CheckCategory] where [CategoryType]=@CategoryType)");
                parameters.Add(new SqlParameter("@CategoryType", CategoryType));
            }
            if (!string.IsNullOrEmpty(Keywords))
            {
                conditions.Add("([CheckName] like @Keywords)");
                parameters.Add(new SqlParameter("@Keywords", "%" + Keywords + "%"));
            }
            if (CategoryIDList.Count > 0)
            {
                conditions.Add("[CheckCategoryID] in (" + string.Join(",", CategoryIDList.ToArray()) + ")");
            }
            string fieldList = "[Mall_CheckInfo].* ";
            string Statement = " from [Mall_CheckInfo] where  " + string.Join(" and ", conditions.ToArray());

            Mall_CheckInfoDetail[] list = GetList <Mall_CheckInfoDetail>(fieldList, Statement, parameters, orderBy, startRowIndex, pageSize, out totalRows).ToArray();
            if (list.Length > 0)
            {
                var category_list = Mall_CheckCategory.GetMall_CheckCategories();
                foreach (var item in list)
                {
                    var my_category = category_list.FirstOrDefault(p => p.ID == item.CheckCategoryID);
                    if (my_category != null)
                    {
                        item.CategoryName     = my_category.CategoryName;
                        item.CategoryTypeDesc = my_category.CategoryTypeDesc;
                        item.CategoryType     = my_category.CategoryType;
                    }
                }
            }
            DataAccess.Ui.DataGrid dg = new Ui.DataGrid();
            dg.rows  = list;
            dg.total = totalRows;
            dg.page  = pageSize;
            return(dg);
        }
 private void SetInfo(Foresight.DataAccess.Mall_CheckCategory data)
 {
     this.tdCategoryName.Value = data.CategoryName;
     this.tdCategoryType.Value = data.CategoryType > 0 ? data.CategoryType.ToString() : "";
 }