Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public List <Order> All()
        {
            var orderDac = new OrderDac();
            var result   = orderDac.Select();

            return(result);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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);
        }
Example #4
0
        public bool UpdateOneSOMaster(SOMasterVO VO)
        {
            OrderDac dac = new OrderDac();

            return(dac.UpdateOneSOMaster(VO));
        }
Example #5
0
        public bool AddOneSOMaster(SOMasterVO VO)
        {
            OrderDac dac = new OrderDac();

            return(dac.AddOneSOMaster(VO));
        }
Example #6
0
        public List <ProductVO> GetProductList()
        {
            OrderDac dac = new OrderDac();

            return(dac.GetProductList());
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        public void Remove(int id)
        {
            var orderDac = new OrderDac();

            orderDac.DeleteById(id);
        }
Example #8
0
        public DataTable GetDemandPlan(string firstDate, string endDate, string planID)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetDemandPlan(firstDate, endDate, planID));
        }
Example #9
0
        public List <DemandPlanVO> GetDemandPlanFromPlanID(string planID)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetDemandPlanFromPlanID(planID));
        }
Example #10
0
        public int GetPlanIDINSOMaster(string planID)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetPlanIDINSOMaster(planID));
        }
Example #11
0
        public int SearchPlanIDInDemand(string plan_id)
        {
            OrderDac dac = new OrderDac();

            return(dac.SearchPlanIDInDemand(plan_id));
        }
Example #12
0
        public DataTable GetMRP(string planID, string firstDate, string endDate)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetMRP(planID, firstDate, endDate));
        }
Example #13
0
        public bool AddProductionPlan(List <ProductionPlanVO> list)
        {
            OrderDac dac = new OrderDac();

            return(dac.AddProductionPlan(list));
        }
Example #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="order"></param>
        public void Edit(Order order)
        {
            var orderDac = new OrderDac();

            orderDac.UpdateById(order);
        }
Example #15
0
        public List <DayVO> GetDays(string firstDate, string endDate)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetDays(firstDate, endDate));
        }
Example #16
0
        public List <string> GetPlanID()
        {
            OrderDac dac = new OrderDac();

            return(dac.GetPlanID());
        }
Example #17
0
        public int GetMaxUPHCount(string plan_id)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetMaxUPHCount(plan_id));
        }
Example #18
0
        public List <SOMasterVO> GetSOMaster(string planID)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetSOMaster(planID));
        }
Example #19
0
        public bool AddSOMaster(List <SOMasterVO> list)
        {
            OrderDac dac = new OrderDac();

            return(dac.AddSOMaster(list));
        }
Example #20
0
        public bool AddDemandPlan(List <DemandPlanVO> list)
        {
            OrderDac dac = new OrderDac();

            return(dac.AddDemandPlan(list));
        }
Example #21
0
        public List <SOMasterVO> GetSOMasterAll(WhereSoVO vo)
        {
            OrderDac dac = new OrderDac();

            return(dac.GetSOMasterAll(vo));
        }
Example #22
0
        // 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));
        }
Example #23
0
        public List <CompanyVO> GetCompanyAll(string company_type)//납품업체만
        {
            OrderDac dac = new OrderDac();

            return(dac.GetCompanyAll(company_type));
        }