Ejemplo n.º 1
0
        public static int senduserjixiaopoint(List <int> IDList)
        {
            var request_list = Mall_CheckRequest.GetAllActiveMall_CheckRequestList().Where(p => IDList.Contains(p.ID)).ToArray();

            if (request_list.Length == 0)
            {
                return(0);
            }
            var rule_list = Mall_CheckRequestRuleDetail.GetMall_CheckRequestRuleDetailListByRequestIDList(IDList);
            var user_list = Mall_CheckRequestUser.GetMall_CheckRequestUserListByRequestIDList(IDList);
            int count     = 0;

            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    foreach (var check_request in request_list)
                    {
                        var my_user_list = user_list.Where(p => p.RequestID == check_request.ID).ToArray();
                        var my_rule_list = rule_list.Where(p => p.RequestID == check_request.ID).ToArray();
                        if (my_user_list.Length == 0 || my_rule_list.Length == 0)
                        {
                            continue;
                        }
                        foreach (var check_user in my_user_list)
                        {
                            foreach (var check_rule in my_rule_list)
                            {
                                string Title        = check_rule.EarnType == 1 ? "业绩考核奖励" : check_rule.Title;
                                int    PointType    = check_rule.EarnType;
                                int    CategoryType = check_rule.EarnType;
                                int    BackPoint    = check_rule.EarnType == 1 ? check_rule.PointValue : -check_rule.PointValue;
                                Mall_UserJiXiaoPoint.Insert_Mall_UserJiXiaoPoint(check_user.UserID, PointType, 0, Title, "Mall_CheckRequestID:" + check_request.ID, CategoryType, "System", 1, helper, FixedPointMonth: check_rule.FixedPointMonth, FixedPointDateTime: check_rule.FixedPointDateTime, PointValue: BackPoint, RelatedID: check_request.ID, RuleID: check_rule.ID, InfoID: check_rule.RuleID, InfoName: check_rule.CheckName, CategoryName: check_rule.CategoryName, EarnType: check_rule.EarnType, ApproveUserName: check_request.ApproveMan, ApproveTime: check_request.ApproveTime, ApproveRemark: check_request.ApproveRemark, Remark: check_request.Remark);
                                count++;
                            }
                        }
                        check_request.IsJieXiaoPointSent   = true;
                        check_request.JieXiaoPointSentTime = DateTime.Now;
                        check_request.Save(helper);
                    }
                    helper.Commit();
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    Utility.LogHelper.WriteError("Mall_CheckRequest.cs", "senduserjixiaopoint", ex);
                    return(0);
                }
            }
            return(count);
        }
Ejemplo n.º 2
0
        public static Mall_CheckRequestRuleDetail[] GetMall_CheckRequestRuleDetailListByRequestID(int RequestID)
        {
            if (RequestID <= 0)
            {
                return(new Mall_CheckRequestRuleDetail[] { });
            }
            var data = Mall_CheckRequest.GetMall_CheckRequest(RequestID);

            if (data == null)
            {
                return(new Mall_CheckRequestRuleDetail[] { });
            }
            List <SqlParameter> parameters = new List <SqlParameter>();
            List <string>       conditions = new List <string>();

            conditions.Add("[RequestID]=@RequestID");
            parameters.Add(new SqlParameter("@RequestID", RequestID));
            string cmdtext = "select * from [Mall_CheckRequestRule] where  " + string.Join(" and ", conditions.ToArray());

            Mall_CheckRequestRuleDetail[] list = GetList <Mall_CheckRequestRuleDetail>(cmdtext, parameters).ToArray();
            list = GetMall_CheckRequestRuleDetailListShiLi(list);
            return(list);
        }