Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string[] productInfo = txtProductName.Tag.ToString().Split('-');

            int productID = Convert.ToInt32(productInfo[0].ToString());
            int productLabel = Convert.ToInt32(productInfo[1].ToString());
            int pluNumber = Convert.ToInt32("0"+txtPlu.Text.Trim());

            CCategoryManager oManager = new CCategoryManager();

            CResult oResult = oManager.SaveProductPLU(productID, productLabel, pluNumber);

            if (Convert.ToInt32(oResult.Data) > -1)
            {
                lblSaveStatus.Text = "This PLU is already existed.";
                lblSaveStatus.ForeColor = Color.White;
                lblSaveStatus.Visible = true;
            }
            else
            {
                lblSaveStatus.Text = "This PLU has been saved successfully.";
                lblSaveStatus.Visible = true;
                lblSaveStatus.ForeColor = Color.White;
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oValidResult = ValidateForm();

            if (oValidResult.IsSuccess)
            {
                String sTempStr = txtParentCategoryName.Text.Trim();

                if (sTempStr.Equals(String.Empty))
                {
                    lblSaveStatus.Text = " Write the name of the category.";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    CParentCategory oTempParent = new CParentCategory();

                    oTempParent.ParentCatName = sTempStr;

                    CCategoryManager oManager = new CCategoryManager();

                    CResult oResult = oManager.AddParentCat(oTempParent);

                    if (oResult.IsSuccess)
                    {
                        lblSaveStatus.Text = " Parent category has been added successfully.";

                        lblSaveStatus.Visible = true;
                    }
                    else
                    {
                        lblSaveStatus.Text = oResult.Message;

                        lblSaveStatus.Visible = true;
                    }
                }
            }
            else
            {
                lblSaveStatus.Text = oValidResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory1 objFoodType = new CCategory1();

                objFoodType.Category1Name = txtFoodType.Text.Trim();

                //oCat.Category1Order = Int32.Parse(textBox2.Text.Trim());

                objFoodType.ParentCatID = Int32.Parse(cmbParentCategory.SelectedValue.ToString());

                objFoodType.Category1ID = Convert.ToInt32("0"+txtFoodType.Tag);

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory1(objFoodType);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Food type has been updated successfully.";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CParentCategory objParentCat = new CParentCategory();

                objParentCat.ParentCatName = txtParentCategoryName.Text.Trim();

                objParentCat.ParentCatID = m_iParentCat;

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateParentCat(objParentCat);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Parent category information has been updated successfully. ";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 5
0
        private void dgvFoodItem_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                if (e.ColumnIndex == 6)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvFoodItem.Rows[e.RowIndex].Cells[0].Value);

                    UpdateFoodItemCtl objUpdate = new UpdateFoodItemCtl(itemID);
                    objUpdate.Parent = this.ParentForm;
                    UserControlManager.UserControls.Push(this);
                    Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"];

                    string s = pnl.Name;

                    objUpdate.ParentForm.Controls[s].Controls.Clear();
                    objUpdate.ParentForm.Controls[s].Controls.Add(objUpdate);
                }

                else if (e.ColumnIndex == 7)
                {
                    if (MessageBox.Show("Are you sure you want to delete the selected category?", RMSGlobal.MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int itemID = 0;

                        bool bTempBool = Int32.TryParse(dgvFoodItem.Rows[e.RowIndex].Cells[0].Value.ToString(), out itemID);

                        if (bTempBool)
                        {
                            CCategory3 oCat = new CCategory3();

                            oCat.Category3ID = itemID;
                            CCategoryManager oManager = new CCategoryManager();

                            CResult oResult = oManager.DeleteCat3(oCat);

                            if (oResult.IsSuccess)
                            {
                                dgvFoodItem.Rows.RemoveAt(e.RowIndex);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory4 objSelectionofItem = new CCategory4();

                String tempName = txtItemName.Text;
                int tempCat4Order = int.Parse(txtOrder.Text);
                String tempDescription = txtDescription.Text;

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objSelectionofItem.Category4TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objSelectionofItem.Category4BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objSelectionofItem.Category4TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }

                int tempViewTable = chkTable.Checked == true ? 1 : 0;
                int tempViewBar = chkBar.Checked == true ? 1 : 0;
                int tempViewTW = chkTakeAway.Checked == true ? 1 : 0;

                objSelectionofItem.Category4Name = tempName;

                objSelectionofItem.Category4Order = tempCat4Order;

                objSelectionofItem.Category4Description = tempDescription;

                objSelectionofItem.Category4ViewTable = tempViewTable;

                objSelectionofItem.Category4ViewBar = tempViewBar;

                objSelectionofItem.Category4ViewTakeAway = tempViewTW;

                objSelectionofItem.Category3ID = Int32.Parse(cmbFoodItem.SelectedValue.ToString());

                objSelectionofItem.Category4ID = m_selectionItemCategoryID;

                if (rdoActive.Checked)
                {
                    objSelectionofItem.Category4OrderStatus = 1;
                }
                else
                {
                objSelectionofItem.Category4OrderStatus =0;
                }

                if (chkunlimited.Checked)
                {
                    objSelectionofItem.InitialItemQuantity = 0;
                    objSelectionofItem.UnlimitStatus = 1;
                }
                else
                {
                    objSelectionofItem.InitialItemQuantity = Convert.ToInt32("0"+txtInitialQuantity.Text);
                    objSelectionofItem.UnlimitStatus = 0;
                }

                try
                {
                    objSelectionofItem.vatRate = Convert.ToDouble(txtVateRate.Text.ToString());
                }
                catch
                {
                    objSelectionofItem.vatRate = 0.00;
                }

                if (chkVateIncluded.Checked)
                {
                    objSelectionofItem.vatIncluded = true;
                }
                else
                {
                    objSelectionofItem.vatIncluded = false;
                }

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory4(objSelectionofItem, m_selectionItemOrder);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Item information is updated successfully. ";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;

                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 7
0
        private void LoadExistingData()
        {
            CCategoryManager oManager = new CCategoryManager();

            CResult oResult = oManager.GetCategory4(m_selectionItemCategoryID);
            CCategory4 objSelectionOfItem = new CCategory4();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                objSelectionOfItem = (CCategory4)oResult.Data;
                txtItemName.Text = objSelectionOfItem.Category4Name;
                txtOrder.Text = objSelectionOfItem.Category4Order.ToString();

                m_selectionItemOrder = objSelectionOfItem.Category4Order;

                txtDescription.Text = objSelectionOfItem.Category4Description;
                txtTablePrice.Text = objSelectionOfItem.Category4TablePrice.ToString("F02");
                txtTakeawayPrice.Text = objSelectionOfItem.Category4TakeAwayPrice.ToString("F02");
                txtBarPrice.Text = objSelectionOfItem.Category4BarPrice.ToString("F02");
                txtVateRate.Text = objSelectionOfItem.vatRate.ToString();
                chkVateIncluded.Checked = objSelectionOfItem.vatIncluded;

                if (objSelectionOfItem.UnlimitStatus >0)
                {
                    chkunlimited.Checked = true;
                    txtInitialQuantity.Clear();
                }
                else
                {
                    txtInitialQuantity.Text = objSelectionOfItem.InitialItemQuantity.ToString();
                }

                m_iRank = objSelectionOfItem.Rank;

                if (objSelectionOfItem.Category4ViewTable == 1)
                {
                    chkTable.Checked = true;
                }
                if (objSelectionOfItem.Category4ViewBar == 1)
                {
                    chkBar.Checked = true;
                }
                if (objSelectionOfItem.Category4ViewTakeAway == 1)
                {
                    chkTakeAway.Checked = true;
                }
            }

            oResult = oManager.GetCategoryAncestors(m_selectionItemCategoryID, 4);

            if (oResult.IsSuccess && oResult.Data != null)
            {
                CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data;

                int tmpCat4ID = oCatAnc.Category4ID;
                int tmpCat3ID = oCatAnc.Category3ID;
                int tmpCat2ID = oCatAnc.Category2ID;
                int tmpCat1ID = oCatAnc.Category1ID;
                int tmpParentCatID = oCatAnc.ParentCategoryID;

                CComboBoxItem oItem1 = new CComboBoxItem(1, "Active");

                CComboBoxItem oItem2 = new CComboBoxItem(0, "InActive");

                if (objSelectionOfItem.Category4OrderStatus == 1)
                {

                    rdoActive.Checked = true;

                }
                else if (objSelectionOfItem.Category4OrderStatus == 0)
                {
                    rdoInactive.Checked = true;

                }
                cmbParent.SelectedValue = tmpParentCatID;
                cmbFoodType.SelectedValue = tmpCat1ID;
                cmbCategory.SelectedValue = tmpCat2ID;
                cmbFoodItem.SelectedValue = tmpCat3ID;
            }
        }
Exemplo n.º 8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //To Get parent catagory Order Number

            String queryStr = SqlQueries.GetQuery(Query.GetMaxParentCategoryNumber);
            CDalConfig oTempDal = ConfigManager.GetConfig<CDalConfig>();
            String tempConnStr = oTempDal.ConnectionString;
            // Create a new data adapter based on the specified query.
            SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr);
            // Populate a new data table and bind it to the BindingSource.
            DataTable table = new DataTable();
            //table.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataAdapter.Fill(table);

            int lastMaxParentValue = Convert.ToInt32(table.Rows[0]["Column1"].ToString());

            CResult oValidResult = ValidateForm();

            if (oValidResult.IsSuccess)
            {
                String sTempStr = txtParentCategoryName.Text.Trim();

                if (sTempStr.Equals(String.Empty))
                {
                    lblSaveStatus.Text = " Write the name of the category.";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    CParentCategory oTempParent = new CParentCategory();

                    oTempParent.ParentCatName = sTempStr;
                    oTempParent.ParentCatID = lastMaxParentValue+1;

                    CCategoryManager oManager = new CCategoryManager();

                    CResult oResult = oManager.AddParentCat(oTempParent);

                    if (oResult.IsSuccess)
                    {
                        lblSaveStatus.Text = " Parent category has been added successfully.";

                        lblSaveStatus.Visible = true;
                    }
                    else
                    {
                        lblSaveStatus.Text = oResult.Message;

                        lblSaveStatus.Visible = true;
                    }
                }
            }
            else
            {
                lblSaveStatus.Text = oValidResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory3 objFoodItem = new CCategory3();
                String tempName = txtProductName.Text;
                int tempCat3Order = int.Parse(txtOrder.Text);
                String tempDescription = txtDescription.Text;
                objFoodItem.PrintArea = printareacomboBox.Text;

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }

                if (!tblCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TableCost = Double.Parse(tblCost.Text.Trim());
                }

                if (!takeawayCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TakeAwayCost = Double.Parse(takeawayCost.Text.Trim());
                }

                if (!barCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.BarCost = Double.Parse(barCost.Text.Trim());
                }

                int tempViewTable = chkTable.Checked == true ? 1 : 0;
                int tempViewBar = chkBar.Checked == true ? 1 : 0;
                int tempViewTW = chkTakeAway.Checked == true ? 1 : 0;

                objFoodItem.Category3Name = tempName;

                objFoodItem.Category3Order = tempCat3Order;

                objFoodItem.Category3Description = tempDescription;

                objFoodItem.Category3ViewTable = tempViewTable;

                objFoodItem.Category3ViewBar = tempViewBar;

                objFoodItem.Category3ViewTakeAway = tempViewTW;

                objFoodItem.Category3ID = m_foodItemID;

                if (chkUnlimited.Checked)
                {
                    objFoodItem.InitialItemQuantity =0;
                    objFoodItem.UnlimitStatus = 1;
                }
                else
                {
                    objFoodItem.InitialItemQuantity = Convert.ToInt32("0" + txtInitialQuantity.Text);
                    objFoodItem.UnlimitStatus = 0;
                }
                objFoodItem.ItemSellingIn = cmbSellingIn.Text;

                objFoodItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());

                if (m_activeStatus==true)
                {
                    objFoodItem.Category3OrderStatus = 1;
                }
                else if (m_activeStatus)
                {
                    objFoodItem.Category3OrderStatus = 0;
                }

                //Vat included or not and amount of vat
                try
                {
                    objFoodItem.vatRate = Convert.ToDouble(txtVateRate.Text.ToString());
                }
                catch
                {
                    objFoodItem.vatRate = 0.00;
                }

                if (chkVateIncluded.Checked)
                {
                    objFoodItem.vatIncluded = true;
                }
                else
                {
                    objFoodItem.vatIncluded = false;
                }

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory3(objFoodItem, m_iCat3Order);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Food item has been updated successfully. ";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 10
0
        private void LoadExistingData()
        {
            CCategoryManager oManager = new CCategoryManager();

            CResult oResult = oManager.GetCategory3(m_foodItemID);
            CCategory3 objFoodItem = new CCategory3();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                objFoodItem = (CCategory3)oResult.Data;
                txtProductName.Text = objFoodItem.Category3Name;
                txtOrder.Text = objFoodItem.Category3Order.ToString();

                m_iCat3Order = objFoodItem.Category3Order;

                txtDescription.Text = objFoodItem.Category3Description;
                txtTablePrice.Text = objFoodItem.Category3TablePrice.ToString("F02");
                txtTakeawayPrice.Text = objFoodItem.Category3TakeAwayPrice.ToString("F02");
                txtBarPrice.Text = objFoodItem.Category3BarPrice.ToString("F02");
                cmbSellingIn.Text = objFoodItem.ItemSellingIn;
                txtVateRate.Text = objFoodItem.vatRate.ToString();
                selectarealabel.Text = objFoodItem.PrintArea;

               tblCost.Text = objFoodItem.TableCost.ToString("F02");
                takeawayCost.Text = objFoodItem.TakeAwayCost.ToString("F02");
                barCost.Text = objFoodItem.BarCost.ToString("F02");

                try
                {
                    chkVateIncluded.Checked = objFoodItem.vatIncluded;
                }
                catch { }
                if (objFoodItem.UnlimitStatus==1)
                {
                    txtInitialQuantity.Clear();
                    chkUnlimited.Checked = true;
                }
                else
                {
                    txtInitialQuantity.Text = objFoodItem.InitialItemQuantity.ToString();
                }

                m_iRank = objFoodItem.Rank;

                if (objFoodItem.Category3ViewTable == 1) chkTable.Checked = true;
                if (objFoodItem.Category3ViewBar == 1) chkBar.Checked = true;
                if (objFoodItem.Category3ViewTakeAway == 1) chkTakeAway.Checked = true;

            }

            oResult = oManager.GetCategoryAncestors(m_foodItemID, 3);
            CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data;

            if (oResult.IsSuccess && oResult.Data != null)
            {
                int tmpCat3ID = oCatAnc.Category3ID;
                int tmpCat2ID = oCatAnc.Category2ID;
                int tmpCat1ID = oCatAnc.Category1ID;
                int tmpParentCatID = oCatAnc.ParentCategoryID;

                if (objFoodItem.Category3OrderStatus == 1)
                {
                    m_activeStatus = true;
                    rdoActive.Checked = true;
                }
                else if (objFoodItem.Category3OrderStatus == 0)
                {
                    rdoInActive.Checked = true;
                    m_activeStatus = false;
                }

                cmbParent.SelectedValue = tmpParentCatID;
                cmbFoodType.SelectedValue = tmpCat1ID;
                cmbCategory.SelectedValue = tmpCat2ID;

            }
        }
