Example #1
0
        private void g_SendButton_Click(object sender, EventArgs e)
        {
            COrderManager objOrderManager = new COrderManager();
                SortedList slPrintingItems = new SortedList();
                //m_isKitchenCopyPrinted = false;//This variable is used to identify whether the online ordered items are prnted at kitchen or not.If true then printed

                KitchenPrintForm objKitchenPrint = new KitchenPrintForm();
                objKitchenPrint.ShowDialog();

                if (objKitchenPrint.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                try
                {

                    DataSet tempStockDataSet = new DataSet();
                    tempStockDataSet.ReadXml("Config/StockSetting.xml");

                    bool isAllowedToOrder = Convert.ToBoolean(tempStockDataSet.Tables[0].Rows[0]["AllowedtoOrder"].ToString());

                    if (!isAllowedToOrder)
                    {
                        if (!CheckStockControl())
                        {
                            return;
                        }
                    }

                }
                catch (Exception)
                {

                }

                DataSet tempDataSet = new DataSet();
                tempDataSet.ReadXml("Config/Mouse_Config.xml");

                if (!tempDataSet.Tables[0].Rows[0]["KitchenCopyNumber"].ToString().Equals(""))
                {
                    m_printedCopy = Convert.ToInt32("0" + tempDataSet.Tables[0].Rows[0]["KitchenCopyNumber"].ToString());
                }

                if (!tempDataSet.Tables[0].Rows[0]["BarCopyNumber"].ToString().Equals(""))
                {
                    m_barCopyNumber = Convert.ToInt32("0" + tempDataSet.Tables[0].Rows[0]["BarCopyNumber"].ToString());
                }

                if (!tempDataSet.Tables[0].Rows[0]["ShowPriceStatus"].ToString().Equals(""))
                {
                    if (Convert.ToString(tempDataSet.Tables[0].Rows[0]["ShowPriceStatus"].ToString()).Replace(" ", "").ToUpper() == "true".Replace(" ", "").ToUpper())
                    {
                        m_isKitchenPriceAvailable = true;
                    }
                    else
                    {
                        m_isKitchenPriceAvailable = false;
                    }
                }

                if (!tempDataSet.Tables[0].Rows[0]["BarPriceStatus"].ToString().Equals(""))
                {
                    if (Convert.ToString(tempDataSet.Tables[0].Rows[0]["BarPriceStatus"].ToString()).Replace(" ", "").ToUpper() == "true".Replace(" ", "").ToUpper())
                    {
                        m_isBarPriceAvailable = true;
                    }
                    else
                    {
                        m_isBarPriceAvailable = false;
                    }
                }

                int printingItem = KitchenPrintForm.m_PrintingItems;

                if (printingItem == 1)//Print all items
                {
                    KitchenPrint();//New

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        slPrintingItems = this.GetProductIdList(1);
                        objOrderManager.UpdatePrintedQuantity(slPrintingItems);
                    }
                    else
                    {
                        slPrintingItems = this.GetProductIdList(2);
                        objOrderManager.UpdateOnlineOrderPrintedQuantity(slPrintingItems);
                    }

                    this.PrintAllBeverage();

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        slPrintingItems = this.GetProductIdList(3);
                        objOrderManager.UpdatePrintedQuantity(slPrintingItems);
                    }
                    else
                    {
                        slPrintingItems = this.GetProductIdList(4);
                        objOrderManager.UpdateOnlineOrderPrintedQuantity(slPrintingItems);
                    }

                    this.LoadOrderDetails();
                }

                else if (printingItem == 2) //Print new food items
                {
                    KitchenCopyForNewFoodItems();

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        slPrintingItems = this.GetProductIdList(1);
                        objOrderManager.UpdatePrintedQuantity(slPrintingItems);
                    }
                    else
                    {
                        slPrintingItems = this.GetProductIdList(2);
                        objOrderManager.UpdateOnlineOrderPrintedQuantity(slPrintingItems);
                    }

                    this.PrintNewBeverage();

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        slPrintingItems = this.GetProductIdList(3);
                        objOrderManager.UpdatePrintedQuantity(slPrintingItems);
                    }
                    else
                    {
                        slPrintingItems = this.GetProductIdList(4);
                        objOrderManager.UpdateOnlineOrderPrintedQuantity(slPrintingItems);
                    }

                    this.LoadOrderDetails();

                btnOrderLog_Click(sender, e);
            }
        }