public TransList getPriceByDate(int pg, int tk, string fnd, string pCode) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var priceband = (from p in enBi.STG_DIM_PRICE_BAND where p.PROD_LEVEL1_CODE == pCode select new { p.ID, p.PRICE_BAND_CODE, p.PRICE_BAND_DESC, p.PROD_LEVEL1_CODE, p.PRICE_BAND_LOWER, p.PRICE_BAND_UPPER, p.PRICE_BAND_SEQ, p.ARC_DATE }) .OrderBy(od => od.PRICE_BAND_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_DIM_PRICE_BAND.AsNoTracking().Where(st => st.PROD_LEVEL1_CODE == pCode).Count(); transList.data = priceband; return(transList); } }
public TransList getUserActive() { try { TransList transList = new TransList(); using (PRINCE_STGEntities entPrince = new PRINCE_STGEntities()) { var user = (from u in entPrince.User where u.Status == "A" select new { u.Id, u.Code, u.EmailAdd, u.FirstName, u.LastName, u.Status }) .OrderBy(od => od.LastName) .ToList(); transList.totalCount = entPrince.User.AsNoTracking().Count(); transList.data = user; return(transList); } } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public TransList getStockAgeByCode(int pg, int tk, string fnd, string pCode) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var stockage = (from s in enBi.STG_DIM_STOCKAGE_BAND where s.STKAGE_PROD_LEVEL1_CODE == pCode select new { s.ID, s.STOCKAGE_BAND_DESC, s.STKAGE_PROD_LEVEL1_CODE, s.STOCKAGE_BAND_LOWER, s.STOCKAGE_BAND_UPPER, s.STOCKAGE_BAND_SEQ, s.LATEST, s.ARC_DATE }) .OrderBy(od => od.STOCKAGE_BAND_DESC) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_DIM_STOCKAGE_BAND.AsNoTracking().Where(st => st.STKAGE_PROD_LEVEL1_CODE == pCode).Count(); transList.data = stockage; return(transList); } }
public List <TEMP_DC> getStoreDc() { try { TransList trans = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { List <TEMP_DC> listDc = enBi.TEMP_DC.AsNoTracking().ToList(); // trans.data = listDc; return(listDc); } } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public TransList getUser(int pg, int tk, string fnd) { try { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities entPrince = new PRINCE_STGEntities()) { var user = (from u in entPrince.User select new { u.Id, u.Code, u.EmailAdd, u.FirstName, u.LastName, u.Status }) .OrderBy(od => od.LastName) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = entPrince.User.AsNoTracking().Count(); transList.data = user; return(transList); } } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public TransList getPrice(int pg, int tk) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var priceband = (from s in enBi.STG_DIM_PRICE_BAND select new { s.ID, s.PRICE_BAND_CODE, s.PRICE_BAND_DESC, s.PROD_LEVEL1_CODE, s.PRICE_BAND_LOWER, s.PRICE_BAND_UPPER, s.PRICE_BAND_SEQ, s.ARC_DATE }) .OrderBy(od => od.PRICE_BAND_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_DIM_PRICE_BAND.AsNoTracking().Count(); transList.data = priceband; return(transList); } }
public Debtor(string name = "NN", double debt = 0) { Name = name; TransactionsList = new TransList(); if (debt != 0) { PayOrBorrow(debt); } }
public TransList getSite(int pg, int tk, string fnd) { try { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities db = new PRINCE_STGEntities()) { db.Configuration.LazyLoadingEnabled = false; if (string.IsNullOrEmpty(fnd)) { List <Site> site = db.Site.AsNoTracking() .OrderBy(od => od.Description) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = db.Site.AsNoTracking().Count(); transList.data = site; } else { List <Site> site = db.Site.AsNoTracking() .Where(wr => wr.Description.Contains(fnd) || wr.Status.Contains(fnd)) .OrderBy(od => od.Description) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = db.Site.AsNoTracking().Where(wr => wr.Description.Contains(fnd) || wr.Status.Contains(fnd)).Count(); transList.data = site; } } return(transList); } catch (DbEntityValidationException ex) { ExceptionEntity exDesc = new ExceptionEntity(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } catch (Exception ex) { ExceptionDescription exDesc = new ExceptionDescription(ex); throw new ApiException() { HttpStatus = HttpStatusCode.BadRequest, ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = exDesc.GetDescException() }; } }
public TransList getPlan(int pg, int tk, string fnd) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var plan = (from s in enBi.STG_PLAN select new { s.ID , s.PLAN_DATE , s.GEO_LEVEL1_CODE , s.GEO_LEVEL2_CODE , s.GEO_LEVEL3_CODE , s.STORE_CODE , s.PROD_LEVEL1_CODE , s.PROD_LEVEL2_CODE , s.PROD_LEVEL3_CODE , s.PROD_LEVEL4_CODE , s.PROD_LEVEL5_CODE , s.PRODUCT_CODE , s.PLAN_VERSION , s.PLAN_SALE_QTY , s.PLAN_SALE_VAL_AT_PRICE , s.PLAN_SALE_VAL_AT_COST , s.PLAN_MARKDOWN_QTY , s.PLAN_MARKDOWN_VAL , s.PLAN_SHRINKAGE_VAL , s.PLAN_PURCHASE_QTY , s.PLAN_PURCHASE_VAL , s.PLAN_INV_OPENING_QTY , s.PLAN_OPENING_VAL_AT_COST , s.PLAN_OPENING_VAL_AT_PRICE , s.PLAN_OTH1 , s.PLAN_OTH2 , s.PLAN_OTH3 , s.PLAN_OTH4 , s.PLAN_OTH5 , s.ARC_DATE }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_PLAN.AsNoTracking().Count(); transList.data = plan; return(transList); } }
public TransList getStoreMerchByDate(int pg, int tk, string fnd, string pSite, string sStoreMerchdate) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); CultureInfo culture = new CultureInfo("en-US"); DateTime StoreMerchdate = Convert.ToDateTime(sStoreMerchdate, culture); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var Storemerch = (from s in enBi.STG_STR_MERCH_DET where s.STORE_CODE == pSite && s.STRMRGRP_DATE == StoreMerchdate select new { s.ID, s.STRMRGRP_DATE , s.STORE_CODE , s.PROD_LEVEL1_CODE , s.PROD_LEVEL2_CODE , s.PROD_LEVEL3_CODE , s.PROD_LEVEL4_CODE , s.SELLING_AREA , s.TOTAL_AREA , s.PERMENANT_FTE , s.CONTRACT_FTE , s.OTH_DET1 , s.OTH_DET2 , s.OTH_DET3 , s.OTH_DET4 , s.OTH_DET5 , s.ARC_DATE }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_STR_MERCH_DET.AsNoTracking().Where(st => st.STRMRGRP_DATE == StoreMerchdate && st.STORE_CODE == pSite).Count(); transList.data = Storemerch; return(transList); } }
static void Main(string[] args) { /*A retailer offers a rewards program to its customers, awarding points based on each recorded purchase. * A customer receives 2 points for every dollar spent over $100 in each transaction, plus 1 point for every dollar spent over $50 in each transaction * (e.g.a $120 purchase = 2x$20 + 1x$50 = 90 points). * * Given a record of every transaction during a three month period, calculate the reward points earned for each customer per month and total.*/ var transactionList = new TransList(); transactionList.transactionAdd(300); transactionList.transactionAdd(524); transactionList.transactionAdd(201); transactionList.transactionAdd(120); transactionList.transactionAdd(100); var allTransactions = transactionList.getListOfAllTransactions(); var totalRewards = transactionList.getTotalRewards(); var threeMonths = transactionList.getLastThreeMonthsList(); var rewardPerMonth = transactionList.getRewardPerMonth(); }
public TransList getTargetByDate(int pg, int tk, string fnd, string pSite, string sTargetdate) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); CultureInfo culture = new CultureInfo("en-US"); DateTime Targetdate = Convert.ToDateTime(sTargetdate, culture); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var Target = (from t in enBi.STG_TARGET where t.STORE_CODE == pSite && t.TARGET_DATE == Targetdate select new { t.ID, t.TARGET_DATE, t.GEO_LEVEL1_CODE, t.GEO_LEVEL2_CODE, t.GEO_LEVEL3_CODE, t.STORE_CODE, t.PROD_LEVEL1_CODE, t.PROD_LEVEL2_CODE, t.PROD_LEVEL3_CODE, t.PROD_LEVEL4_CODE, t.PROD_LEVEL5_CODE, t.PRODUCT_CODE, t.TARGET_SALE_QTY, t.TARGET_SALE_VAL_AT_PRICE, t.TARGET_SALE_VAL_AT_COST, t.ARC_DATE }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_TARGET.AsNoTracking().Where(st => st.TARGET_DATE == Targetdate && st.STORE_CODE == pSite).Count(); transList.data = Target; return(transList); } }
public TransList getStore(int pg, int tk, string fnd) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { //i include the dc of store //current design is 1 store only have 1 dc(for manthan table design purpose only) but in actual there are multiple dc in 1 store var tempStore = (from s in enBi.TEMP_STORE select new { s.ID, s.STORE_CODE, s.STORE_DESCRIPTION, s.AREA_MANAGER, s.AREA_MANAGER_DESC, s.REGIONAL_MANAGER, s.REGIONAL_MANAGER_DESC, s.SOM, s.SOM_DESC, s.SENIOR_SOM, s.SENIOR_SOM_DESC, s.STORE_OPENING_HOUR, s.STORE_CLOSING_HOUR, s.STORE_LATITUDE, s.STORE_LONGITUDE, DC_STORE_CODE = (from dc in enBi.TEMP_STOREDC where dc.STORE_CODE == s.STORE_CODE select dc.DC_STORE_CODE).FirstOrDefault(), DC_STORE_DESC = (from storeDc in enBi.TEMP_STOREDC join dc in enBi.TEMP_DC on storeDc.DC_STORE_CODE equals dc.DC_STORE_CODE where storeDc.STORE_CODE == s.STORE_CODE select dc.DC_STORE_DESCRIPTION).FirstOrDefault() }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.TEMP_STORE.AsNoTracking().Count(); transList.data = tempStore; return(transList); } }
public TransList getMerch(int pg, int tk) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var tempStore = (from s in enBi.STG_STR_MERCH_DET select new { s.ID , s.STRMRGRP_DATE , s.STORE_CODE , s.PROD_LEVEL1_CODE , s.PROD_LEVEL2_CODE , s.PROD_LEVEL3_CODE , s.PROD_LEVEL4_CODE , s.SELLING_AREA , s.TOTAL_AREA , s.PERMENANT_FTE , s.CONTRACT_FTE , s.OTH_DET1 , s.OTH_DET2 , s.OTH_DET3 , s.OTH_DET4 , s.OTH_DET5 , s.ARC_DATE }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_STR_MERCH_DET.AsNoTracking().Count(); transList.data = tempStore; return(transList); } }
public TransList getFootfall(int pg, int tk, string fnd) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var tempStore = (from s in enBi.STG_STR_FOOTFALL select new { s.FOOTFALL_DATE, s.STORE_CODE, s.FOOTFALL_COUNT, s.ARC_DATE }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_STR_FOOTFALL.AsNoTracking().Count(); transList.data = tempStore; return(transList); } }
public TransList getTarget(int pg, int tk, string fnd) { int skip = tk * (pg - 1); // skip the record TransList transList = new TransList(); using (PRINCE_STGEntities enBi = new PRINCE_STGEntities()) { var target = (from s in enBi.STG_TARGET select new { s.ID, s.TARGET_DATE, s.GEO_LEVEL1_CODE, s.GEO_LEVEL2_CODE, s.GEO_LEVEL3_CODE, s.STORE_CODE, s.PROD_LEVEL1_CODE, s.PROD_LEVEL2_CODE, s.PROD_LEVEL3_CODE, s.PROD_LEVEL4_CODE, s.PROD_LEVEL5_CODE, s.PRODUCT_CODE, s.TARGET_SALE_QTY, s.TARGET_SALE_VAL_AT_PRICE, s.TARGET_SALE_VAL_AT_COST, s.ARC_DATE }) .OrderBy(od => od.STORE_CODE) .Skip(skip) .Take(tk) .ToList(); transList.totalCount = enBi.STG_TARGET.AsNoTracking().Count(); transList.data = target; return(transList); } }
protected void TransLinfo() { //action = Limit.getFormValue("act"); action = Request.QueryString["act"]; if (action == "post") { para += "act=post"; string rr = "", zz = "", jj = "", ii = "", t1 = "", t2 = "", mr = "", mm = "", sr = "", ss = "", zd = "", hd = ""; rr = Request.QueryString["rr"]; //记录数 zz = Request.QueryString["zz"]; //转账人 jj = Request.QueryString["jj"]; //收款人 ii = Request.QueryString["ii"]; //IP地址 t1 = Request.QueryString["t1"]; //查询开始时间 t2 = Request.QueryString["t2"]; //查询结束时间 mr = Request.QueryString["mr"]; //金币判断 mm = Request.QueryString["mm"]; //金币数 sr = Request.QueryString["sr"]; //扣手续费判断 ss = Request.QueryString["ss"]; //扣手续费数 hd = Request.QueryString["hd"]; zd = Request.QueryString["zd"]; /* * string rr, zz, jj, ii, t1, t2, mr, mm, sr, ss; * rr = Limit.editCharacter(Limit.getFormValue("rr")); //记录数 * zz = Limit.editCharacter(Limit.getFormValue("zz")); //转账人 * jj = Limit.editCharacter(Limit.getFormValue("jj")); //收款人 * ii = Limit.editCharacter(Limit.getFormValue("ii")); //IP地址 * t1 = Limit.editCharacter(Limit.getFormValue("t1")); //查询开始时间 * t2 = Limit.editCharacter(Limit.getFormValue("t2")); //查询结束时间 * mr = Limit.editCharacter(Limit.getFormValue("mr")); //金币判断 * mm = Limit.editCharacter(Limit.getFormValue("mm")); //金币数 * sr = Limit.editCharacter(Limit.getFormValue("sr")); //扣手续费判断 * ss = Limit.editCharacter(Limit.getFormValue("ss")); //扣手续费数 * * //Response.Write(mr); * //Response.Write(zz); * //Response.Write(jj); * if (!CommonManager.String.IsInteger(rr)) rr = "0"; * if (!CommonManager.String.IsInteger(t1)) t1 = "0"; * if (!CommonManager.String.IsInteger(t2)) t2 = "0"; * if (!CommonManager.String.IsInteger(mm)) mm = "0"; * if (!CommonManager.String.IsInteger(ss)) ss = "0"; */ if (rr == null || !CommonManager.String.IsInteger(rr)) { rr = "0"; } if (t1 == null || !CommonManager.String.IsInteger(t1)) { //t1 = "0"; CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[划账时间]输入值必须为数字!');location.href='TransSeach.aspx';", false); return; } if (t2 == null || !CommonManager.String.IsInteger(t2)) { //t2 = "0"; CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[划账时间]输入值必须为数字!');location.href='TransSeach.aspx';", false); return; } if (mm == null || !CommonManager.String.IsInteger(mm)) { //mm = "0"; CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[划账金币数]输入值必须为数字!');location.href='TransSeach.aspx';", false); return; } if (ss == null || !CommonManager.String.IsInteger(ss)) { //ss = "0"; CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[扣手续费]输入值必须为数字!');location.href='TransSeach.aspx';", false); return; } if (Convert.ToInt32(t1) > Convert.ToInt32(t2)) { //Alert( "温馨提示:\\n\\n划帐时间,前面输入的数必须小于或等于后面输入的数!", null ); CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[划账时间]前面输入的数必须小于或等于后面输入的数!');location.href='TransSeach.aspx';", false); return; } if (hd != "" && !CommonManager.String.IsInteger(hd)) { CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[划帐人ID]输入值必须为数字!');location.href='TransSeach.aspx';", false); return; } if (zd != "" && !CommonManager.String.IsInteger(zd)) { CommonManager.Web.RegJs(this, "alert('温馨提示:\\n\\n[接收人ID]输入值必须为数字!');location.href='TransSeach.aspx';", false); return; } //Response.End(); //if (rr.ToString() != "0") searchtop = rr; if (zz.ToString() != "") { SqlW = SqlW + " and UserName='******'"; para += "&u=" + zz; } if (jj.ToString() != "") { SqlW = SqlW + " and UserNameZZ='" + jj + "'"; para += "&uz=" + jj; } if (hd.ToString() != "") { SqlW = SqlW + " and UserID='" + hd + "'"; para += "&uz=" + hd; } if (zd.ToString() != "") { SqlW = SqlW + " and DestUserID='" + zd + "'"; para += "&uz=" + zd; } /*if( ii.ToString() != "" ) * { * SqlW = SqlW + " and IP='" + ii + "'"; * para += "&ip=" + ii; * }*/ if (t1.ToString() == "0" && t2.ToString() == "0") { SqlW = SqlW + ""; } else { SqlW = SqlW + " and (datediff(hour,TransTime,getdate())>=" + t1 + " and datediff(hour,TransTime,getdate())<=" + t2 + ")"; para += "&t1=" + t1 + "&t2=" + t2; } if (mr.ToString() == "1") { SqlW = SqlW + " and Money>=" + mm + ""; para += "&m=" + mm; } else { SqlW = SqlW + " and Money<=" + mm + ""; para += "&m=" + mm; } if (sr.ToString() == "1") { SqlW = SqlW + " and Tax>=" + ss + ""; para += "&t=" + ss; } else { SqlW = SqlW + " and Tax<=" + ss + ""; para += "&t=" + ss; } //添加一个始终为真的条件来连接SQL SqlW = " and ID<>0 " + SqlW; //Response.Write(SqlW); titlenames = "转帐搜索记录列表"; } else { //times = Limit.editCharacter(Limit.getFormValue("time")); times = times = Request.QueryString["time"]; if (times == null || times.ToString() == "") { SqlW = ""; para = ""; titlenames = "玩家转账记录列表"; } else if (times != null && times.ToString() == "24") { SqlW = " and datediff(hour,TransTime,getdate())<=" + times + ""; para = "time=" + times + ""; titlenames = "24小时玩家转账记录列表"; } else { Alert("温馨提示:\\n\\n参数传递错误!", null); return; } } DataSet ds = DbSession.Default.FromProc("Web_pGetDataPager") .AddInputParameter("@PageSize", DbType.Int32, anpPageIndex.PageSize) .AddInputParameter("@CurrentPage", DbType.Int32, PageIndex) .AddInputParameter("@Columns", DbType.String, "*") .AddInputParameter("@TableName", DbType.String, "Web_TransLog") .AddInputParameter("@Wheres", DbType.String, SqlW) .AddInputParameter("@KeyName", DbType.String, "ID") .AddInputParameter("@OrderBy", DbType.String, "ID desc") .ToDataSet(); if (ds.Tables.Count > 0 && ds.Tables[1].Rows.Count > 0) { anpPageIndex.RecordCount = (int)ds.Tables[0].Rows[0][0]; anpPageIndex.CurrentPageIndex = PageIndex; TransList.DataSource = ds.Tables[1]; TransList.DataBind(); TransList.Visible = true; NoTransList.Visible = false; } else { this.NoTransList.Visible = true; TransList.Visible = false; } }
//======================================================================================== // public - override //======================================================================================== void Start() { var c = GetComponentsInChildren <RelayPoint>(); TransList.AddRange(c); }