Пример #1
0
        public ActionResult OrderRecord(OrderModel model)
        {
            var pageIndex = Request.QueryString["pageindex"];
            int index     = 0;
            int pageSize  = 10;

            Int32.TryParse(pageIndex, out index);
            if (index == 0)
            {
                index = 1;
            }
            var UserInfo = NFine.Code.OperatorProvider.Provider.GetCurrent();

            if (UserInfo == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            OrderModel viewModel = new OrderModel();

            if (base.agentInfo != null)
            {
                CommLogic.DeepClone <AgentInfoModel>(viewModel, agentInfo);
                List <Order> list = OrderLogic.GetList().Where(t => t.c_agent_id == agentInfo.agent.c_id).ToList();
                viewModel.orderList            = new PagerResult <Order>();
                viewModel.orderList.DataList   = list.OrderByDescending(t => t.F_CreatorTime).Skip <Order>((index - 1) * pageSize).Take(pageSize);
                viewModel.orderList.Code       = 0;
                viewModel.orderList.Total      = list.Count();
                viewModel.orderList.PageIndex  = index;
                viewModel.orderList.PageSize   = pageSize;
                viewModel.orderList.RequestUrl = "Index?pageindex=" + index;
            }
            return(View(viewModel));
        }
Пример #2
0
        public OrderLogicTest()
        {
            var unitMocked = new OrderRepositoryMocked();

            _unitMocked = unitMocked.GetInstance();
            _orderLogic = new OrderLogic(_unitMocked);
        }
Пример #3
0
        public ActionResult DelOrderDetail(string DetailId)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                var detail = OrderDetailLogic.GetEnityById(DetailId);
                if (detail != null)
                {
                    string orderId = detail.c_order_id;
                    OrderDetailLogic.DeleteEntity(DetailId);

                    if (!string.IsNullOrEmpty(orderId))
                    {
                        var list = OrderDetailLogic.GetList().Where(t => t.c_order_id == orderId);
                        if (list.Count() == 0)
                        {
                            OrderLogic.DeleteEntity(orderId);
                        }
                    }
                }
                result.state   = ResultType.success.ToString();
                result.message = "成功";

                return(Content(result.ToJson()));
            }
            catch (Exception ex)
            {
                result.state   = ResultType.error.ToString();
                result.message = string.Format("({0})", ex.Message);
                return(Content(result.ToJson()));

                throw;
            }
        }
Пример #4
0
        public void TestDeleteSingle()
        {
            OrderLogic logic = new OrderLogic();

            try
            {
                OrderBinding model1 = new OrderBinding {
                    Id = 1, OrderProducts = new List <OrderProductBinding>()
                };
                OrderBinding model2 = new OrderBinding {
                    Id = 2, OrderProducts = new List <OrderProductBinding>()
                };
                logic.Create(model1);
                logic.Create(model2);
                logic.Delete(model1);

                List <OrderView> list = logic.Read(null);

                Assert.Single(list);
                Assert.Equal(2, list[0].Id);
            }
            finally
            {
                logic.Delete(null);
            }
        }
Пример #5
0
        //维修记录添加
        public int repairLogAdd(String startTime, String endTime, String workDetail, String defaultCharacter, String workTime, String orderId)
        {
            OrderLogic orderLogic     = new OrderLogic();
            int        permissionFlag = orderLogic.orderOperatePermission(orderId, Convert.ToInt16(Session["userId"]), Convert.ToInt16(Session["userType"]));

            if (permissionFlag != 1)
            {
                return(permissionFlag);
            }

            DateTime?startDateTime = null;
            DateTime?endDateTime   = null;

            if (startTime.Trim().Length > 0)
            {
                startDateTime = DateTime.Parse(startTime);
            }

            if (endTime.Trim().Length > 0)
            {
                endDateTime = DateTime.Parse(endTime);
            }

            return(orderLogic.repairLogAdd(startDateTime, endDateTime, workDetail, defaultCharacter, workTime, orderId));
        }
