Ejemplo n.º 1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            frmCostCenterList objfrm = new frmCostCenterList();

            objfrm.onAddAllButtonClicked = new frmCostCenterList.AddAllClick(DisplayReqList);
            objfrm.lngFormPriv           = lngFormPriv;
            objfrm.Show();
            objfrm.MdiParent = this.MdiParent;
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (uctxtCostCategory.Text == "")
            {
                MessageBox.Show("Name Cannot be Empty");
                uctxtCostCategory.Focus();
                return;
            }
            if (uctxtCostCenter.Text == "")
            {
                MessageBox.Show("Name Cannot be Empty");
                uctxtCostCenter.Focus();
                return;
            }
            if (uctxtOldCostCenter.Text == "")
            {
                if (Utility.gblnAccessControl)
                {
                    if (!Utility.glngGetPriviliges(strComID, Utility.gstrUserName, lngFormPriv, 1))
                    {
                        MessageBox.Show("You have no Permission to Access", "Privileges", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                string strDuplicate = Utility.mCheckDuplicateItem(strComID, "VECTOR_MASTER", "VMASTER_NAME", uctxtCostCenter.Text);
                if (strDuplicate != "")
                {
                    MessageBox.Show(strDuplicate);
                    uctxtCostCenter.Focus();
                    return;
                }

                var strResponseInsert = MessageBox.Show("Do You Want to Save?", "Save Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (strResponseInsert == DialogResult.Yes)
                {
                    try
                    {
                        string strmsg = accms.mInsertCostCenter(strComID, uctxtCostCenter.Text, uctxtCostCategory.Text);
                        if (Utility.gblnAccessControl)
                        {
                            string strAudit = Utility.gblnAuditTrail(Utility.gstrUserName, DateTime.Now.ToString("dd/MM/yyyy"), "Cost Center", uctxtCostCenter.Text,
                                                                     1, 0, (int)Utility.MODULE_TYPE.mtACCOUNT, "0001");
                        }
                        //mLoadCostCenter();
                        //uctxtCostCategory.Text = "";
                        uctxtOldCostCenter.Text = "";
                        uctxtCostCenter.Text    = "";
                        uctxtCostCenter.Focus();
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            else
            {
                if (Utility.gblnAccessControl)
                {
                    if (!Utility.glngGetPriviliges(strComID, Utility.gstrUserName, lngFormPriv, 2))
                    {
                        MessageBox.Show("You have no Permission to Access", "Privileges", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                if (uctxtOldCostCenter.Text != uctxtCostCenter.Text)
                {
                    string strDuplicate = Utility.mCheckDuplicateItem(strComID, "VECTOR_MASTER", "VMASTER_NAME", uctxtCostCenter.Text);
                    if (strDuplicate != "")
                    {
                        MessageBox.Show(strDuplicate);
                        uctxtCostCenter.Focus();
                        return;
                    }
                }


                var strResponseUpdate = MessageBox.Show("Do You Want to Update?", "Update Button", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (strResponseUpdate == DialogResult.Yes)
                {
                    try
                    {
                        string strmsg = accms.mUpdateCostCenter(strComID, uctxtOldCostCenter.Text, uctxtCostCenter.Text, uctxtCostCategory.Text);
                        if (Utility.gblnAccessControl)
                        {
                            string strAudit = Utility.gblnAuditTrail(Utility.gstrUserName, DateTime.Now.ToString("dd/MM/yyyy"), "Cost Center", uctxtCostCenter.Text,
                                                                     2, 0, (int)Utility.MODULE_TYPE.mtACCOUNT, "0001");
                        }
                        uctxtCostCategory.Text  = "";
                        uctxtOldCostCenter.Text = "";
                        uctxtCostCenter.Text    = "";
                        uctxtCostCenter.Focus();
                        frmCostCenterList objfrm = new frmCostCenterList();
                        objfrm.onAddAllButtonClicked = new frmCostCenterList.AddAllClick(DisplayReqList);
                        objfrm.Show();
                        objfrm.MdiParent = this.MdiParent;
                    }

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