Example #1
0
        public static Mall_AmountRule[] GetMall_AmountRuleByAmount(decimal Amount, int AmountType = 1, int UserID = 0)
        {
            if (UserID <= 0)
            {
                return(new Mall_AmountRule[] { });
            }
            List <string>       conditions    = new List <string>();
            List <SqlParameter> parameters    = new List <SqlParameter>();
            List <int>          ProjectIDList = Project.GetParentProjectIDListByAPPUserID(UserID);

            if (ProjectIDList.Count > 0)
            {
                conditions.Add("([IsUseForALLProject]=1 or [ID] in (select [Mall_AmountRuleID] from [Mall_AmountRuleProject] where [ProjectID] in (" + string.Join(",", ProjectIDList.ToArray()) + ")))");
            }
            else
            {
                conditions.Add("[IsUseForALLProject]=1");
            }
            conditions.Add("[AmountType]=@AmountType");
            parameters.Add(new SqlParameter("@AmountType", AmountType));
            conditions.Add("[IsActive]=1");
            conditions.Add("[StartAmount]<=@Amount");
            conditions.Add("[EndAmount]>=@Amount");
            parameters.Add(new SqlParameter("@Amount", Amount));
            return(GetList <Mall_AmountRule>("select * from [Mall_AmountRule] where " + string.Join(" and ", conditions.ToArray()), parameters).ToArray());
        }
Example #2
0
        public static Wechat_Survey[] GetWechat_SurveyListByUserID(int UserID)
        {
            if (UserID == 0)
            {
                return(new Wechat_Survey[] { });
            }
            var ProjectIDList = Project.GetParentProjectIDListByAPPUserID(UserID);

            if (ProjectIDList.Count == 0)
            {
                return(new Wechat_Survey[] { });
            }
            List <SqlParameter> parameters = new List <SqlParameter>();
            List <string>       conditions = new List <string>();

            conditions.Add("[ID] in (select [Wechat_SurveyID] from [Wechat_SurveyProject] where [ProjectID] in (" + string.Join(",", ProjectIDList.ToArray()) + "))");
            return(GetList <Wechat_Survey>("select * from [Wechat_Survey] where [SurveyType]=3 and " + string.Join(" and ", conditions.ToArray()) + " order by [AddTime] desc", parameters).ToArray());
        }