public string AddOrUpdateOrderBasicInfo(Order order, string newOrderIDForAddOrder)
        {
            Table <DAL.OrderBasicInfo> orderTable = GetOrderBasicInfoTable();

            var matchedRes = (from o in orderTable
                              where o.orderID == order.OrderID
                              select o).FirstOrDefault();

            string orderID = "";

            if (matchedRes == null)
            {
                DAL.OrderBasicInfo newData = new DAL.OrderBasicInfo();
                try
                {
                    newData.orderID         = newOrderIDForAddOrder;
                    newData.dateCreated     = order.DateCreated;
                    newData.priorityNumber  = order.PriorityNumber;
                    newData.totalPayment    = order.TotalPayment;
                    newData.charge          = order.ChargedMoney;
                    newData.orderStatusCode = GetOrderStatusCode(order.Status);
                    newData.cashierID       = ParameterManager.GetCurrentStaff().StaffID;

                    orderTable.InsertOnSubmit(newData);
                    orderTable.Context.SubmitChanges();

                    orderID = newData.orderID;
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
            else
            {
                try
                {
                    matchedRes.orderStatusCode = GetOrderStatusCode(order.Status);
                    db.SubmitChanges();

                    orderID = matchedRes.orderID;
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }
            }
            return("");
        }
Exemplo n.º 2
0
        public string AddStockOrder(StockOrder newStockOrder)
        {
            Table <DAL.StockOrder> stockOrderTable = GetStockOrderTable();

            DAL.StockOrder stockOrder = new DAL.StockOrder();
            try
            {
                Random rnd = new Random();
                stockOrder.stockOrderID            = rnd.Next().ToString(); // Dummy init
                stockOrder.charge                  = 0;
                stockOrder.chargedWarehouseManager = ParameterManager.GetCurrentStaff().StaffID;
                stockOrder.totalPayment            = newStockOrder.TotalPayment;
                stockOrder.dateCreated             = newStockOrder.DateCreated;

                stockOrderTable.InsertOnSubmit(stockOrder);
                stockOrderTable.Context.SubmitChanges();
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            var matchedRes = (from stock in stockOrderTable
                              where stock.dateCreated == newStockOrder.DateCreated && stock.totalPayment == newStockOrder.TotalPayment && stock.chargedWarehouseManager == ParameterManager.GetCurrentStaff().StaffID
                              select stock).FirstOrDefault();

            if (matchedRes == null)
            {
                return("Some error occur while retrieve the stock order ID");
            }


            string stockOrderID = matchedRes.stockOrderID;

            foreach (StockOrderDetails details in newStockOrder.GetStockOrderDetails())
            {
                string err = AddStockOrderDetails(stockOrderID, details.Quantity, details.Details.Ingredient.Name);
                if (err != "")
                {
                    return(err);
                }
            }

            return("");
        }
Exemplo n.º 3
0
 private void DisplayInfoOnScreen()
 {
     bunifuCustomTextbox_NameOfKeeper.Text = ParameterManager.GetCurrentStaff().FullName;
     bunifuCustomTextbox_DateCreated.Text  = DateTime.Now.ToString();
 }
Exemplo n.º 4
0
 private void AddRecommendData()
 {
     bunifuDropdown_Status.Items          = manager.GetOrderStatusList().ToArray();
     bunifuCustomTextbox_CashierName.Text = ParameterManager.GetCurrentStaff().FullName;
     bunifuCustomTextbox_CurentTime.Text  = DateTime.Now.ToString();
 }