public SystemModuleSetMealLevelPrice Edit(SystemModuleSetMealLevelPrice model) { DALBase <SystemModuleSetMealLevelPrice, DataContext> bll = new DALBase <SystemModuleSetMealLevelPrice, DataContext>(); if (model.id == 0) { model = bll.AddReturnModel(model); } else { bll.AddOrUpdate(model); } return(model); }
protected void Page_Load(object sender, EventArgs e) { Service_SystemModuleSetMealLevelPrice.SystemModuleSetMealLevelPriceClient bll = new Service_SystemModuleSetMealLevelPrice.SystemModuleSetMealLevelPriceClient(); int id = GetRequest.GetInt32("id", Method.All, 0); if (Request.HttpMethod.ToLower() == "post") { __Model.id = id; __Model.LevelId = GetRequest.GetInt32("LevelId"); __Model.Price = GetRequest.GetDecimal("Price", Method.Post, 0); __Model.SetMealId = GetRequest.GetInt32("SetMealId"); bll.Edit(__Model); bll.Abort(); bll.Close(); Success(); } else { __Model.SetMealId = GetRequest.GetInt32("setMealId"); if (id > 0) { __Model = bll.Info(id); } Service_PlanAgentLevel.PlanAgentLevelClient levelBll = new Service_PlanAgentLevel.PlanAgentLevelClient(); __LevelList = levelBll.List(); List <int> hasLevelIdArray = new List <int>(); V_SystemModuleSetMealLevel[] levelPriceList = bll.List(__Model.SetMealId); foreach (V_SystemModuleSetMealLevel item in levelPriceList) { if (item.LevelId == __Model.LevelId) { continue; } hasLevelIdArray.Add(item.LevelId); } if (hasLevelIdArray.Count > 0) { int[] hasLevelIds = hasLevelIdArray.ToArray(); //__LevelList.Where(m => !hasLevelIds.Contains<int>(m.id)); __LevelList = __LevelList.Where(m => !hasLevelIds.Contains <int>(m.id)).ToArray(); } bll.Abort(); bll.Close(); } }
protected void Page_Load(object sender, EventArgs e) { Service_Company.CompanyServiceClient companyBll = new Service_Company.CompanyServiceClient(); __IsCompany = companyBll.CompanyValid(LoginCompanyId); //Service_Company.Company companyBll.Abort(); companyBll.Close(); Service_SystemModuleSetMeal.SystemModuleSetMealClient bll = new Service_SystemModuleSetMeal.SystemModuleSetMealClient(); switch (GetRequest.GetRequestValue("action")) { case "pay": string payId = GetRequest.GetRequestValue("id"); decimal sum = 0; string[] payIdArr = payId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); Service_SystemModuleSetMeal.SystemModuleSetMealClient setMealBll = new Service_SystemModuleSetMeal.SystemModuleSetMealClient(); foreach (string item in payIdArr) { SystemModuleSetMeal setMealInfo = setMealBll.Info(Convert.ToInt32(item)); if (setMealInfo == null) { continue; } sum += setMealInfo.Price; } Service_PlanAgentOrder.PlanAgentOrderClient orderBll = new Service_PlanAgentOrder.PlanAgentOrderClient(); PlanAgentOrder orderInfo = new PlanAgentOrder() { CompanyId = LoginCompanyId, Price = sum, RelationId = payId, Sn = string.Format("{0}{1:yyyyMMddHHmmss}", LoginCompanyId, DateTime.Now), State = 0, Type = 1 }; orderBll.Add(orderInfo); orderBll.Abort(); orderBll.Close(); Response.Redirect("SystemModule_GoPay.aspx?sn=" + orderInfo.Sn); break; default: int page = GetRequest.GetInt32("page"); int pageSize = 20; int record = 0; list = bll.ListByEnable(true, page, pageSize, out record); Service_SystemModuleSetMealLevelPrice.SystemModuleSetMealLevelPriceClient levelBll = new Service_SystemModuleSetMealLevelPrice.SystemModuleSetMealLevelPriceClient(); foreach (SystemModuleSetMeal item in list) { SystemModuleSetMealLevelPrice levelPriceInfo = levelBll.InfoByLevel(item.id, __PlanAgent.LevelId == null?0:((int)__PlanAgent.LevelId)); if (levelPriceInfo != null) { item.Price = levelPriceInfo.Price; } } Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient setMealDetialBll = new Service_SystemModuleSetMealDetail.SystemModuleSetMealDetailClient(); Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient logBll = new Service_SystemModuleSetMealValidityLog.SystemModuleSetMealValidityLogClient(); __logList = logBll.ListByCompany(LoginCompanyId); foreach (SystemModuleSetMeal item in list) { item.ModuleList = setMealDetialBll.List(item.id); SystemModuleSetMealValidityLog[] currentLog = __logList.Where(m => m.SetMealId == item.id).ToArray(); if (currentLog.Length > 0) //已购买 { if (currentLog.Where(m => m.ValidityDateEnd > DateTime.Now).ToArray().Length > 0) //未过期 { item.OverDate = currentLog.Where(m => m.ValidityDateEnd > DateTime.Now).OrderByDescending(m => m.ValidityDateEnd).ToArray()[0].ValidityDateEnd; item.CompanyState = 0; } else //已过期 { item.OverDate = currentLog.OrderByDescending(m => m.ValidityDateEnd).ToArray()[0].ValidityDateEnd; item.CompanyState = 1; } } else { item.CompanyState = -1; } } levelBll.Abort(); levelBll.Close(); Pager = InitPageView(page, record); bll.Abort(); bll.Close(); break; } }