/// <summary> /// /// </summary> /// <returns></returns> public List <Order> All() { var orderDac = new OrderDac(); var result = orderDac.Select(); return(result); }
/// <summary> /// Add method. /// </summary> /// <param name="order"></param> /// <returns></returns> public Order Add(Order order) { double totalprice = 0; foreach (OrderDetail detail in order.Details) { Product p = pdac.SelectById(detail.ProductId); if (p == null) { throw new Exception("Product not found"); } detail.Price = p.Price; totalprice += detail.Quantity * detail.Price; } order.TotalPrice = totalprice; order.CreatedOn = DateTime.Now; order.ChangedOn = DateTime.Now; var orderDac = new OrderDac(); var orderDetailsDac = new OrderDetailDac(); order = orderDac.Create(order); foreach (OrderDetail detail in order.Details) { detail.OrderId = order.Id; detail.CreatedOn = DateTime.Now; detail.ChangedOn = DateTime.Now; orderDetailsDac.Create(detail); } return(order); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public Order Find(int id) { var orderDac = new OrderDac(); var result = orderDac.SelectById(id); var orderDetailsDac = new OrderDetailDac(); result.Details = orderDetailsDac.SelectByOrderId(result.Id); return(result); }
public bool UpdateOneSOMaster(SOMasterVO VO) { OrderDac dac = new OrderDac(); return(dac.UpdateOneSOMaster(VO)); }
public bool AddOneSOMaster(SOMasterVO VO) { OrderDac dac = new OrderDac(); return(dac.AddOneSOMaster(VO)); }
public List <ProductVO> GetProductList() { OrderDac dac = new OrderDac(); return(dac.GetProductList()); }
/// <summary> /// /// </summary> /// <param name="id"></param> public void Remove(int id) { var orderDac = new OrderDac(); orderDac.DeleteById(id); }
public DataTable GetDemandPlan(string firstDate, string endDate, string planID) { OrderDac dac = new OrderDac(); return(dac.GetDemandPlan(firstDate, endDate, planID)); }
public List <DemandPlanVO> GetDemandPlanFromPlanID(string planID) { OrderDac dac = new OrderDac(); return(dac.GetDemandPlanFromPlanID(planID)); }
public int GetPlanIDINSOMaster(string planID) { OrderDac dac = new OrderDac(); return(dac.GetPlanIDINSOMaster(planID)); }
public int SearchPlanIDInDemand(string plan_id) { OrderDac dac = new OrderDac(); return(dac.SearchPlanIDInDemand(plan_id)); }
public DataTable GetMRP(string planID, string firstDate, string endDate) { OrderDac dac = new OrderDac(); return(dac.GetMRP(planID, firstDate, endDate)); }
public bool AddProductionPlan(List <ProductionPlanVO> list) { OrderDac dac = new OrderDac(); return(dac.AddProductionPlan(list)); }
/// <summary> /// /// </summary> /// <param name="order"></param> public void Edit(Order order) { var orderDac = new OrderDac(); orderDac.UpdateById(order); }
public List <DayVO> GetDays(string firstDate, string endDate) { OrderDac dac = new OrderDac(); return(dac.GetDays(firstDate, endDate)); }
public List <string> GetPlanID() { OrderDac dac = new OrderDac(); return(dac.GetPlanID()); }
public int GetMaxUPHCount(string plan_id) { OrderDac dac = new OrderDac(); return(dac.GetMaxUPHCount(plan_id)); }
public List <SOMasterVO> GetSOMaster(string planID) { OrderDac dac = new OrderDac(); return(dac.GetSOMaster(planID)); }
public bool AddSOMaster(List <SOMasterVO> list) { OrderDac dac = new OrderDac(); return(dac.AddSOMaster(list)); }
public bool AddDemandPlan(List <DemandPlanVO> list) { OrderDac dac = new OrderDac(); return(dac.AddDemandPlan(list)); }
public List <SOMasterVO> GetSOMasterAll(WhereSoVO vo) { OrderDac dac = new OrderDac(); return(dac.GetSOMasterAll(vo)); }
// GET: OderPage public ActionResult Index() { OrderPageVO orderpageVo = new OrderPageVO(); OrderDac odac = new OrderDac(); orderpageVo.LastestList = odac.GetLastestOrderList(); OrderDac odac1 = new OrderDac(); orderpageVo.LastestOrderList = odac1.GetLastestOrderDataList(); OrderDac odac2 = new OrderDac(); List <SalesChartVO> ylist = odac2.GetYearSalesChartList(); orderpageVo.YearSalesChartList = odac2.GetYearSalesChartList(); OrderDac odac3 = new OrderDac(); orderpageVo.YearSalesCompanyList = odac3.GetYearSalesCompanyList(); ViewBag.SumTotalPrice = orderpageVo.YearSalesCompanyList.Sum(p => p.totalprice); HomeDac hdac3 = new HomeDac(); List <SalesVO> salesList = hdac3.GetSalesRate(); ViewBag.SalesPrice = string.Format("{0:c}", Convert.ToInt32(salesList[1].price)); ViewBag.SalesList = salesList; ViewBag.SalesRateToView = ((salesList[1].price / salesList[0].price) * 100).ToString("#.0") + "%"; OrderDac odac4 = new OrderDac(); List <SalesVO> costList = odac4.GetWorkCostList(); ViewBag.WorkCostPrice = string.Format("{0:c}", Convert.ToInt32(costList[1].price)); ViewBag.CostList = costList; ViewBag.SalesRateToView = ((salesList[1].price / salesList[0].price) * 100).ToString("#.0") + "%"; string labels = string.Empty; List <List <SalesChartVO> > list = new List <List <SalesChartVO> >(); foreach (var item in orderpageVo.YearSalesCompanyList) { labels += item.s_month + ","; var tlist = (from titem in orderpageVo.YearSalesChartList where titem.s_company == item.s_company select titem).ToList(); list.Add(tlist); } foreach (var item in list) { foreach (var sitem in item) { sitem.s_month = sitem.s_month.Substring(5, 2); } } orderpageVo.YearSalesChartList = ylist; string[] month = new string[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }; int imon = DateTime.Now.Month; string months = string.Empty; for (int i = imon - 1; i < imon + 11; i++) { if (i >= 12) { months += month[i - 12] + ","; } else { if (i == int.Parse(month[i - 1])) { months += month[i] + ","; } } } string data = "["; foreach (var sitem in orderpageVo.YearSalesChartList) { data += sitem.totalprice + ","; } //ViewBag.Labels = months.TrimEnd(','); ViewBag.Labels = months.TrimEnd(','); string[] testmonth = months.TrimEnd(',').Split(','); ViewBag.Label1 = testmonth[0]; ViewBag.Label2 = testmonth[1]; ViewBag.Label3 = testmonth[2]; ViewBag.Label4 = testmonth[3]; ViewBag.Label5 = testmonth[4]; ViewBag.Label6 = testmonth[5]; ViewBag.Label7 = testmonth[6]; ViewBag.Label8 = testmonth[7]; ViewBag.Label9 = testmonth[8]; ViewBag.Label10 = testmonth[9]; ViewBag.Label11 = testmonth[10]; ViewBag.Label12 = testmonth[11]; ViewBag.data1 = data.TrimEnd(',') + "]"; OrderDac odac5 = new OrderDac(); orderpageVo.OrderCostList = odac5.GetOrderCostList(); if (orderpageVo.OrderCostList[1].totalprice < orderpageVo.OrderCostList[0].totalprice) { ViewBag.OrderRate = 100 - @Convert.ToInt32((orderpageVo.OrderCostList[1].totalprice / orderpageVo.OrderCostList[0].totalprice) * 100); } ViewBag.MonthProfit = string.Format("{0:c}", salesList[1].price - orderpageVo.OrderCostList[1].totalprice - costList[1].price); return(View(orderpageVo)); }
public List <CompanyVO> GetCompanyAll(string company_type)//납품업체만 { OrderDac dac = new OrderDac(); return(dac.GetCompanyAll(company_type)); }