Пример #6
0
        public void TestCreateWithOrderProducts()
        {
            OrderLogic   logicO = new OrderLogic();
            ProductLogic logicP = new ProductLogic();

            try
            {
                OrderBinding model = new OrderBinding {
                    Id = 1, OrderProducts = new List <OrderProductBinding>()
                };
                model.OrderProducts.Add(new OrderProductBinding {
                    Count = 10, ProductId = 1
                });
                model.OrderProducts.Add(new OrderProductBinding {
                    Count = 13, ProductId = 2
                });
                logicP.Create(new ProductBinding {
                    Id = 1, Name = "0", Price = 10
                });
                logicP.Create(new ProductBinding {
                    Id = 2, Name = "1", Price = 5
                });
                logicO.Create(model);

                List <OrderView> list = logicO.Read(null);

                Assert.Equal(2, list[0].OrderProducts.Count);
                Assert.Equal(5, list[0].OrderProducts[1].Price);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
Пример #7
0
        public void TestOrderProductPrice()
        {
            OrderLogic   logicO = new OrderLogic();
            ProductLogic logicP = new ProductLogic();

            try
            {
                ProductBinding product = new ProductBinding {
                    Name = "Test", Price = 20
                };
                OrderBinding order = new OrderBinding {
                    OrderProducts = new List <OrderProductBinding>()
                };
                order.OrderProducts.Add(new OrderProductBinding {
                    ProductId = 1, Count = 2
                });
                logicP.Create(product);
                logicO.Create(order);

                List <OrderView> list = logicO.Read(null);

                Assert.Equal(20, list[0].OrderProducts[0].Price);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
Пример #8
0
        public void TestCreateSeveralOPWithSameProductId()
        {
            OrderLogic   logicO = new OrderLogic();
            ProductLogic logicP = new ProductLogic();

            try
            {
                OrderBinding model = new OrderBinding {
                    OrderProducts = new List <OrderProductBinding>()
                };
                model.OrderProducts.Add(new OrderProductBinding {
                    ProductId = 1, Count = 3
                });
                model.OrderProducts.Add(new OrderProductBinding {
                    ProductId = 1, Count = 2
                });
                logicP.Create(new ProductBinding {
                    Id = 1
                });
                logicO.Create(model);

                List <OrderView> list = logicO.Read(null);

                Assert.Single(list[0].OrderProducts);
                Assert.Equal(1, list[0].OrderProducts[0].ProductId);
                Assert.Equal(5, list[0].OrderProducts[0].Count);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
Пример #9
0
        public void TestDeleteOrderProducts()
        {
            OrderLogic   logicO = new OrderLogic();
            ProductLogic logicP = new ProductLogic();

            try
            {
                OrderBinding model1 = new OrderBinding {
                    Id = 1, OrderProducts = new List <OrderProductBinding>()
                };
                model1.OrderProducts.Add(new OrderProductBinding {
                    ProductId = 1
                });
                logicP.Create(new ProductBinding());
                logicO.Create(model1);
                logicO.Delete(model1);
                OrderBinding model2 = new OrderBinding {
                    Id = 1, OrderProducts = new List <OrderProductBinding>()
                };
                model2.OrderProducts.Add(new OrderProductBinding {
                    ProductId = 1
                });
                logicO.Create(model2);

                List <OrderView> list = logicO.Read(null);

                Assert.Single(list[0].OrderProducts);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
Пример #10
0
        private void OrderList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (OrderList.SelectedCells.Count > 0)
                {
                    MessageBoxResult message = MessageBox.Show("Вы уверены, что хотите взять этот заказ?", "Подтверждение заказа", MessageBoxButton.YesNo);
                    if (message == MessageBoxResult.Yes)
                    {
                        OrderModel order = new OrderModel()
                        {
                            IdOrder = Convert.ToInt32(dt.Rows[OrderList.SelectedIndex].ItemArray[0])
                        };

                        OrderLogic.SelectOrder(order);
                        MessageBox.Show("Заказ успешно принят!");

                        MasterMainWindow master = new MasterMainWindow();
                        master.Show();
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #11
0
        public ActionResult AddProToCard(string productId, int Amount, int Price)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                string      agentId = agentInfo.agent.c_id;
                string      OrderId = OrderLogic.GetNopayOrderByAgentId(agentId);
                OrderDetail detail  = new OrderDetail();
                detail.F_CreatorUserId = agentId;
                detail.c_product_id    = productId;
                detail.c_amount        = Amount;
                detail.c_total         = Amount * Price;
                detail.c_order_id      = OrderId;
                OrderDetailLogic.InsertNewEntiy(detail);
                result.state   = ResultType.success.ToString();
                result.message = "成功";
                return(Content(result.ToJson()));
            }
            catch (Exception ex)
            {
                result.state   = ResultType.error.ToString();
                result.message = string.Format("提交失败({0})", ex.Message);
                return(Content(result.ToJson()));

                throw;
            }
        }
Пример #12
0
 public ShoppingController()
 {
     context            = new ShoppingCartDBEntities1();
     shoppingCartModels = new List <ShoppingCartModel>();
     _shoppingLogic     = new ShoppingLogic();
     _OrderLogic        = new OrderLogic();
 }
Пример #13
0
        public async Task <IActionResult> CreateAdd([Bind("Id,ProductId,CustomerId,Quantity,Timestamp")] Order order)
        {
            var check    = new OrderLogic();
            var products = new ProductRepo();

            if (ModelState.IsValid && check.IsWithinInventory(products.GetInventory(_context, order.ProductId), order.Quantity))
            {
                try
                {
                    products.UpdateInventory(_context, order.ProductId, order.Quantity);
                    _context.Add(order);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception ex)
                {
                    _logger.LogInformation(ex, "Something in the order wasn't able to be added");
                }
            }
            var repo = new OrderRepo();

            ViewData["ProductInfo"] = repo.ProductList(_context);
            return(View(order));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));

        if (!(e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
        {
            OrderLogic ol = new OrderLogic();
            Order      o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));;

            if (o1 != null)
            {
                ProductLogic pl = new ProductLogic();
                Product      p1 = pl.SelectByProductID(o1.ProductID);
                Label1.Text  = p1.Name;
                Label2.Text  = o1.QuotationID.ToString();
                Label3.Text  = o1.Quantity.ToString();
                Label4.Text  = o1.Rate.ToString();
                Label5.Text  = o1.PONumber.ToString();
                Label6.Text  = o1.PODate.ToString("dd/MM/yyyy");
                Label7.Text  = o1.CreateDate.ToString("dd/MM/yyyy");
                Label8.Text  = o1.Status;
                Label9.Text  = o1.StatusRemarks;
                Label10.Text = o1.DeliveryAddress;
                Label11.Text = o1.DeliveryDate.ToString("dd/MM/yyyy");
                String oo = o1.AttachPO;
                lnkImage1.Text        = oo.Substring(25);
                lnkImage1.NavigateUrl = oo;
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
 public OrderGroupWindow(GroupLogic logicG, OrderLogic logicO)
 {
     InitializeComponent();
     this.logic  = logicO;
     this.logicG = logicG;
     logger      = LogManager.GetCurrentClassLogger();
 }
Пример #16
0
        private void NewOrder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OrderModel NewOrder = new OrderModel()
                {
                    IdDevice           = DeviceLogic.GetIdDevice(dt.Rows[DeviceList.SelectedIndex].ItemArray[0].ToString()),
                    IdClient           = SecurityContext.IdUser,
                    DateOrder          = DateTime.Today,
                    ProblemDescription = ProblemDescription.Text,
                    SelectedService    = (Service.SelectedIndex + 1),
                    StageOrder         = 1
                };



                OrderLogic.SaveOrder(NewOrder);
                MessageBox.Show("Заказ успешно оформлен");

                ListOrdersWindow listOrdersWindow = new ListOrdersWindow();
                listOrdersWindow.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #17
0
        private void OnTimedEventStatus(Object source, System.Timers.ElapsedEventArgs e)
        {
            //sets the interval to check the database every 15 seconds
            orderStatusTimer.Interval = 5000;

            //reload database data
            try {
                tables = tableLogic.GetAllTables();
            } catch {
                MessageBox.Show("Problem loading tables from database. Please try again.");
            }

            try {
                OrderLogic orderLogic = new OrderLogic();
                orders = orderLogic.Get_Orders_By_Date(DateTime.Today);
            } catch {
                MessageBox.Show("Problem loading orders from database. Please try again.");
            }

            //ESSENTIAL: excutes both methods on the main thread
            Invoke((MethodInvoker) delegate {
                SetTableColors();
                CheckOrdersStatusses(orders);
            });
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            EmployeeLogic el = new EmployeeLogic();
            Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
            if (e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
            {
                OrderLogic ol = new OrderLogic();

                DataTable dt = ol.SelectJob(Convert.ToInt32(Request.QueryString["ID"]));
                Label12.Text = dt.Rows[0]["CustomerName"].ToString();
                Label14.Text = dt.Rows[0]["JobName"].ToString();
                Label13.Text = dt.Rows[0]["PONumber"].ToString();
                Label15.Text = Convert.ToDateTime(dt.Rows[0]["PODate"]).ToString("dd/MM/yyyy");
                Label11.Text = DateTime.Now.ToString("dd/MM/yyyy");
                Label16.Text = Convert.ToDateTime(dt.Rows[0]["DeliveryDate"]).ToString("dd/MM/yyyy");
                Label17.Text = dt.Rows[0]["Quantity"].ToString();
            }
            else
            {
                Response.Redirect("Access.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
         EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (!(e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
        {
            OrderLogic ol = new OrderLogic();
            Order o1=ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));;

            if (o1 != null)
            {
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(o1.ProductID);
                Label1.Text = p1.Name;
                Label2.Text = o1.QuotationID.ToString();
                Label3.Text = o1.Quantity.ToString();
                Label4.Text = o1.Rate.ToString();
                Label5.Text = o1.PONumber.ToString();
                Label6.Text = o1.PODate.ToString("dd/MM/yyyy");
                Label7.Text = o1.CreateDate.ToString("dd/MM/yyyy");
                Label8.Text = o1.Status;
                Label9.Text = o1.StatusRemarks;
                Label10.Text = o1.DeliveryAddress;
                Label11.Text = o1.DeliveryDate.ToString("dd/MM/yyyy");
                String oo = o1.AttachPO;
                lnkImage1.Text = oo.Substring(25);
                lnkImage1.NavigateUrl = oo;
            
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }      
     }
    protected void Button1_Click(object sender, EventArgs e)
    {
        OrderLogic ol = new OrderLogic();
        DateTime   d1 = new DateTime();
        DateTime   d2 = new DateTime();

        if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
        {
            d1 = DateTime.Now.AddYears(-100);
        }

        if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
        {
            d2 = DateTime.Now.AddYears(10);
        }
        DataTable dt = ol.Search(Convert.ToInt32(DropDownList1.SelectedItem.Value), Convert.ToInt32(DropDownList2.SelectedItem.Value), d1, d2);

        Repeater1.DataSource = dt;
        Repeater1.DataBind();
        if (dt.Rows.Count == 0)
        {
            Table1.Visible = false;
            Label1.Visible = true;
        }
        else
        {
            Table1.Visible = true;
            Label1.Visible = false;
        }
    }
Пример #21
0
        public string GetOrders()
        {
            var logic = new OrderLogic();
            var json  = JsonConvert.SerializeObject(logic.GetOrders());

            return(json);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            EmployeeLogic el = new EmployeeLogic();
            Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
            if (e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
            {
                OrderLogic ol = new OrderLogic();

                DataTable dt = ol.SelectJob(Convert.ToInt32(Request.QueryString["ID"]));
                Label12.Text = dt.Rows[0]["CustomerName"].ToString();
                Label14.Text = dt.Rows[0]["JobName"].ToString();
                Label13.Text = dt.Rows[0]["PONumber"].ToString();
                Label15.Text = Convert.ToDateTime(dt.Rows[0]["PODate"]).ToString("dd/MM/yyyy");
                Label11.Text = DateTime.Now.ToString("dd/MM/yyyy");
                Label16.Text = Convert.ToDateTime(dt.Rows[0]["DeliveryDate"]).ToString("dd/MM/yyyy");
                Label17.Text = dt.Rows[0]["Quantity"].ToString();

            }
            else
            {
                Response.Redirect("Access.aspx");
            }
        }
    }
Пример #23
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Charset     = "utf-8";

            HttpPostedFile file       = context.Request.Files["Filedata"];
            String         orderId    = @context.Request["orderId"];
            String         uploadPath = HttpContext.Current.Server.MapPath("uploads\\" + orderId) + "\\";

            if (file != null && file.ContentLength <= 2097152)
            {
                if (!Directory.Exists(uploadPath))
                {
                    Directory.CreateDirectory(uploadPath);
                }
                file.SaveAs(uploadPath + file.FileName);
                OrderLogic orderLogic = new OrderLogic();
                orderLogic.imageAdd("/uploads/" + orderId + "/" + file.FileName, orderId);

                context.Response.Write("1");
            }
            else
            {
                context.Response.Write("0");
            }
        }
Пример #24
0
        public ActionResult GetOrderDetail(int ID, int DispatchID)
        {
            var order = OrderLogic.GetOrderByID(ID).FirstOrDefault();

            ViewBag.Parties    = PartyLogic.GetPartyByID(order.PartyID);
            ViewBag.Transports = TransportLogic.GetTransportByID(0);
            ViewBag.Products   = ProductLogic.GetFinishedProducts();
            ViewBag.Addresses  = PartyAddressLogic.GetPartyAddress(order.PartyID);
            var dispatch = new Dispatch();

            if (DispatchID == 0)
            {
                dispatch.DONo   = DispatchLogic.GetMaxDispatchNo();
                dispatch.DODate = DateTime.Now;
            }
            else
            {
                dispatch = DispatchLogic.GetDispatchByID(DispatchID).FirstOrDefault();
            }
            dispatch.order   = order;
            dispatch.details = DispatchLogic.GetDispatchDetail(DispatchID, order.ID);
            if (DispatchID > 0)
            {
                dispatch.order.PartyID           = dispatch.PartyID;
                dispatch.order.DeliveryAddressID = dispatch.DeliveryAddressID;
                dispatch.order.TransportID       = dispatch.TransportID;
                dispatch.order.BookingAt         = dispatch.BookingAt;
            }
            return(PartialView("_DispatchDetails", dispatch));
        }
Пример #25
0
 public void SetUp()
 {
     orderDB    = new OrderDB(connectionString);
     productDB  = new ProductDB(connectionString);
     customerDB = new CustomerDB(connectionString);
     orderLogic = new OrderLogic(connectionString);
 }
 public OrderWindow(OrderLogic logic, StudentLogic logicS)
 {
     InitializeComponent();
     this.logic  = logic;
     this.logicS = logicS;
     logger      = LogManager.GetCurrentClassLogger();
 }
Пример #27
0
        public ActionResult OrderRegister(DateTime?FromDate, DateTime?ToDate, string PartyID, string ProductID, string ShadeID, string PackingID)
        {
            var orders = OrderLogic.GetOrderByID(0);

            if (FromDate.HasValue)
            {
                orders = orders.Where(x => x.OrderDate >= FromDate.Value);
            }
            if (ToDate.HasValue)
            {
                orders = orders.Where(x => x.OrderDate <= ToDate.Value);
            }
            if (!string.IsNullOrEmpty(PartyID))
            {
                orders = orders.Where(x => x.PartyID == Convert.ToInt32(PartyID));
            }
            if (!string.IsNullOrEmpty(ProductID))
            {
                orders = orders.Where(x => x.orderDetail.Where(y => y.ProductID == Convert.ToInt32(ProductID)).Count() > 0);
            }
            if (!string.IsNullOrEmpty(ShadeID))
            {
                orders = orders.Where(x => x.orderDetail.Where(y => y.ShadeID == Convert.ToInt32(ShadeID)).Count() > 0);
            }
            if (!string.IsNullOrEmpty(PackingID))
            {
                orders = orders.Where(x => x.orderDetail.Where(y => y.PackingID == Convert.ToInt32(PackingID)).Count() > 0);
            }
            return(PartialView("_OrderRegisterDetail", orders.OrderBy(x => x.OrderDate)));
        }
        public void Multiple_Orders_Saved_In_Customer()
        {
            DbContextOptions <P1_DbContext> options = new DbContextOptionsBuilder <P1_DbContext>()
                                                      .UseInMemoryDatabase(databaseName: "Add_Writes_To_Db").Options;

            using (P1_DbContext context = new P1_DbContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                P1_Repo repo = new P1_Repo(context);
                DefaultAddItemsToContext(context);
                DefaultInitContext(context);
                repo.Init();
                repo.SubmitOrder(location_A, customer_A);
                repo.SubmitOrder(location_A, customer_A);
                context.SaveChanges();
            }

            using (P1_DbContext context = new P1_DbContext(options))
            {
                P1_Repo    repo  = new P1_Repo(context);
                OrderLogic logic = new OrderLogic(repo, new HttpContextAccessor());
                Assert.AreEqual(2, logic.FetchCustomerOrders(1, customer_A).Count());
            }
        }
Пример #29
0
 public Order()
 {
     InitializeComponent();
     _orderLogic  = new OrderLogic();
     _cultureInfo = new CultureInfo(Resources.CultureInfo_Message);
     Init();
 }
Пример #30
0
        public void TestMethodSaveCreatedOrder()
        {
            string          message = "";
            OrderLogic      logicO  = new OrderLogic();
            ProductLogic    logicP  = new ProductLogic();
            OrderPageDriver driver  = new OrderPageDriver(new UiContext(logicO, logicP), null);

            driver.ShowInfoMessage = (msg) => { message = msg; };

            try
            {
                logicP.Create(new ProductBinding {
                    Price = 10
                });
                driver.MoveToOrderProductPage = (context, order, orderProduct) => order.OrderProducts.Add(new OrderProductView {
                    ProductId = 1
                });
                driver.AddOrderProduct();
                driver.AddOrderProduct();
                driver.AddOrderProduct();

                bool             result = driver.SaveOrder();
                List <OrderView> list   = logicO.Read(null);

                Assert.True(result);
                Assert.Single(list);
                Assert.Single(list[0].OrderProducts);
                Assert.Equal("Order was created", message);
            }
            finally
            {
                logicO.Delete(null);
                logicP.Delete(null);
            }
        }
Пример #31
0
        public void TestMethodDelete()
        {
            string           message    = "";
            OrderLogic       orderLogic = new OrderLogic();
            OrdersPageDriver driver     = new OrdersPageDriver(new UiContext(new OrderLogic(), new ProductLogic()));

            driver.ShowInfoMessage = (msg) => { message = msg; };

            try
            {
                orderLogic.Create(new OrderBinding {
                    OrderProducts = new List <OrderProductBinding>()
                });
                orderLogic.Create(new OrderBinding {
                    OrderProducts = new List <OrderProductBinding>()
                });
                orderLogic.Create(new OrderBinding {
                    OrderProducts = new List <OrderProductBinding>()
                });
                driver.SelectedOrder = () => orderLogic.Read(null)[1];

                driver.DeleteOrder();
                List <OrderView> list = driver.GetAllOrders();

                Assert.Equal(2, list.Count);
                Assert.Equal(1, list[0].Id);
                Assert.Equal(3, list[1].Id);
                Assert.Equal("Order №2 was deleted", message);
            }
            finally
            {
                orderLogic.Delete(null);
            }
        }
Пример #32
0
 public FormCreateOrder(CarLogic logicF, CustomerLogic logicO, EmployeeLogic logicC, OrderLogic or)
 {
     InitializeComponent();
     _logicC     = logicF;
     _logicP     = logicO;
     _logicE     = logicC;
     _logicOrder = or;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
         EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        
            if (!IsPostBack)
            {
                if (!(e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
                {
                OrderLogic OL = new OrderLogic();
                DataTable dt = OL.SelectAllJoined();
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }

                CustomerLogic cl = new CustomerLogic();
                DataTable dt1 = cl.SelectAll();
                dt1.Rows.Add(0, "All Customer", null, null, null, null, null, null, null, null, null);
                dt1.DefaultView.Sort = "CustomerID";
                DropDownList1.DataSource = dt1;
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "CustomerID";
                DropDownList1.DataBind();
                DropDownList1.SelectedItem.Text = "All Customer";

                ProductLogic pl = new ProductLogic();
                DataTable dt2 = pl.SelectAll();
                dt2.Rows.Add(0, "All Product", null, null, null, null, null, null, null, null);
                dt2.DefaultView.Sort = "ProductID";
                DropDownList2.DataSource = dt2;
                DropDownList2.DataTextField = "Name";
                DropDownList2.DataValueField = "ProductID";
                DropDownList2.DataBind();
                DropDownList2.SelectedItem.Text = "All Product";
            }
                else
                {
                    Response.Redirect("Access.aspx");
                }
        }
        
    }
 protected void btnUpload_OnClick(object sender, EventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o = ol.SelectByID(Convert.ToInt32(Request.QueryString["ID"])); ;
     string path;
     string ticks = DateTime.Now.Ticks.ToString();
     if (FileUpload1.HasFile)
     {
         FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
         path = "Images/" + ticks + FileUpload1.FileName;
         o.JobPath = path;
         ol.Update(o);
     }
 }
    protected void LinkButton1_Command(object sender, CommandEventArgs e)
    {
         EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
        {
            OrderLogic ol = new OrderLogic();
            Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
            if (o1 != null)
            {
                int i = ol.Delete(o1.OrderID);

                Response.Redirect("OrderList.aspx");

            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }

    }
Пример #36
0
 public OrdersController(OrderLogic stub)
 {
     db = stub;
 }
Пример #37
0
        public ApiModule()
            : base("/api")
        {
            #region  ///  Help Page  ///
            Get["/help"] = x => View["help"];
            #endregion

            #region  ///  Category  ///

            #region  ///  /api/Categories/  ///
            Get["/categories"] = x =>
            {
                var logic = new CategoryLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Categories/1234  ///
            Get["/categories/{id:int}"] = x =>
            {
                var logic = new CategoryLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Customer  ///

            #region  ///  /api/Customers/  ///
            Get["/customers"] = x =>
            {
                var logic = new CustomerLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Customers/1234  ///
            Get["/customers/{id*}"] = x =>
            {
                var logic = new CustomerLogic();

                var result = logic.GetById((string)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Employee  ///

            #region  ///  /api/employees  ///
            Get["/employees"] = x =>
            {
                var logic = new EmployeeLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  ///  /api/employees/1234  ///
            Get["/employees/{id:int}"] = x =>
            {
                var logic = new EmployeeLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Order  ///

            #region  ///  /api/Orders/  ///
            Get["/orders"] = x =>
            {
                var logic = new OrderLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Orders/1234  ///
            Get["/orders/{id:int}"] = x =>
            {
                var logic = new OrderLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Product  ///

            #region  ///  /api/Products/  ///
            Get["/products"] = x =>
            {
                var logic = new ProductLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Products/1234  ///
            Get["/products/{id:int}"] = x =>
            {
                var logic = new ProductLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Region  ///

            #region  ///  /api/Regions/  ///
            Get["/regions"] = x =>
            {
                var logic = new RegionLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Regions/1234  ///
            Get["/regions/{id:int}"] = x =>
            {
                var logic = new RegionLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Shipper  ///

            #region  ///  /api/Shippers/  ///
            Get["/shippers"] = x =>
            {
                var logic = new ShipperLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Shippers/1234  ///
            Get["/shippers/{id:int}"] = x =>
            {
                var logic = new ShipperLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Supplier  ///

            #region  ///  /api/Suppliers/  ///
            Get["/suppliers"] = x =>
            {
                var logic = new SupplierLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Suppliers/1234  ///
            Get["/suppliers/{id:int}"] = x =>
            {
                var logic = new SupplierLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Territory  ///

            #region  ///  /api/Territories/  ///
            Get["/territories"] = x =>
            {
                var logic = new TerritoryLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Territories/1234  ///
            Get["/territories/{id:string}"] = x =>
            {
                var logic = new TerritoryLogic();

                var result = logic.GetById((string)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion
        }
Пример #38
0
 public CheckoutController(OrderLogic stubOrder, ShoppingCartLogic stubCart)
 {
     db = stubOrder;
     cartBLL = stubCart;
 }
Пример #39
0
 public OrdersController()
 {
     db = new OrderBLL();
 }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        OrderLogic pl = new OrderLogic();
        Order o1 = pl.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

        o1.AttachPO = "";
        pl.Update(o1);
        Response.Redirect("OrderList.aspx");

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Request.QueryString["ID"]) > 0)
        {
            //edit mode
            if (Convert.ToInt32(TextBox1.Text) > 0)
            {
            OrderLogic ol = new OrderLogic();
            Order o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

            ProductLogic pl = new ProductLogic();
            Product p1 = pl.SelectByProductID(o1.ProductID);
            // = Convert.ToInt32(DropDownList1.SelectedValue) 

           
                o1.ProductID = Convert.ToInt32(DropDownList1.SelectedItem.Value);
                o1.QuotationID = Convert.ToInt32(TextBox1.Text.ToString());
                o1.Quantity = Convert.ToInt32(TextBox2.Text);
                o1.Rate = Convert.ToInt32(TextBox3.Text);
                DateTime d1 = new DateTime();
                if (!DateTime.TryParseExact(TextBox4.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
                {
                    d1 = DateTime.Today;
                }
                o1.PODate = d1;

                o1.PONumber = Convert.ToInt32(TextBox5.Text);
                DateTime d2 = new DateTime();
                if (!DateTime.TryParseExact(TextBox6.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
                {
                    d2 = DateTime.Today;
                }
                if (d2.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
                {
                    o1.CreateDate = DateTime.Now;
                }
                else
                {
                    o1.CreateDate = d2;
                }
                if (o1.Status.Equals(DropDownList2.SelectedItem.Text))
                {
                    o1.Status = DropDownList2.SelectedItem.Text;
                }
                else
                {
                    TransitionLogic tl = new TransitionLogic();
                    Transition t1 = new Transition();
                    t1.KeyID = o1.OrderID;
                    t1.KeyType = "Ord";
                    t1.TranDate = DateTime.Now;
                    t1.NewStatus = DropDownList2.SelectedItem.Text;
                    t1.Remarks = "";
                    tl.Insert(t1);

                    o1.Status = DropDownList2.SelectedItem.Text;
                }

                o1.StatusRemarks = TextBox8.Text;
                o1.DeliveryAddress = TextArea2.Text;
                DateTime d3 = new DateTime();
                if (!DateTime.TryParseExact(TextBox9.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d3))
                {
                    d3 = DateTime.Today;
                }
                o1.DeliveryDate = d3;

                String po = "";

                string ticks = DateTime.Now.Ticks.ToString();
                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                    po = "Images/" + ticks + FileUpload1.FileName;
                    o1.AttachPO = po;
                }
               

                ol.Update(o1);

                Response.Redirect("OrderList.aspx");
            }
            else
            {
                Label2.Visible = true;
            }
            

        }
        else
        {
            //Insert mode
            if (Convert.ToInt32(TextBox1.Text) > 0)
            {
                OrderLogic ol = new OrderLogic();
                Order o1 = new Order();

                ProductLogic pl = new ProductLogic();

                o1.ProductID = Convert.ToInt32(DropDownList1.SelectedItem.Value);
                o1.QuotationID = Convert.ToInt32(TextBox1.Text);
                o1.Quantity = Convert.ToInt32(TextBox2.Text);
                o1.Rate = Convert.ToInt32(TextBox3.Text);
                DateTime d1 = new DateTime();
                if (!DateTime.TryParseExact(TextBox4.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
                {
                    d1 = DateTime.Today;
                }
                o1.PODate = d1;
                o1.JobPath = "";
                o1.PONumber = Convert.ToInt32(TextBox5.Text);

                DateTime d2 = new DateTime();
                if (!DateTime.TryParseExact(TextBox6.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
                {
                    d2 = DateTime.Today;
                }
                if (d2.ToShortDateString().Equals(DateTime.Today.ToShortDateString()))
                {
                    o1.CreateDate = DateTime.Now;
                }
                else
                {
                    o1.CreateDate = d2;
                }

                o1.Status = DropDownList2.SelectedItem.Text;
                o1.StatusRemarks = TextBox8.Text;
                o1.DeliveryAddress = TextArea2.Text;
                DateTime d3 = new DateTime();
                if (!DateTime.TryParseExact(TextBox9.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d3))
                {
                    d3 = DateTime.Today;
                }
                o1.DeliveryDate = d3;

                String po = "";

                string ticks = DateTime.Now.Ticks.ToString();
                if (FileUpload1.HasFile)
                {
                    FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                    po = "Images/" + ticks + FileUpload1.FileName;
                }
                o1.AttachPO = po;
                ol.Insert(o1);

                Response.Redirect("OrderList.aspx");

            }
            else
            {
                Label2.Visible = true;
            }
        }
    }
 /*
 protected void ImageButton1_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Performa invoice generated";
     ol.Update(o1);
 }
 protected void ImageButton2_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Performa invoice approved";
     ol.Update(o1);
 }
 protected void ImageButton3_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Cylinder requested";
     ol.Update(o1);
 }
 protected void ImageButton4_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Cylinder received";
     ol.Update(o1);
 }
 protected void ImageButton5_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Print pending";
     ol.Update(o1);
 }
 protected void ImageButton6_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Converting";
     ol.Update(o1);
 }
 protected void ImageButton7_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Ready";
     ol.Update(o1);
 }
 protected void ImageButton8_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Dispached";
     ol.Update(o1);
 }
 protected void ImageButton9_Command(object sender, CommandEventArgs e)
 {
     OrderLogic ol = new OrderLogic();
     Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
     o1.Status = "Closed";
     ol.Update(o1);
 }*/
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
       EmployeeLogic el = new EmployeeLogic();
     Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
     if (!(e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
     {
         if(e.CommandName.Equals("Performa invoice generated")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Performa invoice generated";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Performa invoice generated";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Performa invoice approved")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Performa invoice approved";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Performa invoice approved";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Cylinder requested")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Cylinder requested";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Cylinder requested";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Cylinder received")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Cylinder received";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Cylinder received";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Print pending")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Print pending";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Print pending";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Converting")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Converting";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Converting";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Ready")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Ready";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Ready";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Dispached")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Dispached";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Dispached";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }else if(e.CommandName.Equals("Closed")){
             OrderLogic ol = new OrderLogic();
             Order o1 = ol.SelectByID(Convert.ToInt32(e.CommandArgument));
             o1.Status = "Closed";
             ol.Update(o1);
             DataTable dt = ol.SelectAllJoined();
             Repeater1.DataSource = dt;
             Repeater1.DataBind();
             if (dt.Rows.Count == 0)
             {
                 Table1.Visible = false;
                 Label1.Visible = true;
             }
             else
             {
                 Table1.Visible = true;
                 Label1.Visible = false;
             }
             TransitionLogic tl = new TransitionLogic();
             Transition t1 = new Transition();
             t1.KeyID = o1.OrderID;
             t1.KeyType = "Ord";
             t1.TranDate = DateTime.Now;
             t1.NewStatus = "Closed";
             t1.Remarks = ((TextBox)e.Item.FindControl("TextBox3")).Text;
             tl.Insert(t1);
         }
     }
     else
     {
         Response.Redirect("Access.aspx");
     }
     
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
        {
            if (!IsPostBack)
            {

                ProductLogic pl = new ProductLogic();
                DropDownList1.DataSource = pl.SelectAll();
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "ProductID";
                DropDownList1.DataBind();

                if (Convert.ToInt32(Request.QueryString["id"]) > 0)
                {

                    OrderLogic ol = new OrderLogic();
                    Order o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

                    Product p1 = pl.SelectByProductID(o1.ProductID);
                    DropDownList1.SelectedItem.Text = p1.Name;
                    QuotationLogic ql = new QuotationLogic();
                    TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedValue)).QuotationID.ToString();
                    TextBox2.Text = o1.Quantity.ToString();
                    TextBox3.Text = o1.Rate.ToString();
                    TextBox4.Text = o1.PODate.ToString("dd/MM/yyyy");

                    TextBox5.Text = o1.PONumber.ToString();
                    TextBox6.Text = o1.CreateDate.ToString("dd/MM/yyyy");

                    DropDownList2.SelectedItem.Text = o1.Status;
                    TextBox8.Text = o1.StatusRemarks;
                    TextArea2.Text = o1.DeliveryAddress;
                    TextBox9.Text = o1.DeliveryDate.ToString("dd/MM/yyyy");

                    String po = o1.AttachPO;
                    string ticks = DateTime.Now.Ticks.ToString();
                    if (FileUpload1.HasFile)
                    {
                        FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                        FileUpload1.Visible = false;
                        lnkImage1.Text = po.Substring(25);
                        lnkImage1.NavigateUrl = po;
                    }
                    else
                    {
                        lnkImage1.Visible = false;
                        LinkButton1.Visible = false;

                    }


                }


                else
                {
                    lnkImage1.Visible = false;
                    LinkButton1.Visible = false;
                    QuotationLogic ql = new QuotationLogic();
                    TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedItem.Value)).QuotationID.ToString();
                    TextBox6.Text = DateTime.Now.ToString("dd/MM/yyyy");
                }
            }
            Label2.Visible = false;
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        OrderLogic ol = new OrderLogic();
        DateTime d1 = new DateTime();
        DateTime d2 = new DateTime();
        
            if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1))
            {
                d1 = DateTime.Now.AddYears(-100);
            }

            if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2))
            {
                d2 = DateTime.Now.AddYears(10);
            }
        DataTable dt = ol.Search(Convert.ToInt32(DropDownList1.SelectedItem.Value), Convert.ToInt32(DropDownList2.SelectedItem.Value), d1, d2);
        Repeater1.DataSource = dt;
        Repeater1.DataBind();
        if (dt.Rows.Count == 0)
        {
            Table1.Visible = false;
            Label1.Visible = true;
        }
        else
        {
            Table1.Visible = true;
            Label1.Visible = false;
        }
    
    }
Пример #45
0
 public CheckoutController()
 {
     db = new OrderBLL();
     cartBLL = new ShoppingCartBLL();
 }