Exemplo n.º 11
0
        private void dgvFoodTypeList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            try
            {
                if (e.ColumnIndex == 4)
                {
                    Int32 foodTypeID = Convert.ToInt32("0" + dgvFoodTypeList.Rows[e.RowIndex].Cells[0].Value);
                    string foodTypeName = Convert.ToString(dgvFoodTypeList.Rows[e.RowIndex].Cells[1].Value);

                    EditFoodTypeCtl objFoodType = new EditFoodTypeCtl(foodTypeID, foodTypeName);
                    objFoodType.Parent = this.ParentForm;
                    UserControlManager.UserControls.Push(this);
                    Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"];

                    string s = pnl.Name;

                    objFoodType.ParentForm.Controls[s].Controls.Clear();
                    objFoodType.ParentForm.Controls[s].Controls.Add(objFoodType);
                }

                else if (e.ColumnIndex == 5)
                {
                    if (MessageBox.Show("Are you sure you want to delete the selected food type?", RMSGlobal.MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int foodTypeID = 0;

                        bool bTempBool = Int32.TryParse(dgvFoodTypeList.Rows[e.RowIndex].Cells[0].Value.ToString(), out foodTypeID);

                        if (bTempBool)
                        {
                            CCategory1 objFoodType = new CCategory1();

                            objFoodType.Category1ID = foodTypeID;
                            CCategoryManager oManager = new CCategoryManager();

                            CResult oResult = oManager.DeleteCat1(objFoodType);

                            if (oResult.IsSuccess)
                            {
                                dgvFoodTypeList.Rows.RemoveAt(e.RowIndex);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemplo n.º 12
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                String tempName = txtCategoryName.Text;
                int tempCat3Order = int.Parse(txtCatOrder.Text);
                String tempColor = txtColorName.Text.Trim();

                int tempViewTable = chkTable.Checked == true ? 1 : 0;
                int tempViewBar = chkBar.Checked == true ? 1 : 0;
                int tempViewTW = chkTakeAway.Checked == true ? 1 : 0;

                CCategory2 oCat = new CCategory2();

                oCat.Category2Name = tempName;

                oCat.Category2Order = tempCat3Order;

                oCat.Category2Color = tempColor;

                oCat.Category1ID = Int32.Parse(cmbFoodType.SelectedValue.ToString());

                oCat.Category2ID = m_categoryID;

                oCat.Category2ViewTable = tempViewTable;

                oCat.Category2ViewBar = tempViewBar;

                oCat.Category2ViewTakeAway = tempViewTW;

                oCat.Category2Type = ((CComboBoxItem)cmbCategoryType.SelectedItem).Value;

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory2(oCat, m_cattegoryOrder);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Category2 information is updated successfully. ";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 13
0
        private void btnUp_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_selectedIndex > 0 && dgvCategory.Rows.Count > m_selectedIndex)
                {
                    int iTempInt = Int32.Parse(dgvCategory.Rows[m_selectedIndex].Cells[0].Value.ToString());

                    int iTempInt3 = Int32.Parse(dgvCategory.Rows[m_selectedIndex].Cells[3].Value.ToString());

                    CCategory2 oCat = new CCategory2();

                    oCat.Category2ID = iTempInt;

                    oCat.Category2Order = iTempInt3;

                    if ((m_selectedIndex - 1) >= 0 && dgvCategory.Rows.Count > (m_selectedIndex - 1))
                    {
                        int iTempInt2 = Int32.Parse(dgvCategory.Rows[(m_selectedIndex - 1)].Cells[0].Value.ToString());

                        int iTempInt4 = Int32.Parse(dgvCategory.Rows[(m_selectedIndex - 1)].Cells[3].Value.ToString());

                        int iTempIndex = m_selectedIndex - 1;

                        CCategory2 oCat2 = new CCategory2();

                        oCat2.Category2ID = iTempInt2;

                        oCat2.Category2Order = iTempInt4;

                        CCategoryManager oCatManager = new CCategoryManager();

                        CResult oResult = oCatManager.UpdateCategory2Order(oCat, oCat2, true);

                        if (oResult.IsSuccess)
                        {

                            if (m_bGridFlag)
                            {
                                this.FillFoodCategory();

                                dgvCategory.Rows[0].Selected = false;

                                dgvCategory.Rows[iTempIndex].Selected = true;

                                m_selectedIndex = iTempIndex;

                                if (m_selectedIndex > 12)
                                {
                                    dgvCategory.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                }
                            }
                            else
                            {

                                this.FillFoodCategory();

                                dgvCategory.Rows[0].Selected = false;

                                dgvCategory.Rows[iTempIndex].Selected = true;

                                m_selectedIndex = iTempIndex;

                                if (m_selectedIndex > 12)
                                {
                                    dgvCategory.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                }

                            }

                        }
                    }
                }

            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 14
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oValidResult = ValidateForm();

            if (oValidResult.IsSuccess)
            {
                CCategory2 oTempCat = new CCategory2();

                oTempCat.Category1ID = Int32.Parse(cmbFoodType.SelectedValue.ToString());

                oTempCat.Category2Type = Int32.Parse(((CComboBoxItem)cmbCategoryType.SelectedItem).Value.ToString());

                oTempCat.Category2Name = txtCategoryName.Text.Trim();

                oTempCat.Category2Color = txtColorName.Text.Trim();

                if (chkTable.Checked)
                {
                    oTempCat.Category2ViewTable = 1;
                }

                if (chkTakeAway.Checked)
                {
                    oTempCat.Category2ViewBar = 1;
                }

                if (chkBar.Checked)
                {
                    oTempCat.Category2ViewTakeAway = 1;
                }

                CCategoryManager oManager = new CCategoryManager();
                CResult oResult = oManager.AddCategory2(oTempCat);

                if (oResult.IsSuccess)
                {
                    lblSaveStatus.Text = "Category has been saved successfully.";
                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult.Message;
                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oValidResult.Message;
                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Saving the food item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult objResult = ValidateForm();

            if (objResult.IsSuccess)
            {
                CCategory3 objFoodItem = new CCategory3();

                objFoodItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());

                objFoodItem.Category3Name = txtProductName.Text.Trim();

                objFoodItem.Category3Description = txtDescription.Text.Trim();

                if (chkTable.Checked)
                {
                    objFoodItem.Category3ViewTable = 1;
                }

                if (chkBar.Checked)
                {
                    objFoodItem.Category3ViewBar = 1;
                }

                if (chkTakeAway.Checked)
                {
                    objFoodItem.Category3ViewTakeAway = 1;
                }

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                if (rdoActive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 1;
                }
                else if (rdoInactive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 0;
                }

                if (chkUnlimited.Checked)
                {
                    objFoodItem.InitialItemQuantity = 0;
                    objFoodItem.UnlimitStatus = 1;
                }
                else
                {
                    objFoodItem.InitialItemQuantity = Convert.ToInt32("0"+txtInitialQuantity.Text);
                    objFoodItem.UnlimitStatus = 0;
                }

                objFoodItem.ItemSellingIn = cmbSellingIn.Text; //Whether the item sold in quantity or weight

                try
                {
                    objFoodItem.vatRate = Convert.ToDouble(txtVateRate.Text.ToString());
                }
                catch
                {
                    objFoodItem.vatRate = 0.00;
                }

                if (chkVateIncluded.Checked)
                {
                    objFoodItem.vatIncluded = true;
                }
                else
                {
                    objFoodItem.vatIncluded = false;
                }

                objFoodItem.ProductType = ProductType;

                try
                {
                    objFoodItem.UoM = cmbSellingIn.Text;
                }
                catch { }
                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.AddCategory3(objFoodItem);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = " The product has been saved successfully.";
                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = "The product can not be added. Please try again. ";
                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = objResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 16
0
        private void btnDown_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_selectedIndex >= 0 && dgvFoodTypeList.Rows.Count > m_selectedIndex)
                {
                    int currentCategoryID = Int32.Parse(dgvFoodTypeList.Rows[m_selectedIndex].Cells[0].Value.ToString());

                    int currentCategoryOrder = Int32.Parse(dgvFoodTypeList.Rows[m_selectedIndex].Cells[3].Value.ToString());

                    CCategory1 oCat = new CCategory1();

                    oCat.Category1ID = currentCategoryID;

                    oCat.Category1OrderNumber = currentCategoryOrder;

                    if ((m_selectedIndex + 1) > 0 && dgvFoodTypeList.Rows.Count > (m_selectedIndex + 1))
                    {
                        int antiCategoryID = Int32.Parse(dgvFoodTypeList.Rows[(m_selectedIndex + 1)].Cells[0].Value.ToString());

                        int antiCategoryOrder = Int32.Parse(dgvFoodTypeList.Rows[(m_selectedIndex + 1)].Cells[3].Value.ToString());

                        int iTempIndex = m_selectedIndex + 1;
                        CCategory1 oCat1 = new CCategory1();

                        oCat1.Category1ID = antiCategoryID;

                        oCat1.Category1OrderNumber = antiCategoryOrder;

                        CCategoryManager oCatManager = new CCategoryManager();

                        CResult oResult = oCatManager.UpdateCategory1Order(oCat, oCat1, false);

                        if (oResult.IsSuccess)
                        {

                            if (m_bGridFlag)
                            {
                                Int32 foodTypeID = Convert.ToInt32(cmbParentCategory.SelectedValue);
                                FillCategory1ByID(foodTypeID);

                                dgvFoodTypeList.Rows[0].Selected = false;

                                dgvFoodTypeList.Rows[iTempIndex].Selected = true;

                                m_selectedIndex = iTempIndex;

                                if (m_selectedIndex > 12)
                                {
                                    dgvFoodTypeList.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                }
                            }
                            else
                            {

                                Int32 foodTypeID = Convert.ToInt32(cmbParentCategory.SelectedValue);
                                FillCategory1ByID(foodTypeID);

                                dgvFoodTypeList.Rows[0].Selected = false;

                                dgvFoodTypeList.Rows[iTempIndex].Selected = true;

                                m_selectedIndex = iTempIndex;

                                if (m_selectedIndex > 12)
                                {
                                    dgvFoodTypeList.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                }
                            }
                        }
                    }
                }

            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.",
                    RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 17
0
        private void btnDown_Click(object sender, EventArgs e)
        {
            try
            {

                    if (m_selectedIndex >= 0 && dgvFoodItem.Rows.Count > m_selectedIndex)
                    {
                        int iTempInt = Int32.Parse(dgvFoodItem.Rows[m_selectedIndex].Cells[0].Value.ToString());

                        int iTempInt3 = Int32.Parse(dgvFoodItem.Rows[m_selectedIndex].Cells[2].Value.ToString());

                        CCategory3 oCat = new CCategory3();

                        oCat.Category3ID = iTempInt;

                        oCat.Category3Order = iTempInt3;

                        if ((m_selectedIndex + 1) > 0 && dgvFoodItem.Rows.Count > (m_selectedIndex + 1))
                        {
                            int iTempInt2 = Int32.Parse(dgvFoodItem.Rows[(m_selectedIndex + 1)].Cells[0].Value.ToString());

                            int iTempInt4 = Int32.Parse(dgvFoodItem.Rows[(m_selectedIndex + 1)].Cells[2].Value.ToString());

                            int iTempIndex = m_selectedIndex + 1;
                            CCategory3 oCat2 = new CCategory3();

                            oCat2.Category3ID = iTempInt2;

                            oCat2.Category3Order = iTempInt4;

                            if (cmbCategory.SelectedValue != null)
                            {

                                int iTempInt10 = Int32.Parse(cmbCategory.SelectedValue.ToString());

                                oCat2.Category2ID = iTempInt10;

                                oCat.Category2ID = iTempInt10;
                            }

                            CCategoryManager oCatManager = new CCategoryManager();

                            CResult oResult = oCatManager.UpdateCategory3Order(oCat, oCat2, false);

                            if (oResult.IsSuccess)
                            {

                                if (m_bGridFlag)
                                {
                                    Int32 categoryID = Convert.ToInt32(cmbCategory.SelectedValue);
                                    FillFoodItem(categoryID);

                                    dgvFoodItem.Rows[0].Selected = false;

                                    dgvFoodItem.Rows[iTempIndex].Selected = true;

                                    m_selectedIndex = iTempIndex;

                                    if (m_selectedIndex > 12)
                                    {
                                        dgvFoodItem.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                    }
                                }
                                else
                                {

                                    Int32 categoryID = Convert.ToInt32(cmbCategory.SelectedValue);
                                    FillFoodItem(categoryID);

                                    dgvFoodItem.Rows[0].Selected = false;

                                    dgvFoodItem.Rows[iTempIndex].Selected = true;

                                    m_selectedIndex = iTempIndex;

                                    if (m_selectedIndex > 12)
                                    {
                                        dgvFoodItem.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                    }

                                }

                            }

                        }
                    }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.",
                    RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 18
0
        private void LoadExistingData()
        {
            CCategoryManager oManager = new CCategoryManager();

            CResult oResult = oManager.GetCategory2(m_categoryID);
            CCategory2 oCat = new CCategory2();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                oCat = (CCategory2)oResult.Data;
                txtCategoryName.Text = oCat.Category2Name;
                txtCatOrder.Text = oCat.Category2Order.ToString();

                m_cattegoryOrder = oCat.Category2Order;

                txtColorName.Text = oCat.Category2Color.ToString();

                if (oCat.Category2ViewTable == 1)
                {
                    chkTable.Checked = true;
                }
                if (oCat.Category2ViewBar == 1)
                {
                    chkBar.Checked = true;
                }
                if (oCat.Category2ViewTakeAway == 1)
                {
                    chkTakeAway.Checked = true;
                }
            }

            oResult = oManager.GetCategoryAncestors(m_categoryID, 2);
            CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data;

            if (oResult.IsSuccess && oResult.Data != null)
            {
                int tmpCat2ID = oCatAnc.Category2ID;
                int tmpCat1ID = oCatAnc.Category1ID;
                int tmpParentCatID = oCatAnc.ParentCategoryID;

                FillParentCategory();

                FillFoodType(tmpParentCatID);

                cmbParent.SelectedValue = tmpParentCatID;

                cmbFoodType.SelectedValue = tmpCat1ID;

                CComboBoxItem oItem1 = new CComboBoxItem(1, "Food");

                CComboBoxItem oItem2 = new CComboBoxItem(0, "Non Food");

                cmbCategoryType.Items.Add(oItem1);

                cmbCategoryType.Items.Add(oItem2);

                cmbCategoryType.DisplayMember = "Display";

                cmbCategoryType.ValueMember = "Value";

                if (oCat.Category2Type == 1)
                {

                    cmbCategoryType.SelectedIndex = 0;
                }
                else if (oCat.Category2Type == 0)
                {
                    cmbCategoryType.SelectedIndex = 1;

                }
            }
        }
Exemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oValidResult = ValidateForm();

            if (oValidResult.IsSuccess)
            {

                int iTempCat = Int32.Parse(cmbParentCategory.SelectedValue.ToString());

                String sTempStr = txtFoodType.Text.Trim();

                CCategory1 objCategory = new CCategory1();
                objCategory.CurrentUserId = RMSGlobal.LogInUserName;
                objCategory.LoginDateTime = RMSGlobal.GetCurrentDateTime();

                objCategory.Category1Name = sTempStr;

                objCategory.ParentCatID = iTempCat;

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult = oManager.AddCategory1(objCategory);

                if (oResult.IsSuccess)
                {
                    lblSaveStatus.Text = "Category1 has been saved successfully.";
                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult.Message;
                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oValidResult.Message;
                lblSaveStatus.Visible = true;
            }
        }
Exemplo n.º 20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory4 objSelectionOfItem = new CCategory4();

                objSelectionOfItem.Category4Name = txtItemName.Text.Trim();

                objSelectionOfItem.Category3ID = Int32.Parse(cmbFoodItem.SelectedValue.ToString());

                objSelectionOfItem.Category4Description = txtDesc.Text.Trim();

                if (rdoActive.Checked)
                {
                 objSelectionOfItem.Category4OrderStatus=1;
                }
                else
                {
                 objSelectionOfItem.Category4OrderStatus=0;
                }

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {

                    objSelectionOfItem.Category4TablePrice = Double.Parse(txtTablePrice.Text.Trim());

                }

                if (!txtTakeAwayPrice.Text.Trim().Equals(String.Empty))
                {

                    objSelectionOfItem.Category4TakeAwayPrice = Double.Parse(txtTakeAwayPrice.Text.Trim());

                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {

                    objSelectionOfItem.Category4BarPrice = Double.Parse(txtBarPrice.Text.Trim());

                }

                if (chkTable.Checked)
                {
                    objSelectionOfItem.Category4ViewTable = 1;
                }

                if (chkBar.Checked)
                {
                    objSelectionOfItem.Category4ViewBar = 1;
                }

                if (chkTakeAway.Checked)
                {
                    objSelectionOfItem.Category4ViewTakeAway = 1;
                }

                if (chkUnlimited.Checked)
                {
                    objSelectionOfItem.InitialItemQuantity = 0;
                    objSelectionOfItem.UnlimitStatus = 1;
                }
                else
                {
                    objSelectionOfItem.UnlimitStatus = 0;
                    objSelectionOfItem.InitialItemQuantity = Convert.ToInt32("0"+txtStockQuantity.Text);
                }

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.AddCategory4(objSelectionOfItem);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = " The product has been saved successfully.";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }