123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748 |
- /*
- * 产品规则配置
- */
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Data;
- using MySystem.Models.Main;
- using Library;
- using LitJson;
- namespace MySystem.Service.Main
- {
- public class KqProductRuleSetService
- {
- string _conn = "";
- public KqProductRuleSetService()
- {
- _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
- }
- /// <summary>
- /// 查询列表
- /// </summary>
- /// <param name="relationData">关联表</param>
- /// <param name="condition">查询条件(sql语句)</param>
- /// <param name="count">总数(输出)</param>
- /// <param name="page">页码</param>
- /// <param name="limit">每页条数</param>
- /// <returns></returns>
- public List<Dictionary<string, object>> List(List<RelationData> relationData, string condition, out int count, int page = 1, int limit = 30, string orderBy = "Sort desc,Id desc")
- {
- List<string> fields = new List<string>(); //要显示的列
- fields.Add("Id");
- fields.Add("CreateDate"); //添加时间
- fields.Add("Status"); //状态
- fields.Add("Deposit"); //押金
- fields.Add("ActiveCount"); //活动政策台数
- fields.Add("ActivePrice"); //活动政策价格
- fields.Add("MerStaStartDate"); //活动开始时间
- fields.Add("MerStaEndDate"); //活动结束时间
- fields.Add("MerStaProfit"); //达标奖励
- fields.Add("MerStaMonths"); //激活后达标月
- fields.Add("MerStaTradeForMonth"); //激活后每月达标交易
- fields.Add("ActStartDate"); //活动开始时间
- fields.Add("ActEndDate"); //活动结束时间
- fields.Add("ActDeposit"); //激活押金
- fields.Add("ActFirst"); //激活首刷
- fields.Add("ActFirstDeposit"); //激活首刷押金
- fields.Add("ActPrize"); //激活奖励金额
- fields.Add("ActPosCount"); //激活赠机台数
- fields.Add("OpenStartDate"); //活动开始时间
- fields.Add("OpenEndDate"); //活动结束时间
- fields.Add("OpenStaDays"); //达标天数
- fields.Add("OpenStaTrade"); //达标交易
- fields.Add("OpenStaPrize"); //达标奖励1
- fields.Add("OpenStaPrize2"); //达标奖励2
- fields.Add("CycleStartDate"); //活动开始时间
- fields.Add("CycleEndDate"); //活动结束时间
- fields.Add("CycleIsOther"); //是否允许划拨给他人
- fields.Add("CyclePosDays"); //领机天数
- fields.Add("PullNewStartDate"); //活动开始时间
- fields.Add("PullNewEndDate"); //活动结束时间
- fields.Add("PullNewExtendDays"); //延长领机天数
- fields.Add("BigTotalAmount"); //购买机起始价
- fields.Add("BigExtendCycleDays"); //延长循环周期天数
- fields.Add("SubsidyStartDate"); //活动开始时间
- fields.Add("SubsidyEndDate"); //活动结束时间
- fields.Add("FlowCardStartDate"); //活动开始时间
- fields.Add("FlowCardEndDate"); //活动结束时间
- fields.Add("FlowCardFreeDays"); //免收天数
- fields.Add("FlowCardFee"); //费用
- fields.Add("FeeOfDays"); //扣费频率(天)
- fields.Add("FlowCardDirectProfit"); //直属上级返佣
- fields.Add("HelpStartDate"); //活动开始时间
- fields.Add("HelpEndDate"); //活动结束时间
- fields.Add("HelpMonths"); //计算自然月
- fields.Add("HelpFee"); //扶植期费率
- fields.Add("HelpSteadyFee"); //稳定期费率
- fields.Add("FeeBindDays"); //绑定起天数
- fields.Add("FeeFixed"); //固定手续费
- fields.Add("FeeRate"); //费率
- Dictionary<string, object> obj = new DbService(AppConfig.Base.dbTables, _conn).IndexData("KqProductRuleSet", relationData, orderBy, page, limit, condition, fields);
- List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
- count = int.Parse(obj["count"].ToString());
- return diclist;
- }
- public List<Dictionary<string, object>> List(List<RelationData> relationData, string condition, int page = 1, int limit = 30, string orderBy = "Sort desc,Id desc")
- {
- List<string> fields = new List<string>(); //要显示的列
- fields.Add("Id");
- fields.Add("CreateDate"); //添加时间
- fields.Add("Status"); //状态
- fields.Add("Deposit"); //押金
- fields.Add("ActiveCount"); //活动政策台数
- fields.Add("ActivePrice"); //活动政策价格
- fields.Add("MerStaStartDate"); //活动开始时间
- fields.Add("MerStaEndDate"); //活动结束时间
- fields.Add("MerStaProfit"); //达标奖励
- fields.Add("MerStaMonths"); //激活后达标月
- fields.Add("MerStaTradeForMonth"); //激活后每月达标交易
- fields.Add("ActStartDate"); //活动开始时间
- fields.Add("ActEndDate"); //活动结束时间
- fields.Add("ActDeposit"); //激活押金
- fields.Add("ActFirst"); //激活首刷
- fields.Add("ActFirstDeposit"); //激活首刷押金
- fields.Add("ActPrize"); //激活奖励金额
- fields.Add("ActPosCount"); //激活赠机台数
- fields.Add("OpenStartDate"); //活动开始时间
- fields.Add("OpenEndDate"); //活动结束时间
- fields.Add("OpenStaDays"); //达标天数
- fields.Add("OpenStaTrade"); //达标交易
- fields.Add("OpenStaPrize"); //达标奖励1
- fields.Add("OpenStaPrize2"); //达标奖励2
- fields.Add("CycleStartDate"); //活动开始时间
- fields.Add("CycleEndDate"); //活动结束时间
- fields.Add("CycleIsOther"); //是否允许划拨给他人
- fields.Add("CyclePosDays"); //领机天数
- fields.Add("PullNewStartDate"); //活动开始时间
- fields.Add("PullNewEndDate"); //活动结束时间
- fields.Add("PullNewExtendDays"); //延长领机天数
- fields.Add("BigTotalAmount"); //购买机起始价
- fields.Add("BigExtendCycleDays"); //延长循环周期天数
- fields.Add("SubsidyStartDate"); //活动开始时间
- fields.Add("SubsidyEndDate"); //活动结束时间
- fields.Add("FlowCardStartDate"); //活动开始时间
- fields.Add("FlowCardEndDate"); //活动结束时间
- fields.Add("FlowCardFreeDays"); //免收天数
- fields.Add("FlowCardFee"); //费用
- fields.Add("FeeOfDays"); //扣费频率(天)
- fields.Add("FlowCardDirectProfit"); //直属上级返佣
- fields.Add("HelpStartDate"); //活动开始时间
- fields.Add("HelpEndDate"); //活动结束时间
- fields.Add("HelpMonths"); //计算自然月
- fields.Add("HelpFee"); //扶植期费率
- fields.Add("HelpSteadyFee"); //稳定期费率
- fields.Add("FeeBindDays"); //绑定起天数
- fields.Add("FeeFixed"); //固定手续费
- fields.Add("FeeRate"); //费率
- Dictionary<string, object> obj = new DbService(AppConfig.Base.dbTables, _conn).IndexData("KqProductRuleSet", relationData, orderBy, page, limit, condition, fields);
- List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
- return diclist;
- }
- /// <summary>
- /// 查询一条记录
- /// </summary>
- /// <param name="Id">主键Id</param>
- /// <returns></returns>
- public KqProductRuleSet Query(int Id)
- {
- WebCMSEntities db = new WebCMSEntities();
- KqProductRuleSet editData = db.KqProductRuleSet.FirstOrDefault(m => m.Id == Id) ?? new KqProductRuleSet();
- db.Dispose();
- return editData;
- }
- /// <summary>
- /// 查询记录数
- /// </summary>
- /// <param name="Id">主键Id</param>
- /// <returns></returns>
- public int Count(string condition = "")
- {
- int result = 0;
- DataTable dt = CustomerSqlConn.dtable("select count(Id) from KqProductRuleSet where 1=1" + condition, _conn);
- if(dt.Rows.Count > 0)
- {
- result = int.Parse(function.CheckInt(dt.Rows[0][0].ToString()));
- }
- return result;
- }
- /// <summary>
- /// 查询是否存在
- /// </summary>
- /// <param name="Id">主键Id</param>
- /// <returns></returns>
- public bool Exist(int Id)
- {
- WebCMSEntities db = new WebCMSEntities();
- bool check = db.KqProductRuleSet.Any(m => m.Id == Id);
- db.Dispose();
- return check;
- }
- /// <summary>
- /// 添加数据
- /// </summary>
- /// <param name="Fields">要设置的字段</param>
- /// <returns></returns>
- public AppResultJson Add(Dictionary<string, object> fields, bool check = true)
- {
- if(check)
- {
- if (string.IsNullOrEmpty(fields["Deposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写押金" };
- }
- if (!function.IsNum(fields["Deposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的押金" };
- }
- if (string.IsNullOrEmpty(fields["ActiveCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写活动政策台数" };
- }
- if (!function.IsInt(fields["ActiveCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策台数" };
- }
- if (string.IsNullOrEmpty(fields["ActivePrice"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写活动政策价格" };
- }
- if (!function.IsNum(fields["ActivePrice"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策价格" };
- }
- if (string.IsNullOrEmpty(fields["MerStaProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标奖励" };
- }
- if (!function.IsNum(fields["MerStaProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励" };
- }
- if (string.IsNullOrEmpty(fields["MerStaMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活后达标月" };
- }
- if (!function.IsInt(fields["MerStaMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后达标月" };
- }
- if (string.IsNullOrEmpty(fields["MerStaTradeForMonth"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活后每月达标交易" };
- }
- if (!function.IsNum(fields["MerStaTradeForMonth"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后每月达标交易" };
- }
- if (string.IsNullOrEmpty(fields["ActDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活押金" };
- }
- if (!function.IsNum(fields["ActDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活押金" };
- }
- if (string.IsNullOrEmpty(fields["ActFirst"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活首刷" };
- }
- if (!function.IsNum(fields["ActFirst"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷" };
- }
- if (string.IsNullOrEmpty(fields["ActFirstDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活首刷押金" };
- }
- if (!function.IsNum(fields["ActFirstDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷押金" };
- }
- if (string.IsNullOrEmpty(fields["ActPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活奖励金额" };
- }
- if (!function.IsNum(fields["ActPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活奖励金额" };
- }
- if (string.IsNullOrEmpty(fields["ActPosCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活赠机台数" };
- }
- if (!function.IsInt(fields["ActPosCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活赠机台数" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标天数" };
- }
- if (!function.IsInt(fields["OpenStaDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标天数" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaTrade"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标交易" };
- }
- if (!function.IsNum(fields["OpenStaTrade"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标交易" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标奖励1" };
- }
- if (!function.IsNum(fields["OpenStaPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励1" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaPrize2"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标奖励2" };
- }
- if (!function.IsNum(fields["OpenStaPrize2"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励2" };
- }
- if (string.IsNullOrEmpty(fields["CyclePosDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写领机天数" };
- }
- if (!function.IsInt(fields["CyclePosDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的领机天数" };
- }
- if (string.IsNullOrEmpty(fields["PullNewExtendDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写延长领机天数" };
- }
- if (!function.IsInt(fields["PullNewExtendDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的延长领机天数" };
- }
- if (string.IsNullOrEmpty(fields["BigTotalAmount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写购买机起始价" };
- }
- if (!function.IsNum(fields["BigTotalAmount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的购买机起始价" };
- }
- if (string.IsNullOrEmpty(fields["BigExtendCycleDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写延长循环周期天数" };
- }
- if (!function.IsInt(fields["BigExtendCycleDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的延长循环周期天数" };
- }
- if (string.IsNullOrEmpty(fields["FlowCardFreeDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写免收天数" };
- }
- if (!function.IsInt(fields["FlowCardFreeDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的免收天数" };
- }
- if (string.IsNullOrEmpty(fields["FlowCardFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写费用" };
- }
- if (!function.IsNum(fields["FlowCardFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的费用" };
- }
- if (string.IsNullOrEmpty(fields["FeeOfDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写扣费频率(天)" };
- }
- if (!function.IsInt(fields["FeeOfDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的扣费频率(天)" };
- }
- if (string.IsNullOrEmpty(fields["FlowCardDirectProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写直属上级返佣" };
- }
- if (!function.IsNum(fields["FlowCardDirectProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的直属上级返佣" };
- }
- if (string.IsNullOrEmpty(fields["HelpMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写计算自然月" };
- }
- if (!function.IsInt(fields["HelpMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的计算自然月" };
- }
- if (string.IsNullOrEmpty(fields["HelpFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写扶植期费率" };
- }
- if (!function.IsNum(fields["HelpFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的扶植期费率" };
- }
- if (string.IsNullOrEmpty(fields["HelpSteadyFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写稳定期费率" };
- }
- if (!function.IsNum(fields["HelpSteadyFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的稳定期费率" };
- }
- if (string.IsNullOrEmpty(fields["FeeBindDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写绑定起天数" };
- }
- if (!function.IsInt(fields["FeeBindDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的绑定起天数" };
- }
- if (string.IsNullOrEmpty(fields["FeeFixed"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写固定手续费" };
- }
- if (!function.IsNum(fields["FeeFixed"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的固定手续费" };
- }
- if (string.IsNullOrEmpty(fields["FeeRate"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写费率" };
- }
- if (!function.IsNum(fields["FeeRate"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的费率" };
- }
- }
- int Id = new DbService(AppConfig.Base.dbTables, _conn).Add("KqProductRuleSet", fields, 0);
- return new AppResultJson(){ Status = "1", Data = Id };
- }
- /// <summary>
- /// 修改数据
- /// </summary>
- /// <param name="Fields">要设置的字段</param>
- /// <param name="Id">主键Id</param>
- public AppResultJson Edit(Dictionary<string, object> fields, int Id, bool check = true)
- {
- if(check)
- {
- if (string.IsNullOrEmpty(fields["Deposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写押金" };
- }
- if (!function.IsNum(fields["Deposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的押金" };
- }
- if (string.IsNullOrEmpty(fields["ActiveCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写活动政策台数" };
- }
- if (!function.IsInt(fields["ActiveCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策台数" };
- }
- if (string.IsNullOrEmpty(fields["ActivePrice"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写活动政策价格" };
- }
- if (!function.IsNum(fields["ActivePrice"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策价格" };
- }
- if (string.IsNullOrEmpty(fields["MerStaProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标奖励" };
- }
- if (!function.IsNum(fields["MerStaProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励" };
- }
- if (string.IsNullOrEmpty(fields["MerStaMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活后达标月" };
- }
- if (!function.IsInt(fields["MerStaMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后达标月" };
- }
- if (string.IsNullOrEmpty(fields["MerStaTradeForMonth"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活后每月达标交易" };
- }
- if (!function.IsNum(fields["MerStaTradeForMonth"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后每月达标交易" };
- }
- if (string.IsNullOrEmpty(fields["ActDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活押金" };
- }
- if (!function.IsNum(fields["ActDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活押金" };
- }
- if (string.IsNullOrEmpty(fields["ActFirst"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活首刷" };
- }
- if (!function.IsNum(fields["ActFirst"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷" };
- }
- if (string.IsNullOrEmpty(fields["ActFirstDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活首刷押金" };
- }
- if (!function.IsNum(fields["ActFirstDeposit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷押金" };
- }
- if (string.IsNullOrEmpty(fields["ActPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活奖励金额" };
- }
- if (!function.IsNum(fields["ActPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活奖励金额" };
- }
- if (string.IsNullOrEmpty(fields["ActPosCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写激活赠机台数" };
- }
- if (!function.IsInt(fields["ActPosCount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的激活赠机台数" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标天数" };
- }
- if (!function.IsInt(fields["OpenStaDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标天数" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaTrade"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标交易" };
- }
- if (!function.IsNum(fields["OpenStaTrade"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标交易" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标奖励1" };
- }
- if (!function.IsNum(fields["OpenStaPrize"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励1" };
- }
- if (string.IsNullOrEmpty(fields["OpenStaPrize2"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写达标奖励2" };
- }
- if (!function.IsNum(fields["OpenStaPrize2"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励2" };
- }
- if (string.IsNullOrEmpty(fields["CyclePosDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写领机天数" };
- }
- if (!function.IsInt(fields["CyclePosDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的领机天数" };
- }
- if (string.IsNullOrEmpty(fields["PullNewExtendDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写延长领机天数" };
- }
- if (!function.IsInt(fields["PullNewExtendDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的延长领机天数" };
- }
- if (string.IsNullOrEmpty(fields["BigTotalAmount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写购买机起始价" };
- }
- if (!function.IsNum(fields["BigTotalAmount"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的购买机起始价" };
- }
- if (string.IsNullOrEmpty(fields["BigExtendCycleDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写延长循环周期天数" };
- }
- if (!function.IsInt(fields["BigExtendCycleDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的延长循环周期天数" };
- }
- if (string.IsNullOrEmpty(fields["FlowCardFreeDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写免收天数" };
- }
- if (!function.IsInt(fields["FlowCardFreeDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的免收天数" };
- }
- if (string.IsNullOrEmpty(fields["FlowCardFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写费用" };
- }
- if (!function.IsNum(fields["FlowCardFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的费用" };
- }
- if (string.IsNullOrEmpty(fields["FeeOfDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写扣费频率(天)" };
- }
- if (!function.IsInt(fields["FeeOfDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的扣费频率(天)" };
- }
- if (string.IsNullOrEmpty(fields["FlowCardDirectProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写直属上级返佣" };
- }
- if (!function.IsNum(fields["FlowCardDirectProfit"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的直属上级返佣" };
- }
- if (string.IsNullOrEmpty(fields["HelpMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写计算自然月" };
- }
- if (!function.IsInt(fields["HelpMonths"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的计算自然月" };
- }
- if (string.IsNullOrEmpty(fields["HelpFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写扶植期费率" };
- }
- if (!function.IsNum(fields["HelpFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的扶植期费率" };
- }
- if (string.IsNullOrEmpty(fields["HelpSteadyFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写稳定期费率" };
- }
- if (!function.IsNum(fields["HelpSteadyFee"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的稳定期费率" };
- }
- if (string.IsNullOrEmpty(fields["FeeBindDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写绑定起天数" };
- }
- if (!function.IsInt(fields["FeeBindDays"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的绑定起天数" };
- }
- if (string.IsNullOrEmpty(fields["FeeFixed"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写固定手续费" };
- }
- if (!function.IsNum(fields["FeeFixed"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的固定手续费" };
- }
- if (string.IsNullOrEmpty(fields["FeeRate"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写费率" };
- }
- if (!function.IsNum(fields["FeeRate"].ToString()))
- {
- return new AppResultJson() { Status = "-1", Info = "请填写正确的费率" };
- }
- }
- new DbService(AppConfig.Base.dbTables, _conn).Edit("KqProductRuleSet", fields, Id);
- return new AppResultJson(){ Status = "1", Data = Id };
- }
- /// <summary>
- /// 逻辑删除
- /// </summary>
- /// <param name="Id">主键Id</param>
- public void Remove(int Id)
- {
- Dictionary<string, object> fields = new Dictionary<string, object>();
- fields.Add("Status", -1);
- new DbService(AppConfig.Base.dbTables, _conn).Edit("KqProductRuleSet", fields, Id);
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="Id">主键Id</param>
- public void Delete(int Id)
- {
- new DbService(AppConfig.Base.dbTables, _conn).Delete("KqProductRuleSet", Id);
- }
- /// <summary>
- /// 排序
- /// </summary>
- /// <param name="Id">主键Id</param>
- /// <param name="Sort">排序序号</param>
- public void Sort(int Id, int Sort)
- {
- new DbService(AppConfig.Base.dbTables, _conn).Sort("KqProductRuleSet", Sort, Id);
- }
- /// <summary>
- /// 导入数据
- /// </summary>
- /// <param name="ExcelData">json数据</param>
- public void Import(string ExcelData)
- {
- WebCMSEntities db = new WebCMSEntities();
- JsonData list = JsonMapper.ToObject(ExcelData);
- for (int i = 1; i < list.Count;i++ )
- {
- JsonData dr = list[i];
-
- db.KqProductRuleSet.Add(new KqProductRuleSet()
- {
- CreateDate = DateTime.Now,
- UpdateDate = DateTime.Now,
-
- });
- db.SaveChanges();
- }
- db.Dispose();
- }
- /// <summary>
- /// 导出excel表格
- /// </summary>
- /// <param name="fields">查询条件(单个字段)</param>
- /// <param name="condition">查询条件(sql语句)</param>
- /// <returns></returns>
- // public void ExportExcel(List<RelationData> relationData, string condition)
- // {
-
- // }
- }
- }
|