public PartialViewResult AjaxAddProduct(int produktNr, int adressId, DateTime date) { var preAbonnement = new PreAbonnementProdukt { AddressId = adressId, ProduktNr = produktNr, StartDate = date, EndDate = null, DayOfWeek = (int)date.DayOfWeek, Antal = 1, CreatedAt = DateTime.Now, CreatedBy = User.Identity.Name, Interval = 0, Produkt = Produkt.AsQuerable().Where(x => x.ProduktNr == produktNr).FirstOrDefault() }; PreAbonnementRepositry.Insert(preAbonnement); unitOfWork.Commit(); var produkt = unitOfWork.Repository <Produkt>().AsQuerable().FirstOrDefault(x => x.ProduktNr == produktNr); return(PartialView("_UCDelivery", new CustomerDeliveryDetail { CustomerDelivery = CustomerDelivery.CreateInstance(preAbonnement), AddressId = adressId, Date = date })); //{ // Number = 1, // ProduktNumber = produkt.ProduktNr, // Produkt = produkt.Navn, // Id = produkt.Id //}); }
public ItemInput(CustomerDelivery obj, ILog log) { InitializeComponent(); this.customerDelivery = obj; this.log = log; this.count = ParentWindow.CustomerDelivery.ToString(); }
public CDQueryList(CustomerDelivery obj, string keyStr, string WorkMode) { InitializeComponent(); this.customerDelivery = obj; this.keyStr = keyStr; this.WorkMode = WorkMode; }
public CDBDCard(CustomerDelivery obj, float totalAmountValue, string associator_amount) { InitializeComponent(); this.customerDelivery = obj; this.totalAmountValue = totalAmountValue; this.associator_amount = associator_amount; }
/// <summary> /// 重载构造函数 /// </summary> /// <param name="obj"></param> /// <param name="name"></param> public RefuseReason(CustomerDelivery obj, string name, int index) { InitializeComponent(); goodName = name; this.obj = obj; this.index = index; }
private IList <CustomerDeliveryAdresses> MergePreAbonnementDeliveries(IList <CustomerDeliveryAdresses> deliveries, DateTime startDate, DateTime endDate, int kundeId) { //var deliveries = new List<CustomerDeliveryAdresses>(); foreach (var preAbonnement in PreAbonnementRepositry.AsQuerable().Where(p => p.StartDate >= startDate.Date && p.StartDate <= endDate.Date)) { if (deliveries.Any(m => m.AdressId == preAbonnement.AddressId)) { if (deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.Any(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate))) { if (deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.First(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate)) .DeliverDates.Any(l => l.Date.Date == preAbonnement.StartDate)) { if (deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.First(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate)) .DeliverDates.First(l => l.Date.Date == preAbonnement.StartDate) .Deliveries.Any(x => x.ProduktNumber == preAbonnement.ProduktNr)) { deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.First(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate)) .DeliverDates.First(l => l.Date.Date == preAbonnement.StartDate) .Deliveries.First(x => x.ProduktNumber == preAbonnement.ProduktNr).Number += preAbonnement.Antal; preAbonnement.Antal = deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.First(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate)) .DeliverDates.First(l => l.Date.Date == preAbonnement.StartDate) .Deliveries.First(x => x.ProduktNumber == preAbonnement.ProduktNr).Number; PreAbonnementRepositry.Update(preAbonnement); // unitOfWork.Commit(); continue; } deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.First(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate)) .DeliverDates.First(l => l.Date.Date == preAbonnement.StartDate) .Deliveries.Add(CustomerDelivery.CreateInstance(preAbonnement)); } else { deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.First(dw => dw.Week == Helpers.TimeTool.GetWeekNumber(preAbonnement.StartDate)) .DeliverDates.Add(CustomerDeliverDates.CreateInstance(preAbonnement)); } } else { deliveries.First(m => m.AdressId == preAbonnement.AddressId) .DeliveryWeeks.Add(CustomerDeliveryWeek.CreateInstance(preAbonnement)); } } else { deliveries.Add(CustomerDeliveryAdresses.CreateInstance(preAbonnement)); } } return(deliveries.Distinct().ToList()); }
public CDBalance(CustomerDelivery obj, float totalAmountValue, string keyStr, string orderNum) { InitializeComponent(); this.customerDelivery = obj; this.totalAmountValue = totalAmountValue; this.keyStr = keyStr; this.orderNum = orderNum; }
private void customerDeliveryButton_Click(object sender, EventArgs e) { CustomerDelivery customerDelivery = new CustomerDelivery(); customerDelivery.customer += new CustomerDelivery.child_close(this.closethis); customerDelivery.Show();//CustomerDelivery客户提货 this.Hide(); //OrderClearing订单结算 }
public QueryGoods(CustomerDelivery obj, string bar, string num) { this.customerDelivery = obj; this.bar = bar; this.num = num; this.count = ParentWindow.CustomerDelivery.ToString(); if (num.Equals("")) { this.num = "1"; } }
public ScanGood(CustomerDelivery obj, string bar, string num) { InitializeComponent(); this.customerDelivery = obj; this.bar = bar; this.num = num; this.count = ParentWindow.CustomerDelivery.ToString(); if (num.Equals("")) { this.num = "1"; } }
public CDBDetial(CustomerDelivery obj, String branch, float totalAmountValue, string keyStr, string orderNum) { InitializeComponent(); this.customerDelivery = obj; //this.branch = branch; this.totalAmountValue = totalAmountValue; this.keyStr = keyStr; this.orderNum = orderNum; if (branch.Equals("money")) { this.Text = "现金支付"; this.branch = BranchPay.money; } if (branch.Equals("card")) { this.Text = "会员卡支付"; this.branch = BranchPay.card; } }
/// <summary> /// 根据条件获取单个符合条件的订单,会员信息。传入CustomerDelivery页面-退款 /// </summary> /// <param name="searchString"></param> /// <param name="customerDelivery"></param> public void GetReturnOrderInfo(string searchString, CustomerDelivery customerDelivery) { MysqlDBHelper dbHelper = new MysqlDBHelper(); //string sql = "select a.id, a.consignee, a.cansignphone, b.associator_cardnumber, a.ORDERAMOUNT from zc_order_transit a left join zc_associator_info b on a.member_id = b.id where a.orderstatus = '" + Constant.ORDER_STATUS_FININSH + "' "; string sql = "select a.id, a.consignee, a.cansignphone, b.associator_cardnumber, a.ORDERAMOUNT from zc_order_history a left join zc_associator_info b on a.member_id = b.id where a.orderstatus in ('" + Constant.ORDER_STATUS_FININSH + "','" + Constant.ORDER_STATUS_PART_REFUSE + "') "; if (searchString != "") { ///根据条件查询 sql += " and ( a.consignee like '%" + searchString + "%' or a.cansignphone like '%" + searchString + "%' or b.associator_cardnumber like '%" + searchString + "%' ) "; } MySqlConnection conn = null; MySqlCommand cmd = new MySqlCommand(); try { conn = dbHelper.GetConnection(); cmd.Connection = conn; cmd.CommandText = sql; MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { string id = reader.IsDBNull(0) ? string.Empty : reader.GetString(0); string name = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); string phone = reader.IsDBNull(2) ? string.Empty : reader.GetString(2); string card = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); string amount = reader.IsDBNull(4) ? string.Empty : reader.GetString(3); customerDelivery.setinform(id, amount, name, phone, card); } } catch (Exception ex) { log.Error("获取订单信息发送异常", ex); } finally { cmd.Dispose(); dbHelper.CloseConnection(conn); } }
public static IList <CustomerDeliveryAdresses> GetDeliveries(this IRepository <LeveringsProdukt> repository, UnitOfWork unitOfWork, DateTime startDate, DateTime endDate, int kundeId) { var finalProdukter = new List <LeveringsProdukt>(); var deliveries = new List <CustomerDeliveryAdresses>(); startDate = startDate.Date; endDate = endDate.Date; var qleveringer = unitOfWork.Repository <TurLevering>().AsQuerable().Where(l => l.Ture.Dato >= startDate.Date && l.Ture.Dato <= endDate.Date && l.KundeId == kundeId); var leveringMonday = unitOfWork.Repository <TurLevering>().AsQuerable().Max(k => k.Ture.Dato).GetNextMonday().Date; var leveringDateMax = leveringMonday > startDate ? leveringMonday : startDate; if (qleveringer.Any()) { if (qleveringer.Any(l => l.Ture.Dato > leveringDateMax)) { leveringDateMax = qleveringer.Max(l => l.Ture.Dato); } finalProdukter.AddRange(qleveringer.SelectMany(l => l.LeveringProdukts)); } if (qleveringer.Any(l => l.Ture.Dato > leveringDateMax)) { leveringDateMax = qleveringer.Max(l => l.Ture.Dato); } var maxDate = TimeTool.GetDate(DateTime.Now.Year, TimeTool.GetWeekNumber(leveringDateMax), (int)DayOfWeek.Monday).Date; maxDate = maxDate > startDate ? maxDate : startDate; if (leveringDateMax > maxDate.Date) { maxDate = leveringDateMax.Date; } if (maxDate.Date < endDate.Date) { List <Abonnementer> abonnementer = unitOfWork.Repository <Abonnementer>().AsQuerable().Where(t => t.Kunde.Id == kundeId).ToList(); foreach (var tmpway in TimeTool.GetWeekAndYears(maxDate, endDate)) { var ableveringer = abonnementer.GetLeveringerForService(tmpway.Year, tmpway.Week, unitOfWork.Repository <ProductCustomerSpecialPrice>().AsQuerable()); ableveringer.All(abl => { abl.Ture = new Ture() { TurId = abl.Ture.TurId, Week = abl.Ture.Week, Year = abl.Ture.Year, DayOfWeek = abl.Ture.DayOfWeek, Dato = TimeTool.GetDate(abl.Ture.Year, abl.Ture.Week, (int)abl.Ture.DayOfWeek) }; return(true); }); finalProdukter.AddRange(ableveringer.SelectMany(l => l.LeveringProdukts)); } } var produkter = finalProdukter.OrderBy(p => p.TurLevering.Ture.Dato).ThenBy(p => p.Produkt.Navn).ToList(); foreach (var levering in produkter.Where(p => p.TurLevering.Ture.Dato.Date >= startDate.Date && p.TurLevering.Ture.Dato <= endDate.Date)) { if (deliveries.Any(m => m.AdressId == levering.TurLevering.AdresseId)) { if (deliveries.First(m => m.AdressId == levering.TurLevering.AdresseId) .DeliveryWeeks.Any(dw => dw.Week == levering.TurLevering.Ture.Week)) { if (deliveries.First(m => m.AdressId == levering.TurLevering.AdresseId) .DeliveryWeeks.First(dw => dw.Week == levering.TurLevering.Ture.Week) .DeliverDates.Any(l => l.Date.Date == levering.TurLevering.Ture.Dato.Date)) { deliveries.First(m => m.AdressId == levering.TurLevering.AdresseId) .DeliveryWeeks.First(dw => dw.Week == levering.TurLevering.Ture.Week) .DeliverDates.First(l => l.Date.Date == levering.TurLevering.Ture.Dato.Date) .Deliveries.Add(CustomerDelivery.CreateInstance(levering)); } else { deliveries.First(m => m.AdressId == levering.TurLevering.AdresseId) .DeliveryWeeks.First(dw => dw.Week == levering.TurLevering.Ture.Week) .DeliverDates.Add(CustomerDeliverDates.CreateInstance(levering)); } } else { deliveries.First(m => m.AdressId == levering.TurLevering.AdresseId) .DeliveryWeeks.Add(CustomerDeliveryWeek.CreateInstance(levering)); } } else { deliveries.Add(CustomerDeliveryAdresses.CreateInstance(levering)); } } return(deliveries.Distinct().ToList()); }
public Scan(CustomerDelivery obj) { InitializeComponent(); this.customerDelivery = obj; this.count = ParentWindow.CustomerDelivery.ToString(); }
public CDQueryList(CustomerDelivery obj, string keyStr) { InitializeComponent(); this.customerDelivery = obj; this.keyStr = keyStr; }
/// <summary> /// 重载构造函数 /// </summary> /// <param name="customerDelivery"></param> public MemberChoose(CustomerDelivery customerDelivery) { InitializeComponent(); this.customerDelivery = customerDelivery; }
public CDBDMoney(CustomerDelivery obj, float totalAmountValue) { InitializeComponent(); this.customerDelivery = obj; this.totalAmountValue = totalAmountValue; }
/// <summary> /// inserts a Customer into the selected VehiclePath /// </summary> /// <param name="customerId">customer id</param> /// <param name="position">position to insert in the current VehiclePath</param> private void insertCustomer(int customerId, int position) { // gets the current delivery path List <CustomerDelivery> currentPath = plan.paths[selectedPathIndex].customers; if (currentPath.Count == 0) { currentPath = new List <CustomerDelivery>(); } // if -1, add to the end of the path if (position == -1) { position = currentPath.Count; } // check all paths to check if a Customer is selected by another path bool alreadySelected = false; for (int j = 0; j < plan.paths.Count; j++) { for (int i = 0; i < plan.paths[j].customers.Count; i++) { if (plan.paths[j].customers[i].id == customerId) { alreadySelected = true; } } } // if not selected if (!alreadySelected) { // add costomer from the scenario CustomerDelivery customerPath = scenario.getCustomer(customerId).clone(); plan.paths[selectedPathIndex].customers.Insert(position, customerPath); // calculate the path metrics with new inserted node PlanPathCalculation planPathCalculation = new PlanPathCalculation(plan.paths[selectedPathIndex]); planPathCalculation.calculate(); // if valid if (planPathCalculation.isValid()) { string addedposition = ""; try { Address addedAddress = customerPath.address; addedposition += addedAddress.x + "," + addedAddress.z; } catch (Exception e) { Debug.Log(e); } RefreshPaths(); manualPathCapacityRemaining = planPathCalculation.getTotalCapacityRemaining(); manualPathRangeRemaining = planPathCalculation.getTotalRangeRemaining(); debugStr = "Path updated"; Capture.Log("ManualPathAdded;VehicleIndex=" + selectedPathIndex + ";AddedIndex=" + customerId + ";AddedPosition=" + addedposition + ";VehicleTag=" + plan.paths[selectedPathIndex].vehicle.tag + ";" + JsonConvert.SerializeObject(plan) + ";" + planCalculation.getLogString(), Capture.PLANNER); playClick(); } else if (planPathCalculation.getTotalRangeRemaining() < 0) // too long { plan.paths[selectedPathIndex].customers.RemoveAt(position); debugStr = "Path : range to long"; Capture.Log("ManualPathAdded;RangeTooLong", Capture.PLANNER); ShowMsg("Path too long", true); } else if (planPathCalculation.getTotalCapacityRemaining() < 0) // too high of capacity { plan.paths[selectedPathIndex].customers.RemoveAt(position); debugStr = "Path : weight constraint reached"; Capture.Log("ManualPathAdded;PayloadConstraint", Capture.PLANNER); ShowMsg("Path weight too high", true); } else if (planPathCalculation.getTotalTime() > 24.0) // too long in duration { plan.paths[selectedPathIndex].customers.RemoveAt(position); debugStr = "Path : duration to long"; Capture.Log("ManualPathAdded;DurationTooLong", Capture.PLANNER); ShowMsg("Path is longer than 24 h", true); } else if (!planPathCalculation.deliveredFoodinTime()) // food not delivered in time { plan.paths[selectedPathIndex].customers.RemoveAt(position); debugStr = "Path : food not delivered in time"; Capture.Log("ManualPathAdded;FoodTimeConstraint", Capture.PLANNER); ShowMsg("Food is not in time", true); } } else { debugStr = "Customer has delivery"; ShowMsg("Customer has delivery", true); } }