コード例 #1
0
ファイル: KitchenVoidForm.cs プロジェクト: Jusharra/RMS
        private void AddItemVoidReport()
        {
            COrderManager tempOrderManager = new COrderManager();
            CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID);
            COrderInfo tempOrderInfo = new COrderInfo();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempOrderInfo = (COrderInfo)oResult.Data;
            }

            ItemVoid aItemVoid=new ItemVoid();
            aItemVoid.OrderId = (int)m_orderID;
            aItemVoid.Creator_Id = tempOrderInfo.UserID;
            aItemVoid.RemoverId = RMS.RMSGlobal.m_iLoginUserID;
            ReasonForm aReasonForm = new ReasonForm();
            aReasonForm.ShowDialog();
            aItemVoid.Reason = aReasonForm.reason;
            aItemVoid.VoidDate = DateTime.Now;

            foreach (ListViewItem lsvItem in lsvRemovable.Items)
            {

                try
                {
                    aItemVoid.Quantity = Convert.ToDouble(lsvItem.SubItems[1].Text);
                    aItemVoid.ItemName = lsvItem.SubItems[0].Text;

                    int id = Convert.ToInt32(lsvItem.SubItems[3].Text);
                    CCategory3 aCategory3 = new CCategory3();
                    CCategory3DAO aCategory3Dao = new CCategory3DAO();
                    aCategory3 = aCategory3Dao.GetAllCategory3ByCategory3ID(id);
                    aItemVoid.Amount = aItemVoid.Quantity * aCategory3.Category3TablePrice;
                    OrderVoidDAO aOrderVoidDao = new OrderVoidDAO();
                    aOrderVoidDao.InsertItemForVoid(aItemVoid);
                }
                catch (Exception)
                {

                }

            }
        }
コード例 #2
0
ファイル: CVoidTableForm.cs プロジェクト: Jusharra/RMS
        public void VoidTableDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (VoidTableDataGridView.Columns[e.ColumnIndex].Name == "ActionButtonColumn" && e.RowIndex >= 0 && VoidTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value != null)
                {
                    DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to void this order?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (tempDialogResult.Equals(DialogResult.No)) return;
                    //ItemInfo c = new ItemInfo();
                    //c.ShowDialog();
                    //c.Close();
                    //DialogResult tempDialogResult1 = MessageBox.Show("Ok Done", "Confirm", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    //if (tempDialogResult1.Equals(DialogResult.No)) return;
                    else
                    {
                        String tempOldOrderID = VoidTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value.ToString();
                        int tempOldTableNumber = int.Parse(VoidTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString());
                        String tempOldTableType = VoidTableDataGridView.Rows[e.RowIndex].Cells["TableTypeColumn"].Value.ToString();

                        // add by mithu
                        OrderVoid aOrderVoid=new OrderVoid();
                        aOrderVoid.OrderId = Convert.ToInt32(VoidTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value);

                        COrderDetailsDAO aDao = new COrderDetailsDAO();
                        List<COrderDetails> aList = new List<COrderDetails>();
                        CResult aResult = new CResult();
                        aResult = aDao.OrderDetailsGetByOrderID(aOrderVoid.OrderId);
                        aList = (List<COrderDetails>)aResult.Data;

                        aOrderVoid.TableNumber = tempOldTableNumber;
                        aOrderVoid.RemoverId = RMS.RMSGlobal.m_iLoginUserID;
                        aOrderVoid.VoidDate = DateTime.Now;
                        COrderDetailsDAO  aCOrderDetailsDAO=new COrderDetailsDAO();
                        aOrderVoid.OrderAmount = aCOrderDetailsDAO.GetOrderAmount(aOrderVoid.OrderId);
                        COrderInfo aInfo=new COrderInfo();
                        COrderInfoDAO aCOrderInfoDao=new COrderInfoDAO();
                        aInfo = aCOrderInfoDao.GetOrderInfoByOrderID(aOrderVoid.OrderId);
                        aOrderVoid.OrderDate = aInfo.OrderTime;
                        aOrderVoid.Creator_Id = aInfo.UserID;
                        ReasonForm aReasonForm=new ReasonForm();
                        aReasonForm.ShowDialog();
                        aOrderVoid.Reason = aReasonForm.reason;

                        OrderVoidDAO aOrderVoidDao=new OrderVoidDAO();
                        aOrderVoidDao.InsertOrderForVoid(aOrderVoid);

                        DataSet tempStockDataSet = new DataSet();
                        tempStockDataSet.ReadXml("Config/StockSetting.xml");
                        bool isAllowedToOrder = Convert.ToBoolean(tempStockDataSet.Tables[0].Rows[0]["AllowedtoOrder"].ToString());
                        if (!isAllowedToOrder)
                        {
                            UpdateRawMaterial(aList);
                        }

                        COrderManager tempVoidTableManager = new COrderManager();
                        CResult tempResult = tempVoidTableManager.UpdateForVoidTable(tempOldOrderID, tempOldTableNumber, tempOldTableType, false);
                        if (tempResult.IsSuccess)
                        {
                            this.PopulateVoidTableDataGridView();

                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }