private void btnEdit_Click(object sender, EventArgs e) { frmStockGroupList objfrm = new frmStockGroupList(); objfrm.lngFormPriv = lngFormPriv; objfrm.strFormName = strFormName; objfrm.onAddAllButtonClicked = new frmStockGroupList.AddAllClick(DisplayVoucherList); objfrm.Show(); objfrm.MdiParent = MdiParent; }
private void btnSave_Click(object sender, EventArgs e) { string i = "", strGRName = ""; int intPackSize = 0, intStatus = 0, intDilEffect = 0; // Interaction.SaveSetting(Application.ExecutablePath, "Group", "StockGROUP", txtGroupName.Text); RegistryKey rk = Registry.CurrentUser.CreateSubKey("SOFTWARE\\SmartAccounts"); rk.SetValue("StockGROUP", txtGroupName.Text); rk.Close(); 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("Group Name Cannot be Empty"); txtGroupName.Focus(); return; } if (txtUnder.Text == "") { MessageBox.Show("Group Under Cannot be Empty"); txtUnder.Focus(); return; } if (uctxtGroupConfig.Text != "") { strGRName = uctxtGroupConfig.Text; } else { strGRName = ""; } if (cboPackSize.Text == "Yes") { intPackSize = 1; } else { intPackSize = 0; } if (cboStatus.Text == "Yes") { intStatus = 0; } else { intStatus = 1; } if (cboDilEffect.Text == "Yes") { intDilEffect = 1; } else { intDilEffect = 0; } if (m_action == 1) { string strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_STOCKGROUP", "STOCKGROUP_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.mInsertGroup(strComID, txtGroupName.Text.ToString(), txtUnder.Text.ToString(), strGRName, intPackSize, intStatus, intDilEffect); if (i == "1") { 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 = ""; txtGroupName.Text = ""; txtSlNo.Text = ""; uctxtGroupConfig.Text = ""; cboPackSize.Text = "No"; m_action = (int)Utility.ACTION_MODE_ENUM.ADD_MODE; //mLoadGroupList(); if (mSingleEntry == 1) { mSingleEntry = 0; this.Dispose(); } } else { MessageBox.Show("Error!!!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } else { if (mstrOldGroup != txtGroupName.Text) { string strDuplicate = Utility.mCheckDuplicateItem(strComID, "INV_STOCKGROUP", "STOCKGROUP_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.mUpdateGroup(strComID, Convert.ToInt64(txtSlNo.Text), txtGroupName.Text.ToString(), txtUnder.Text.ToString(), strGRName, intPackSize, intStatus, intDilEffect); if (i == "1") { 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 = ""; uctxtGroupConfig.Text = ""; cboPackSize.Text = "No"; m_action = (int)Utility.ACTION_MODE_ENUM.EDIT_MODE; frmStockGroupList objfrm = new frmStockGroupList(); objfrm.lngFormPriv = lngFormPriv; objfrm.strFormName = strFormName; objfrm.onAddAllButtonClicked = new frmStockGroupList.AddAllClick(DisplayVoucherList); objfrm.Show(); objfrm.MdiParent = MdiParent; } else { MessageBox.Show("Error!!!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } }