Exemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            frmStockCategoryList objfrm = new frmStockCategoryList();

            objfrm.lngFormPriv           = lngFormPriv;
            objfrm.strFormName           = strFormName;
            objfrm.onAddAllButtonClicked = new frmStockCategoryList.AddAllClick(DisplayVoucherList);
            objfrm.Show();
            objfrm.MdiParent = MdiParent;
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string i = "";

            if (Utility.gblnAccessControl)
            {
                if (!Utility.glngGetPriviliges(strComID, Utility.gstrUserName, lngFormPriv, m_action))
                {
                    MessageBox.Show("You have no Permission to Access", "Privileges", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            if (txtGroupName.Text == "")
            {
                MessageBox.Show("Name Cannot be Empty");
                txtGroupName.Focus();
                return;
            }

            txtUnder.Text = "Primary";
            if (txtUnder.Text.ToUpper() != "PRIMARY")
            {
                MessageBox.Show("Name Should be Primary");
                txtUnder.Focus();
                return;
            }
            if (m_action == 1)
            {
                string strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_STOCKCATEGORY", "STOCKCATEGORY_NAME", txtGroupName.Text);
                if (strDuplicate != "")
                {
                    MessageBox.Show(strDuplicate);
                    txtGroupName.Text = "";
                    txtGroupName.Focus();
                    return;
                }

                var strResponseInsert = MessageBox.Show("Do You  want to Save?", "Save Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (strResponseInsert == DialogResult.Yes)
                {
                    try
                    {
                        i = invms.mInsertcategory(strComID, txtGroupName.Text.ToString(), txtUnder.Text.ToString());

                        if (i == "Inseretd...")
                        {
                            if (Utility.gblnAccessControl)
                            {
                                string strAudit = Utility.gblnAuditTrail(Utility.gstrUserName, DateTime.Now.ToString("dd/MM/yyyy"), strFormName, txtGroupName.Text,
                                                                         1, 0, (int)Utility.MODULE_TYPE.mtSTOCK, "0001");
                            }
                            btnNew.PerformClick();
                            txtGroupName.Focus();
                            txtUnder.Text     = "";
                            txtSlNo.Text      = "";
                            txtGroupName.Text = "";
                            m_action          = (int)Utility.ACTION_MODE_ENUM.ADD_MODE;

                            if (mSingleEntry == 1)
                            {
                                mSingleEntry = 0;
                                this.Dispose();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Error!!!");
                        }
                    }


                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            else
            {
                if (strOldPack != txtGroupName.Text)
                {
                    string strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_STOCKCATEGORY", "STOCKCATEGORY_NAME", txtGroupName.Text);
                    if (strDuplicate != "")
                    {
                        MessageBox.Show(strDuplicate);
                        txtGroupName.Focus();
                        return;
                    }
                }
                var strResponseInsert = MessageBox.Show("Do You Want to Update?", "Update Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (strResponseInsert == DialogResult.Yes)
                {
                    try
                    {
                        i = invms.mUpdatecategory(strComID, Convert.ToInt64(txtSlNo.Text), txtGroupName.Text.ToString(), txtUnder.Text.ToString());

                        if (i == "Updated...")
                        {
                            if (Utility.gblnAccessControl)
                            {
                                string strAudit = Utility.gblnAuditTrail(Utility.gstrUserName, DateTime.Now.ToString("dd/MM/yyyy"), strFormName, txtGroupName.Text,
                                                                         2, 0, (int)Utility.MODULE_TYPE.mtSTOCK, "0001");
                            }
                            btnNew.PerformClick();
                            txtGroupName.Focus();
                            txtUnder.Text     = "";
                            txtGroupName.Text = "";
                            txtSlNo.Text      = "";
                            m_action          = (int)Utility.ACTION_MODE_ENUM.ADD_MODE;
                            frmStockCategoryList objfrm = new frmStockCategoryList();
                            objfrm.lngFormPriv           = lngFormPriv;
                            objfrm.strFormName           = strFormName;
                            objfrm.onAddAllButtonClicked = new frmStockCategoryList.AddAllClick(DisplayVoucherList);
                            objfrm.Show();
                            objfrm.MdiParent = MdiParent;
                        }
                        else
                        {
                            MessageBox.Show("Error!!!");
                        }
                    }


                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
        }