KqProductRuleSetService.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. /*
  2. * 产品规则配置
  3. */
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Data;
  8. using MySystem.Models.Main;
  9. using Library;
  10. using LitJson;
  11. namespace MySystem.Service.Main
  12. {
  13. public class KqProductRuleSetService
  14. {
  15. string _conn = "";
  16. public KqProductRuleSetService()
  17. {
  18. _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
  19. }
  20. /// <summary>
  21. /// 查询列表
  22. /// </summary>
  23. /// <param name="relationData">关联表</param>
  24. /// <param name="condition">查询条件(sql语句)</param>
  25. /// <param name="count">总数(输出)</param>
  26. /// <param name="page">页码</param>
  27. /// <param name="limit">每页条数</param>
  28. /// <returns></returns>
  29. 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")
  30. {
  31. List<string> fields = new List<string>(); //要显示的列
  32. fields.Add("Id");
  33. fields.Add("CreateDate"); //添加时间
  34. fields.Add("Status"); //状态
  35. fields.Add("Deposit"); //押金
  36. fields.Add("ActiveCount"); //活动政策台数
  37. fields.Add("ActivePrice"); //活动政策价格
  38. fields.Add("MerStaStartDate"); //活动开始时间
  39. fields.Add("MerStaEndDate"); //活动结束时间
  40. fields.Add("MerStaProfit"); //达标奖励
  41. fields.Add("MerStaMonths"); //激活后达标月
  42. fields.Add("MerStaTradeForMonth"); //激活后每月达标交易
  43. fields.Add("ActStartDate"); //活动开始时间
  44. fields.Add("ActEndDate"); //活动结束时间
  45. fields.Add("ActDeposit"); //激活押金
  46. fields.Add("ActFirst"); //激活首刷
  47. fields.Add("ActFirstDeposit"); //激活首刷押金
  48. fields.Add("ActPrize"); //激活奖励金额
  49. fields.Add("ActPosCount"); //激活赠机台数
  50. fields.Add("OpenStartDate"); //活动开始时间
  51. fields.Add("OpenEndDate"); //活动结束时间
  52. fields.Add("OpenStaDays"); //达标天数
  53. fields.Add("OpenStaTrade"); //达标交易
  54. fields.Add("OpenStaPrize"); //达标奖励1
  55. fields.Add("OpenStaPrize2"); //达标奖励2
  56. fields.Add("CycleStartDate"); //活动开始时间
  57. fields.Add("CycleEndDate"); //活动结束时间
  58. fields.Add("CycleIsOther"); //是否允许划拨给他人
  59. fields.Add("CyclePosDays"); //领机天数
  60. fields.Add("PullNewStartDate"); //活动开始时间
  61. fields.Add("PullNewEndDate"); //活动结束时间
  62. fields.Add("PullNewExtendDays"); //延长领机天数
  63. fields.Add("BigTotalAmount"); //购买机起始价
  64. fields.Add("BigExtendCycleDays"); //延长循环周期天数
  65. fields.Add("SubsidyStartDate"); //活动开始时间
  66. fields.Add("SubsidyEndDate"); //活动结束时间
  67. fields.Add("FlowCardStartDate"); //活动开始时间
  68. fields.Add("FlowCardEndDate"); //活动结束时间
  69. fields.Add("FlowCardFreeDays"); //免收天数
  70. fields.Add("FlowCardFee"); //费用
  71. fields.Add("FeeOfDays"); //扣费频率(天)
  72. fields.Add("FlowCardDirectProfit"); //直属上级返佣
  73. fields.Add("HelpStartDate"); //活动开始时间
  74. fields.Add("HelpEndDate"); //活动结束时间
  75. fields.Add("HelpMonths"); //计算自然月
  76. fields.Add("HelpFee"); //扶植期费率
  77. fields.Add("HelpSteadyFee"); //稳定期费率
  78. fields.Add("FeeBindDays"); //绑定起天数
  79. fields.Add("FeeFixed"); //固定手续费
  80. fields.Add("FeeRate"); //费率
  81. Dictionary<string, object> obj = new DbService(AppConfig.Base.dbTables, _conn).IndexData("KqProductRuleSet", relationData, orderBy, page, limit, condition, fields);
  82. List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
  83. count = int.Parse(obj["count"].ToString());
  84. return diclist;
  85. }
  86. public List<Dictionary<string, object>> List(List<RelationData> relationData, string condition, int page = 1, int limit = 30, string orderBy = "Sort desc,Id desc")
  87. {
  88. List<string> fields = new List<string>(); //要显示的列
  89. fields.Add("Id");
  90. fields.Add("CreateDate"); //添加时间
  91. fields.Add("Status"); //状态
  92. fields.Add("Deposit"); //押金
  93. fields.Add("ActiveCount"); //活动政策台数
  94. fields.Add("ActivePrice"); //活动政策价格
  95. fields.Add("MerStaStartDate"); //活动开始时间
  96. fields.Add("MerStaEndDate"); //活动结束时间
  97. fields.Add("MerStaProfit"); //达标奖励
  98. fields.Add("MerStaMonths"); //激活后达标月
  99. fields.Add("MerStaTradeForMonth"); //激活后每月达标交易
  100. fields.Add("ActStartDate"); //活动开始时间
  101. fields.Add("ActEndDate"); //活动结束时间
  102. fields.Add("ActDeposit"); //激活押金
  103. fields.Add("ActFirst"); //激活首刷
  104. fields.Add("ActFirstDeposit"); //激活首刷押金
  105. fields.Add("ActPrize"); //激活奖励金额
  106. fields.Add("ActPosCount"); //激活赠机台数
  107. fields.Add("OpenStartDate"); //活动开始时间
  108. fields.Add("OpenEndDate"); //活动结束时间
  109. fields.Add("OpenStaDays"); //达标天数
  110. fields.Add("OpenStaTrade"); //达标交易
  111. fields.Add("OpenStaPrize"); //达标奖励1
  112. fields.Add("OpenStaPrize2"); //达标奖励2
  113. fields.Add("CycleStartDate"); //活动开始时间
  114. fields.Add("CycleEndDate"); //活动结束时间
  115. fields.Add("CycleIsOther"); //是否允许划拨给他人
  116. fields.Add("CyclePosDays"); //领机天数
  117. fields.Add("PullNewStartDate"); //活动开始时间
  118. fields.Add("PullNewEndDate"); //活动结束时间
  119. fields.Add("PullNewExtendDays"); //延长领机天数
  120. fields.Add("BigTotalAmount"); //购买机起始价
  121. fields.Add("BigExtendCycleDays"); //延长循环周期天数
  122. fields.Add("SubsidyStartDate"); //活动开始时间
  123. fields.Add("SubsidyEndDate"); //活动结束时间
  124. fields.Add("FlowCardStartDate"); //活动开始时间
  125. fields.Add("FlowCardEndDate"); //活动结束时间
  126. fields.Add("FlowCardFreeDays"); //免收天数
  127. fields.Add("FlowCardFee"); //费用
  128. fields.Add("FeeOfDays"); //扣费频率(天)
  129. fields.Add("FlowCardDirectProfit"); //直属上级返佣
  130. fields.Add("HelpStartDate"); //活动开始时间
  131. fields.Add("HelpEndDate"); //活动结束时间
  132. fields.Add("HelpMonths"); //计算自然月
  133. fields.Add("HelpFee"); //扶植期费率
  134. fields.Add("HelpSteadyFee"); //稳定期费率
  135. fields.Add("FeeBindDays"); //绑定起天数
  136. fields.Add("FeeFixed"); //固定手续费
  137. fields.Add("FeeRate"); //费率
  138. Dictionary<string, object> obj = new DbService(AppConfig.Base.dbTables, _conn).IndexData("KqProductRuleSet", relationData, orderBy, page, limit, condition, fields);
  139. List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
  140. return diclist;
  141. }
  142. /// <summary>
  143. /// 查询一条记录
  144. /// </summary>
  145. /// <param name="Id">主键Id</param>
  146. /// <returns></returns>
  147. public KqProductRuleSet Query(int Id)
  148. {
  149. WebCMSEntities db = new WebCMSEntities();
  150. KqProductRuleSet editData = db.KqProductRuleSet.FirstOrDefault(m => m.Id == Id) ?? new KqProductRuleSet();
  151. db.Dispose();
  152. return editData;
  153. }
  154. /// <summary>
  155. /// 查询记录数
  156. /// </summary>
  157. /// <param name="Id">主键Id</param>
  158. /// <returns></returns>
  159. public int Count(string condition = "")
  160. {
  161. int result = 0;
  162. DataTable dt = CustomerSqlConn.dtable("select count(Id) from KqProductRuleSet where 1=1" + condition, _conn);
  163. if(dt.Rows.Count > 0)
  164. {
  165. result = int.Parse(function.CheckInt(dt.Rows[0][0].ToString()));
  166. }
  167. return result;
  168. }
  169. /// <summary>
  170. /// 查询是否存在
  171. /// </summary>
  172. /// <param name="Id">主键Id</param>
  173. /// <returns></returns>
  174. public bool Exist(int Id)
  175. {
  176. WebCMSEntities db = new WebCMSEntities();
  177. bool check = db.KqProductRuleSet.Any(m => m.Id == Id);
  178. db.Dispose();
  179. return check;
  180. }
  181. /// <summary>
  182. /// 添加数据
  183. /// </summary>
  184. /// <param name="Fields">要设置的字段</param>
  185. /// <returns></returns>
  186. public AppResultJson Add(Dictionary<string, object> fields, bool check = true)
  187. {
  188. if(check)
  189. {
  190. if (string.IsNullOrEmpty(fields["Deposit"].ToString()))
  191. {
  192. return new AppResultJson() { Status = "-1", Info = "请填写押金" };
  193. }
  194. if (!function.IsNum(fields["Deposit"].ToString()))
  195. {
  196. return new AppResultJson() { Status = "-1", Info = "请填写正确的押金" };
  197. }
  198. if (string.IsNullOrEmpty(fields["ActiveCount"].ToString()))
  199. {
  200. return new AppResultJson() { Status = "-1", Info = "请填写活动政策台数" };
  201. }
  202. if (!function.IsInt(fields["ActiveCount"].ToString()))
  203. {
  204. return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策台数" };
  205. }
  206. if (string.IsNullOrEmpty(fields["ActivePrice"].ToString()))
  207. {
  208. return new AppResultJson() { Status = "-1", Info = "请填写活动政策价格" };
  209. }
  210. if (!function.IsNum(fields["ActivePrice"].ToString()))
  211. {
  212. return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策价格" };
  213. }
  214. if (string.IsNullOrEmpty(fields["MerStaProfit"].ToString()))
  215. {
  216. return new AppResultJson() { Status = "-1", Info = "请填写达标奖励" };
  217. }
  218. if (!function.IsNum(fields["MerStaProfit"].ToString()))
  219. {
  220. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励" };
  221. }
  222. if (string.IsNullOrEmpty(fields["MerStaMonths"].ToString()))
  223. {
  224. return new AppResultJson() { Status = "-1", Info = "请填写激活后达标月" };
  225. }
  226. if (!function.IsInt(fields["MerStaMonths"].ToString()))
  227. {
  228. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后达标月" };
  229. }
  230. if (string.IsNullOrEmpty(fields["MerStaTradeForMonth"].ToString()))
  231. {
  232. return new AppResultJson() { Status = "-1", Info = "请填写激活后每月达标交易" };
  233. }
  234. if (!function.IsNum(fields["MerStaTradeForMonth"].ToString()))
  235. {
  236. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后每月达标交易" };
  237. }
  238. if (string.IsNullOrEmpty(fields["ActDeposit"].ToString()))
  239. {
  240. return new AppResultJson() { Status = "-1", Info = "请填写激活押金" };
  241. }
  242. if (!function.IsNum(fields["ActDeposit"].ToString()))
  243. {
  244. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活押金" };
  245. }
  246. if (string.IsNullOrEmpty(fields["ActFirst"].ToString()))
  247. {
  248. return new AppResultJson() { Status = "-1", Info = "请填写激活首刷" };
  249. }
  250. if (!function.IsNum(fields["ActFirst"].ToString()))
  251. {
  252. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷" };
  253. }
  254. if (string.IsNullOrEmpty(fields["ActFirstDeposit"].ToString()))
  255. {
  256. return new AppResultJson() { Status = "-1", Info = "请填写激活首刷押金" };
  257. }
  258. if (!function.IsNum(fields["ActFirstDeposit"].ToString()))
  259. {
  260. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷押金" };
  261. }
  262. if (string.IsNullOrEmpty(fields["ActPrize"].ToString()))
  263. {
  264. return new AppResultJson() { Status = "-1", Info = "请填写激活奖励金额" };
  265. }
  266. if (!function.IsNum(fields["ActPrize"].ToString()))
  267. {
  268. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活奖励金额" };
  269. }
  270. if (string.IsNullOrEmpty(fields["ActPosCount"].ToString()))
  271. {
  272. return new AppResultJson() { Status = "-1", Info = "请填写激活赠机台数" };
  273. }
  274. if (!function.IsInt(fields["ActPosCount"].ToString()))
  275. {
  276. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活赠机台数" };
  277. }
  278. if (string.IsNullOrEmpty(fields["OpenStaDays"].ToString()))
  279. {
  280. return new AppResultJson() { Status = "-1", Info = "请填写达标天数" };
  281. }
  282. if (!function.IsInt(fields["OpenStaDays"].ToString()))
  283. {
  284. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标天数" };
  285. }
  286. if (string.IsNullOrEmpty(fields["OpenStaTrade"].ToString()))
  287. {
  288. return new AppResultJson() { Status = "-1", Info = "请填写达标交易" };
  289. }
  290. if (!function.IsNum(fields["OpenStaTrade"].ToString()))
  291. {
  292. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标交易" };
  293. }
  294. if (string.IsNullOrEmpty(fields["OpenStaPrize"].ToString()))
  295. {
  296. return new AppResultJson() { Status = "-1", Info = "请填写达标奖励1" };
  297. }
  298. if (!function.IsNum(fields["OpenStaPrize"].ToString()))
  299. {
  300. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励1" };
  301. }
  302. if (string.IsNullOrEmpty(fields["OpenStaPrize2"].ToString()))
  303. {
  304. return new AppResultJson() { Status = "-1", Info = "请填写达标奖励2" };
  305. }
  306. if (!function.IsNum(fields["OpenStaPrize2"].ToString()))
  307. {
  308. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励2" };
  309. }
  310. if (string.IsNullOrEmpty(fields["CyclePosDays"].ToString()))
  311. {
  312. return new AppResultJson() { Status = "-1", Info = "请填写领机天数" };
  313. }
  314. if (!function.IsInt(fields["CyclePosDays"].ToString()))
  315. {
  316. return new AppResultJson() { Status = "-1", Info = "请填写正确的领机天数" };
  317. }
  318. if (string.IsNullOrEmpty(fields["PullNewExtendDays"].ToString()))
  319. {
  320. return new AppResultJson() { Status = "-1", Info = "请填写延长领机天数" };
  321. }
  322. if (!function.IsInt(fields["PullNewExtendDays"].ToString()))
  323. {
  324. return new AppResultJson() { Status = "-1", Info = "请填写正确的延长领机天数" };
  325. }
  326. if (string.IsNullOrEmpty(fields["BigTotalAmount"].ToString()))
  327. {
  328. return new AppResultJson() { Status = "-1", Info = "请填写购买机起始价" };
  329. }
  330. if (!function.IsNum(fields["BigTotalAmount"].ToString()))
  331. {
  332. return new AppResultJson() { Status = "-1", Info = "请填写正确的购买机起始价" };
  333. }
  334. if (string.IsNullOrEmpty(fields["BigExtendCycleDays"].ToString()))
  335. {
  336. return new AppResultJson() { Status = "-1", Info = "请填写延长循环周期天数" };
  337. }
  338. if (!function.IsInt(fields["BigExtendCycleDays"].ToString()))
  339. {
  340. return new AppResultJson() { Status = "-1", Info = "请填写正确的延长循环周期天数" };
  341. }
  342. if (string.IsNullOrEmpty(fields["FlowCardFreeDays"].ToString()))
  343. {
  344. return new AppResultJson() { Status = "-1", Info = "请填写免收天数" };
  345. }
  346. if (!function.IsInt(fields["FlowCardFreeDays"].ToString()))
  347. {
  348. return new AppResultJson() { Status = "-1", Info = "请填写正确的免收天数" };
  349. }
  350. if (string.IsNullOrEmpty(fields["FlowCardFee"].ToString()))
  351. {
  352. return new AppResultJson() { Status = "-1", Info = "请填写费用" };
  353. }
  354. if (!function.IsNum(fields["FlowCardFee"].ToString()))
  355. {
  356. return new AppResultJson() { Status = "-1", Info = "请填写正确的费用" };
  357. }
  358. if (string.IsNullOrEmpty(fields["FeeOfDays"].ToString()))
  359. {
  360. return new AppResultJson() { Status = "-1", Info = "请填写扣费频率(天)" };
  361. }
  362. if (!function.IsInt(fields["FeeOfDays"].ToString()))
  363. {
  364. return new AppResultJson() { Status = "-1", Info = "请填写正确的扣费频率(天)" };
  365. }
  366. if (string.IsNullOrEmpty(fields["FlowCardDirectProfit"].ToString()))
  367. {
  368. return new AppResultJson() { Status = "-1", Info = "请填写直属上级返佣" };
  369. }
  370. if (!function.IsNum(fields["FlowCardDirectProfit"].ToString()))
  371. {
  372. return new AppResultJson() { Status = "-1", Info = "请填写正确的直属上级返佣" };
  373. }
  374. if (string.IsNullOrEmpty(fields["HelpMonths"].ToString()))
  375. {
  376. return new AppResultJson() { Status = "-1", Info = "请填写计算自然月" };
  377. }
  378. if (!function.IsInt(fields["HelpMonths"].ToString()))
  379. {
  380. return new AppResultJson() { Status = "-1", Info = "请填写正确的计算自然月" };
  381. }
  382. if (string.IsNullOrEmpty(fields["HelpFee"].ToString()))
  383. {
  384. return new AppResultJson() { Status = "-1", Info = "请填写扶植期费率" };
  385. }
  386. if (!function.IsNum(fields["HelpFee"].ToString()))
  387. {
  388. return new AppResultJson() { Status = "-1", Info = "请填写正确的扶植期费率" };
  389. }
  390. if (string.IsNullOrEmpty(fields["HelpSteadyFee"].ToString()))
  391. {
  392. return new AppResultJson() { Status = "-1", Info = "请填写稳定期费率" };
  393. }
  394. if (!function.IsNum(fields["HelpSteadyFee"].ToString()))
  395. {
  396. return new AppResultJson() { Status = "-1", Info = "请填写正确的稳定期费率" };
  397. }
  398. if (string.IsNullOrEmpty(fields["FeeBindDays"].ToString()))
  399. {
  400. return new AppResultJson() { Status = "-1", Info = "请填写绑定起天数" };
  401. }
  402. if (!function.IsInt(fields["FeeBindDays"].ToString()))
  403. {
  404. return new AppResultJson() { Status = "-1", Info = "请填写正确的绑定起天数" };
  405. }
  406. if (string.IsNullOrEmpty(fields["FeeFixed"].ToString()))
  407. {
  408. return new AppResultJson() { Status = "-1", Info = "请填写固定手续费" };
  409. }
  410. if (!function.IsNum(fields["FeeFixed"].ToString()))
  411. {
  412. return new AppResultJson() { Status = "-1", Info = "请填写正确的固定手续费" };
  413. }
  414. if (string.IsNullOrEmpty(fields["FeeRate"].ToString()))
  415. {
  416. return new AppResultJson() { Status = "-1", Info = "请填写费率" };
  417. }
  418. if (!function.IsNum(fields["FeeRate"].ToString()))
  419. {
  420. return new AppResultJson() { Status = "-1", Info = "请填写正确的费率" };
  421. }
  422. }
  423. int Id = new DbService(AppConfig.Base.dbTables, _conn).Add("KqProductRuleSet", fields, 0);
  424. return new AppResultJson(){ Status = "1", Data = Id };
  425. }
  426. /// <summary>
  427. /// 修改数据
  428. /// </summary>
  429. /// <param name="Fields">要设置的字段</param>
  430. /// <param name="Id">主键Id</param>
  431. public AppResultJson Edit(Dictionary<string, object> fields, int Id, bool check = true)
  432. {
  433. if(check)
  434. {
  435. if (string.IsNullOrEmpty(fields["Deposit"].ToString()))
  436. {
  437. return new AppResultJson() { Status = "-1", Info = "请填写押金" };
  438. }
  439. if (!function.IsNum(fields["Deposit"].ToString()))
  440. {
  441. return new AppResultJson() { Status = "-1", Info = "请填写正确的押金" };
  442. }
  443. if (string.IsNullOrEmpty(fields["ActiveCount"].ToString()))
  444. {
  445. return new AppResultJson() { Status = "-1", Info = "请填写活动政策台数" };
  446. }
  447. if (!function.IsInt(fields["ActiveCount"].ToString()))
  448. {
  449. return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策台数" };
  450. }
  451. if (string.IsNullOrEmpty(fields["ActivePrice"].ToString()))
  452. {
  453. return new AppResultJson() { Status = "-1", Info = "请填写活动政策价格" };
  454. }
  455. if (!function.IsNum(fields["ActivePrice"].ToString()))
  456. {
  457. return new AppResultJson() { Status = "-1", Info = "请填写正确的活动政策价格" };
  458. }
  459. if (string.IsNullOrEmpty(fields["MerStaProfit"].ToString()))
  460. {
  461. return new AppResultJson() { Status = "-1", Info = "请填写达标奖励" };
  462. }
  463. if (!function.IsNum(fields["MerStaProfit"].ToString()))
  464. {
  465. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励" };
  466. }
  467. if (string.IsNullOrEmpty(fields["MerStaMonths"].ToString()))
  468. {
  469. return new AppResultJson() { Status = "-1", Info = "请填写激活后达标月" };
  470. }
  471. if (!function.IsInt(fields["MerStaMonths"].ToString()))
  472. {
  473. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后达标月" };
  474. }
  475. if (string.IsNullOrEmpty(fields["MerStaTradeForMonth"].ToString()))
  476. {
  477. return new AppResultJson() { Status = "-1", Info = "请填写激活后每月达标交易" };
  478. }
  479. if (!function.IsNum(fields["MerStaTradeForMonth"].ToString()))
  480. {
  481. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活后每月达标交易" };
  482. }
  483. if (string.IsNullOrEmpty(fields["ActDeposit"].ToString()))
  484. {
  485. return new AppResultJson() { Status = "-1", Info = "请填写激活押金" };
  486. }
  487. if (!function.IsNum(fields["ActDeposit"].ToString()))
  488. {
  489. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活押金" };
  490. }
  491. if (string.IsNullOrEmpty(fields["ActFirst"].ToString()))
  492. {
  493. return new AppResultJson() { Status = "-1", Info = "请填写激活首刷" };
  494. }
  495. if (!function.IsNum(fields["ActFirst"].ToString()))
  496. {
  497. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷" };
  498. }
  499. if (string.IsNullOrEmpty(fields["ActFirstDeposit"].ToString()))
  500. {
  501. return new AppResultJson() { Status = "-1", Info = "请填写激活首刷押金" };
  502. }
  503. if (!function.IsNum(fields["ActFirstDeposit"].ToString()))
  504. {
  505. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活首刷押金" };
  506. }
  507. if (string.IsNullOrEmpty(fields["ActPrize"].ToString()))
  508. {
  509. return new AppResultJson() { Status = "-1", Info = "请填写激活奖励金额" };
  510. }
  511. if (!function.IsNum(fields["ActPrize"].ToString()))
  512. {
  513. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活奖励金额" };
  514. }
  515. if (string.IsNullOrEmpty(fields["ActPosCount"].ToString()))
  516. {
  517. return new AppResultJson() { Status = "-1", Info = "请填写激活赠机台数" };
  518. }
  519. if (!function.IsInt(fields["ActPosCount"].ToString()))
  520. {
  521. return new AppResultJson() { Status = "-1", Info = "请填写正确的激活赠机台数" };
  522. }
  523. if (string.IsNullOrEmpty(fields["OpenStaDays"].ToString()))
  524. {
  525. return new AppResultJson() { Status = "-1", Info = "请填写达标天数" };
  526. }
  527. if (!function.IsInt(fields["OpenStaDays"].ToString()))
  528. {
  529. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标天数" };
  530. }
  531. if (string.IsNullOrEmpty(fields["OpenStaTrade"].ToString()))
  532. {
  533. return new AppResultJson() { Status = "-1", Info = "请填写达标交易" };
  534. }
  535. if (!function.IsNum(fields["OpenStaTrade"].ToString()))
  536. {
  537. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标交易" };
  538. }
  539. if (string.IsNullOrEmpty(fields["OpenStaPrize"].ToString()))
  540. {
  541. return new AppResultJson() { Status = "-1", Info = "请填写达标奖励1" };
  542. }
  543. if (!function.IsNum(fields["OpenStaPrize"].ToString()))
  544. {
  545. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励1" };
  546. }
  547. if (string.IsNullOrEmpty(fields["OpenStaPrize2"].ToString()))
  548. {
  549. return new AppResultJson() { Status = "-1", Info = "请填写达标奖励2" };
  550. }
  551. if (!function.IsNum(fields["OpenStaPrize2"].ToString()))
  552. {
  553. return new AppResultJson() { Status = "-1", Info = "请填写正确的达标奖励2" };
  554. }
  555. if (string.IsNullOrEmpty(fields["CyclePosDays"].ToString()))
  556. {
  557. return new AppResultJson() { Status = "-1", Info = "请填写领机天数" };
  558. }
  559. if (!function.IsInt(fields["CyclePosDays"].ToString()))
  560. {
  561. return new AppResultJson() { Status = "-1", Info = "请填写正确的领机天数" };
  562. }
  563. if (string.IsNullOrEmpty(fields["PullNewExtendDays"].ToString()))
  564. {
  565. return new AppResultJson() { Status = "-1", Info = "请填写延长领机天数" };
  566. }
  567. if (!function.IsInt(fields["PullNewExtendDays"].ToString()))
  568. {
  569. return new AppResultJson() { Status = "-1", Info = "请填写正确的延长领机天数" };
  570. }
  571. if (string.IsNullOrEmpty(fields["BigTotalAmount"].ToString()))
  572. {
  573. return new AppResultJson() { Status = "-1", Info = "请填写购买机起始价" };
  574. }
  575. if (!function.IsNum(fields["BigTotalAmount"].ToString()))
  576. {
  577. return new AppResultJson() { Status = "-1", Info = "请填写正确的购买机起始价" };
  578. }
  579. if (string.IsNullOrEmpty(fields["BigExtendCycleDays"].ToString()))
  580. {
  581. return new AppResultJson() { Status = "-1", Info = "请填写延长循环周期天数" };
  582. }
  583. if (!function.IsInt(fields["BigExtendCycleDays"].ToString()))
  584. {
  585. return new AppResultJson() { Status = "-1", Info = "请填写正确的延长循环周期天数" };
  586. }
  587. if (string.IsNullOrEmpty(fields["FlowCardFreeDays"].ToString()))
  588. {
  589. return new AppResultJson() { Status = "-1", Info = "请填写免收天数" };
  590. }
  591. if (!function.IsInt(fields["FlowCardFreeDays"].ToString()))
  592. {
  593. return new AppResultJson() { Status = "-1", Info = "请填写正确的免收天数" };
  594. }
  595. if (string.IsNullOrEmpty(fields["FlowCardFee"].ToString()))
  596. {
  597. return new AppResultJson() { Status = "-1", Info = "请填写费用" };
  598. }
  599. if (!function.IsNum(fields["FlowCardFee"].ToString()))
  600. {
  601. return new AppResultJson() { Status = "-1", Info = "请填写正确的费用" };
  602. }
  603. if (string.IsNullOrEmpty(fields["FeeOfDays"].ToString()))
  604. {
  605. return new AppResultJson() { Status = "-1", Info = "请填写扣费频率(天)" };
  606. }
  607. if (!function.IsInt(fields["FeeOfDays"].ToString()))
  608. {
  609. return new AppResultJson() { Status = "-1", Info = "请填写正确的扣费频率(天)" };
  610. }
  611. if (string.IsNullOrEmpty(fields["FlowCardDirectProfit"].ToString()))
  612. {
  613. return new AppResultJson() { Status = "-1", Info = "请填写直属上级返佣" };
  614. }
  615. if (!function.IsNum(fields["FlowCardDirectProfit"].ToString()))
  616. {
  617. return new AppResultJson() { Status = "-1", Info = "请填写正确的直属上级返佣" };
  618. }
  619. if (string.IsNullOrEmpty(fields["HelpMonths"].ToString()))
  620. {
  621. return new AppResultJson() { Status = "-1", Info = "请填写计算自然月" };
  622. }
  623. if (!function.IsInt(fields["HelpMonths"].ToString()))
  624. {
  625. return new AppResultJson() { Status = "-1", Info = "请填写正确的计算自然月" };
  626. }
  627. if (string.IsNullOrEmpty(fields["HelpFee"].ToString()))
  628. {
  629. return new AppResultJson() { Status = "-1", Info = "请填写扶植期费率" };
  630. }
  631. if (!function.IsNum(fields["HelpFee"].ToString()))
  632. {
  633. return new AppResultJson() { Status = "-1", Info = "请填写正确的扶植期费率" };
  634. }
  635. if (string.IsNullOrEmpty(fields["HelpSteadyFee"].ToString()))
  636. {
  637. return new AppResultJson() { Status = "-1", Info = "请填写稳定期费率" };
  638. }
  639. if (!function.IsNum(fields["HelpSteadyFee"].ToString()))
  640. {
  641. return new AppResultJson() { Status = "-1", Info = "请填写正确的稳定期费率" };
  642. }
  643. if (string.IsNullOrEmpty(fields["FeeBindDays"].ToString()))
  644. {
  645. return new AppResultJson() { Status = "-1", Info = "请填写绑定起天数" };
  646. }
  647. if (!function.IsInt(fields["FeeBindDays"].ToString()))
  648. {
  649. return new AppResultJson() { Status = "-1", Info = "请填写正确的绑定起天数" };
  650. }
  651. if (string.IsNullOrEmpty(fields["FeeFixed"].ToString()))
  652. {
  653. return new AppResultJson() { Status = "-1", Info = "请填写固定手续费" };
  654. }
  655. if (!function.IsNum(fields["FeeFixed"].ToString()))
  656. {
  657. return new AppResultJson() { Status = "-1", Info = "请填写正确的固定手续费" };
  658. }
  659. if (string.IsNullOrEmpty(fields["FeeRate"].ToString()))
  660. {
  661. return new AppResultJson() { Status = "-1", Info = "请填写费率" };
  662. }
  663. if (!function.IsNum(fields["FeeRate"].ToString()))
  664. {
  665. return new AppResultJson() { Status = "-1", Info = "请填写正确的费率" };
  666. }
  667. }
  668. new DbService(AppConfig.Base.dbTables, _conn).Edit("KqProductRuleSet", fields, Id);
  669. return new AppResultJson(){ Status = "1", Data = Id };
  670. }
  671. /// <summary>
  672. /// 逻辑删除
  673. /// </summary>
  674. /// <param name="Id">主键Id</param>
  675. public void Remove(int Id)
  676. {
  677. Dictionary<string, object> fields = new Dictionary<string, object>();
  678. fields.Add("Status", -1);
  679. new DbService(AppConfig.Base.dbTables, _conn).Edit("KqProductRuleSet", fields, Id);
  680. }
  681. /// <summary>
  682. /// 删除数据
  683. /// </summary>
  684. /// <param name="Id">主键Id</param>
  685. public void Delete(int Id)
  686. {
  687. new DbService(AppConfig.Base.dbTables, _conn).Delete("KqProductRuleSet", Id);
  688. }
  689. /// <summary>
  690. /// 排序
  691. /// </summary>
  692. /// <param name="Id">主键Id</param>
  693. /// <param name="Sort">排序序号</param>
  694. public void Sort(int Id, int Sort)
  695. {
  696. new DbService(AppConfig.Base.dbTables, _conn).Sort("KqProductRuleSet", Sort, Id);
  697. }
  698. /// <summary>
  699. /// 导入数据
  700. /// </summary>
  701. /// <param name="ExcelData">json数据</param>
  702. public void Import(string ExcelData)
  703. {
  704. WebCMSEntities db = new WebCMSEntities();
  705. JsonData list = JsonMapper.ToObject(ExcelData);
  706. for (int i = 1; i < list.Count;i++ )
  707. {
  708. JsonData dr = list[i];
  709. db.KqProductRuleSet.Add(new KqProductRuleSet()
  710. {
  711. CreateDate = DateTime.Now,
  712. UpdateDate = DateTime.Now,
  713. });
  714. db.SaveChanges();
  715. }
  716. db.Dispose();
  717. }
  718. /// <summary>
  719. /// 导出excel表格
  720. /// </summary>
  721. /// <param name="fields">查询条件(单个字段)</param>
  722. /// <param name="condition">查询条件(sql语句)</param>
  723. /// <returns></returns>
  724. // public void ExportExcel(List<RelationData> relationData, string condition)
  725. // {
  726. // }
  727. }
  728. }