123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- using System;
- using System.Collections.Generic;
- using Library;
- using System.Linq;
- using MySystem.Models.Main;
- namespace MySystem
- {
- public class QrCodeTradeStat
- {
- public readonly static QrCodeTradeStat Instance = new QrCodeTradeStat();
- public QrCodeTradeStat()
- { }
- public decimal Amount(string SnNo)
- {
- decimal amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo).Sum(m => m.TradeAmount);
- }
- db.Dispose();
- return amt;
- }
- public decimal Amount(string SnNo, string DateOrMonth)
- {
- decimal amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(DateOrMonth.Length == 8)
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.TradeDate == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.TradeDate == DateOrMonth).Sum(m => m.TradeAmount);
- }
- }
- else
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.TradeMonth == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.TradeMonth == DateOrMonth).Sum(m => m.TradeAmount);
- }
- }
- db.Dispose();
- return amt;
- }
- public int Count(string SnNo, string DateOrMonth)
- {
- int amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(DateOrMonth.Length == 8)
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.TradeDate == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.TradeDate == DateOrMonth).Sum(m => m.TradeCount);
- }
- }
- else
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.TradeMonth == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.TradeMonth == DateOrMonth).Sum(m => m.TradeCount);
- }
- }
- db.Dispose();
- return amt;
- }
- public decimal Amount(string SnNo, string DateOrMonth, int PayMode)
- {
- decimal amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(DateOrMonth.Length == 8)
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeDate == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeDate == DateOrMonth).Sum(m => m.TradeAmount);
- }
- }
- else
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeMonth == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeMonth == DateOrMonth).Sum(m => m.TradeAmount);
- }
- }
- db.Dispose();
- return amt;
- }
- public int Count(string SnNo, string DateOrMonth, int PayMode)
- {
- int amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(DateOrMonth.Length == 8)
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeDate == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeDate == DateOrMonth).Sum(m => m.TradeCount);
- }
- }
- else
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeMonth == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.TradeMonth == DateOrMonth).Sum(m => m.TradeCount);
- }
- }
- db.Dispose();
- return amt;
- }
- public decimal Amount(string SnNo, string DateOrMonth, int PayMode, int IsAct)
- {
- decimal amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(DateOrMonth.Length == 8)
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeDate == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeDate == DateOrMonth).Sum(m => m.TradeAmount);
- }
- }
- else
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeMonth == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeMonth == DateOrMonth).Sum(m => m.TradeAmount);
- }
- }
- db.Dispose();
- return amt;
- }
- public int Count(string SnNo, string DateOrMonth, int PayMode, int IsAct)
- {
- int amt = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(DateOrMonth.Length == 8)
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeDate == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeDate == DateOrMonth).Sum(m => m.TradeCount);
- }
- }
- else
- {
- bool check = db.QrCodeAmountSummay.Any(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeMonth == DateOrMonth);
- if (check)
- {
- amt = db.QrCodeAmountSummay.Where(m => m.SnNo == SnNo && m.PayMode == PayMode && m.IsAct == IsAct && m.TradeMonth == DateOrMonth).Sum(m => m.TradeCount);
- }
- }
- db.Dispose();
- return amt;
- }
- }
- }
|