コード例 #1
0
ファイル: ProductForm.cs プロジェクト: Jusharra/RMS
        public ProductForm(ProductViewMode productViewMode, int cat3_id)
        {
            InitializeComponent();

            switch (productViewMode)
            {
                case ProductViewMode.LIST:
                    {
                        ProductItemCtl foodItemControl = new ProductItemCtl();
                        panelUCHolder.Controls.Add(foodItemControl);
                        foodItemControl.Dock = DockStyle.Fill;
                        ScreenTitle = "Product List";

                    }
                    break;

                case ProductViewMode.INSERT:
                    {
                        AddProductItemCtl foodItemControl = new AddProductItemCtl();
                        panelUCHolder.Controls.Add(foodItemControl);
                        foodItemControl.Dock = DockStyle.Fill;
                        ScreenTitle = "Add New Product";

                    }
                    break;

                case ProductViewMode.UPDATE:
                    {
                        AddProductItemCtl foodItemControl = new AddProductItemCtl(cat3_id);
                        panelUCHolder.Controls.Add(foodItemControl);
                        foodItemControl.Dock = DockStyle.Fill;
                        ScreenTitle = "Update Product";

                    }
                    break;
            }
        }
コード例 #2
0
ファイル: ProductItemCtll.cs プロジェクト: Jusharra/RMS
        private void dgvFoodItem_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                if (e.ColumnIndex == 11)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvFoodItem.Rows[e.RowIndex].Cells[0].Value);
                    AddProductItemCtl objUpdate = new AddProductItemCtl(itemID, true);
                    Panel pnl = (Panel)this.ParentForm.Controls["panelUCHolder"];
                    try { objUpdate.categoryData = (Category)cmbCategory.SelectedItem; }
                    catch (Exception)
                    {
                    }
                    BaseForm fmr = ParentForm as BaseForm;
                    fmr.ScreenTitle = "";
                    pnl.Controls.Clear();
                    pnl.Controls.Add(objUpdate);

                }
                if (e.ColumnIndex == 12)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvFoodItem.Rows[e.RowIndex].Cells[0].Value);
                    AddProductItemCtl objUpdate = new AddProductItemCtl(itemID, false);
                    try { objUpdate.categoryData = (Category)cmbCategory.SelectedItem; }
                    catch (Exception)
                    {
                    }
                    Panel pnl = (Panel)this.ParentForm.Controls["panelUCHolder"];

                    try
                    {
                        BaseForm fmr = ParentForm as BaseForm;
                        fmr.ScreenTitle = "";
                    }
                    catch (Exception) { }

                       pnl.Controls.Clear();
                    pnl.Controls.Clear();

                    pnl.Controls.Add(objUpdate);

                }

                if (e.ColumnIndex == 13)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvFoodItem.Rows[e.RowIndex].Cells[0].Value);
                    AddProductItemCtl objUpdate = new AddProductItemCtl(itemID);
                   try{ objUpdate.categoryData = (Category) cmbCategory.SelectedItem;}
                    catch(Exception)
                    {
                    }
                    Panel pnl = (Panel)this.ParentForm.Controls["panelUCHolder"];

                    try
                    {
                        BaseForm fmr = ParentForm as BaseForm;
                        fmr.ScreenTitle = "";
                    }
                    catch (Exception) { }

                    pnl.Controls.Clear();
                    pnl.Controls.Clear();

                    pnl.Controls.Add(objUpdate);
                }
                else if (e.ColumnIndex == 14)
                {
                    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)
            {
               MessageBox.Show(exp.Message);
               return;
            }
        }
コード例 #3
0
ファイル: ProductItemCtll.cs プロジェクト: Jusharra/RMS
        private void btnAddParentCategory_Click(object sender, EventArgs e)
        {
            try
            {

                AddProductItemCtl objAddFoodItem = new AddProductItemCtl();
                objAddFoodItem.Parent = this.ParentForm;
            //    UserControlManager.UserControls.Push(this);
                Panel pnl = (Panel)this.ParentForm.Controls["panelUCHolder"];

                string s = pnl.Name;

             //   objAddFoodItem.Margin = 5;
                objAddFoodItem.Dock = DockStyle.Fill;
                pnl.Controls.Clear();
                pnl.Controls.Add(objAddFoodItem);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }