/// <summary> /// Function To edit existing productgroup /// </summary> private void EditFunction() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); infoProductGroup.GroupId = Convert.ToDecimal(dgvProductGroup.CurrentRow.Cells["dgvtxtgroupId"].Value); infoProductGroup.GroupName = txtProductGroupName.Text.Trim(); infoProductGroup.GroupUnder = Convert.ToDecimal(cmbUnder.SelectedValue.ToString()); infoProductGroup.Narration = txtNarration.Text.Trim(); infoProductGroup.Extra1 = string.Empty; infoProductGroup.Extra2 = string.Empty; if (spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim().ToString(), decId) == false) { spProductGroup.ProductGroupEdit(infoProductGroup); Messages.UpdatedMessage(); ProductGroupUnderComboFill(); ProductGroupUnderComboFillForSearch(); GridFill(); Clear(); txtProductGroupName.Focus(); } else { Messages.InformationMessage(" Product group already exists"); txtProductGroupName.Focus(); } } catch (Exception ex) { MessageBox.Show("PG5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvDailyAttendanceReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); DailyAttendanceMasterSP spDailyAttendanceMaster = new DailyAttendanceMasterSP(); DataTable dtblAttendance = spDailyAttendanceMaster.DailyAttendanceViewForDailyAttendanceReport(dtpDate.Text.Trim(), cmbStatus.Text.Trim(), cmbEmployee.Text.Trim(), cmbDesignation.Text.Trim()); ds.Tables.Add(dtblAttendance); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.DailyAttendanceReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("DAR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save new rack /// </summary> public void SaveFunction() { try { RackBll BllRack = new RackBll(); RackInfo InfoRack = new RackInfo(); InfoRack.RackName = txtRackName.Text.Trim(); InfoRack.GodownId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString()); InfoRack.Narration = txtNarration.Text.Trim(); InfoRack.ExtraDate = DateTime.Now; InfoRack.Extra1 = string.Empty; InfoRack.Extra2 = string.Empty; decimal decGodounId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString()); if (BllRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false) { decIdForOtherForms = BllRack.RackAdd(InfoRack); if (decIdForOtherForms > 0) { Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage(" Rack name already exist"); txtRackName.Focus(); } } catch (Exception ex) { MessageBox.Show("R7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid based on the Search keys /// </summary> public void BillAllocationGridFill() { try { PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); if (cmbAccountGroup.SelectedIndex > -1 && cmbAccountLedger.SelectedIndex > -1) { if (cmbAccountGroup.SelectedItem.ToString() != "System.Data.DataRowView" || cmbAccountGroup.Text != "System.Data.DataRowView" && cmbAccountLedger.SelectedItem.ToString() != "System.Data.DataRowView" || cmbAccountLedger.Text != "System.Data.DataRowView") { if (Convert.ToDateTime(txtfromdate.Text) <= Convert.ToDateTime(txttodate.Text)) { List <DataTable> listObj = new List <DataTable>(); listObj = BllPartyBalance.BillAllocationSearch(Convert.ToDateTime(txtfromdate.Text), Convert.ToDateTime(txttodate.Text), cmbAccountGroup.Text, cmbAccountLedger.Text); dgvBillAllocation.DataSource = listObj[0]; } else { Messages.InformationMessage("Fromdate should be less than or equal to todate"); txttodate.Focus(); } } } } catch (Exception ex) { MessageBox.Show("BA:06" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvBonusDeductionReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); DataTable dtblBonusDeduction = spBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); ds.Tables.Add(dtblBonusDeduction); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.BonusDeductionReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("BDR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { DataSet dsfree = new DataSet(); try { SalesMasterSP spSalesMaster = new SalesMasterSP(); DateTime fromDate, toDate; fromDate = Convert.ToDateTime(txtFromDate.Text); toDate = Convert.ToDateTime(txtToDate.Text); string voucherNo = txtVoucherNo.Text.ToString(); decimal voucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); decimal groupId = Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()); decimal companyId = 1; decimal ledgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); decimal employeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString()); string productCode = cmbProductCode.Text.ToString(); dsfree = spSalesMaster.FreeSaleReportPrint(fromDate, toDate, voucherNo, voucherTypeId, groupId, productCode, ledgerId, employeeId, companyId); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; if (dgvFreeSalesReport.Rows.Count > 0) { frmReport.freeSaleReport(dsfree); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "FSR17:" + ex.Message; } }
/// <summary> /// On 'Save' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text)) { if (dgvAttendance.RowCount == 0) { Messages.InformationMessage("There is no employee in the selected date.Select another date"); txtCompanyCurrentdate.Focus(); } else { SaveOrEdit(); } } else { Messages.NoPrivillageMessage(); } } catch (Exception ex) { MessageBox.Show("A14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbCurrency_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { txtDate.Focus(); } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { frmCurrencyObj = new frmCurrencyDetails(); frmCurrencyObj.MdiParent = formMDI.MDIObj; if (cmbCurrency.SelectedIndex >= 0) { frmCurrencyObj.CallFromExchangerate(this, Convert.ToDecimal(cmbCurrency.SelectedValue.ToString())); } else { Messages.InformationMessage("Select Currency"); cmbCurrency.Focus(); } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) { SendKeys.Send("{F10}"); btnCurrencyAdd_Click(sender, e); } } catch (Exception ex) { MessageBox.Show("ER38:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to edit /// </summary> public void Editfunction() { try { ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo(); ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); infoExchangeRate.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()); infoExchangeRate.Date = Convert.ToDateTime(dtpDate.Text.Trim().ToString()); infoExchangeRate.Rate = Convert.ToDecimal(txtExchangeRate.Text.Trim().ToString()); infoExchangeRate.Narration = txtNarration.Text.Trim(); infoExchangeRate.Extra1 = String.Empty; infoExchangeRate.Extra2 = String.Empty; infoExchangeRate.ExchangeRateId = decId; if (BllExchangeRate.ExchangeRateCheckExistence(Convert.ToDateTime(txtDate.Text.Trim().ToString()), Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()), decExchangeRateId) == false) { if (ExchangeRateCheck()) { BllExchangeRate.ExchangeRateEdit(infoExchangeRate); Messages.UpdatedMessage(); SearchClear(); Clear(); } } else { Messages.InformationMessage("Already exists"); cmbCurrency.Focus(); } } catch (Exception ex) { MessageBox.Show("ER3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Check the repetation of raw-material /// </summary> public void GridCheckOfSameRawMaterial() { isMulProductCheck = false; try { foreach (DataGridViewRow dgvrowOne in dgvProductBOM.Rows) { foreach (DataGridViewRow dgvrowTwo in dgvProductBOM.Rows) { if (dgvrowOne.Index != dgvrowTwo.Index) { if (dgvrowOne.Cells["dgvcmbRawMaterial"].Value != null && dgvrowTwo.Cells["dgvcmbRawMaterial"].Value != null) if (dgvrowOne.Cells["dgvcmbRawMaterial"].Value.ToString() == dgvrowTwo.Cells["dgvcmbRawMaterial"].Value.ToString()) { isMulProductCheck = true; Messages.InformationMessage("Repeatation of same raw-material"); dgvProductBOM.Focus(); dgvProductBOM.CurrentCell = dgvProductBOM.Rows[dgvrowTwo.Index].Cells["dgvcmbRawMaterial"]; dgvProductBOM.BeginEdit(true); break; } } } if (isMulProductCheck == true) { break; } } } catch (Exception ex) { MessageBox.Show("PB:7" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click to print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvDailySalary.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblEmployee = spEmployee.EmployeeViewAllForDailySalaryReport(cmbEmployeeCode.Text, cmbDesignation.Text, Convert.ToDateTime(dtpFromDate.Text.ToString()), Convert.ToDateTime(dtpToDate.Text.ToString()), cmbStatus.Text); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblEmployee); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.DailySalaryReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "DSR9" + ex.Message; } }
/// <summary> /// Search button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, EventArgs e) { try { if (cmbBankAccount.SelectedIndex > -1) { if (cmbStatus.SelectedIndex > -1) { if (dtpStatrmentTo.Value >= dtpStatementFrom.Value) { BankReconciliationFill(); } else { Messages.InformationMessage("Statement date to less than statement date from"); txtStatementTo.Focus(); } } else { Messages.InformationMessage("Please select status"); cmbStatus.Focus(); } } else { Messages.InformationMessage("Please select bank account"); cmbBankAccount.Focus(); } } catch (Exception ex) { MessageBox.Show("BR:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save the new pricelist for the product /// </summary> public void SaveFunction() { try { PriceListSP spPriceList = new PriceListSP(); PriceListInfo infoPriceList = new PriceListInfo(); infoPriceList.ProductId = decProductMain; infoPriceList.PricinglevelId = decPricingLevelMain; infoPriceList.UnitId = decUnitId; infoPriceList.BatchId = Convert.ToDecimal(cmbBatch.SelectedValue.ToString()); infoPriceList.Rate = Convert.ToDecimal(txtRate.Text); infoPriceList.Extra1 = string.Empty; infoPriceList.Extra2 = string.Empty; if (spPriceList.PriceListCheckExistence(0, decPricingLevelMain, Convert.ToDecimal(cmbBatch.SelectedValue.ToString()), decProductMain) == true) { spPriceList.PriceListAdd(infoPriceList); Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage("Price List already exist for selected product and batches"); Clear(); } } catch (Exception ex) { MessageBox.Show("PLP2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Save' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text)) { if (dgvAttendance.RowCount == 0) { Messages.InformationMessage("There is no employee in the selected date.Select another date"); txtCompanyCurrentdate.Focus(); } else { SaveOrEdit(); } } else { Messages.NoPrivillageMessage(); } } catch (Exception ex) { formMDI.infoError.ErrorString = "A15:" + ex.Message; } }
/// <summary> /// On 'Print' button click to print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvDailySalary.RowCount > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll(); List <DataTable> listEmployee = BllEmployeeCreation.EmployeeViewAllForDailySalaryReport(cmbEmployeeCode.Text, cmbDesignation.Text, Convert.ToDateTime(dtpFromDate.Text.ToString()), Convert.ToDateTime(dtpToDate.Text.ToString()), cmbStatus.Text); List <DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(listEmployee[0]); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.DailySalaryReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("DSR9 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On Search button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, EventArgs e) { try { if (txtSalesRateFrom.Text == string.Empty) { txtSalesRateFrom.Text = "0"; } if (txtSalesRateTo.Text == string.Empty) { txtSalesRateTo.Text = "0"; } if (Convert.ToDecimal(txtSalesRateFrom.Text) > Convert.ToDecimal(txtSalesRateTo.Text)) { Messages.InformationMessage("Salesrateto should be greater than salesratefrom"); txtSalesRateTo.Focus(); } else { GridFill(); } } catch (Exception ex) { MessageBox.Show("PR12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click to print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvSalaryPackage.RowCount > 0) { frmReport frmreport = new frmReport(); DataSet ds = new DataSet(); SalaryPackageSP spSalaryPackage = new SalaryPackageSP(); CompanySP spCompany = new CompanySP(); DataTable dtblSalaryPackage = spSalaryPackage.SalaryPackageViewAllForSalaryPackageReport(cmbPackageName.Text, cmbStatus.Text); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblSalaryPackage); ds.Tables.Add(dtblCompany); frmreport.MdiParent = formMDI.MDIObj; frmreport.SalaryPackageReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "SPR:9 " + ex.Message; } }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { ModelNoBll BllModelNo = new ModelNoBll(); ModelNoInfo infoModelNo = new ModelNoInfo(); infoModelNo.ModelNo = txtModalNo.Text.Trim(); infoModelNo.Narration = txtNarration.Text.Trim(); infoModelNo.Extra1 = string.Empty; infoModelNo.Extra2 = string.Empty; if (BllModelNo.ModelCheckIfExist(txtModalNo.Text.Trim().ToString(), 0) == false) { decIdForOtherForms = BllModelNo.ModelNoAddWithDifferentModelNo(infoModelNo); if (decIdForOtherForms > 0) { Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage("Model number already exist"); txtModalNo.Focus(); } } catch (Exception ex) { MessageBox.Show("MN3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button clcik for print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { DataSet ds = new DataSet(); List <DataTable> listObjCompany = new List <DataTable>(); listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); DataTable dtblDetails = new DataTable(); dtblDetails = dtblSalesQuotationReport.Copy(); if (dtblSalesQuotationReport.Rows.Count > 0) { ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(dtblDetails); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.SalesQuotationReportPrinting(ds, txtTotalAmount.Text); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SQRP:12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save or edit function to check the references and invalid entries /// </summary> public void SaveOrEditFunction() { try { FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); if (PublicVariables.isMessageAdd) { if (Messages.SaveMessage()) { if (spFinancialYear.FinancialYearExistenceCheck(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text))) { SaveFunction(); } else { Messages.InformationMessage("Financial year already exist."); txtFromDate.Focus(); } } } else { SaveFunction(); } } catch (Exception ex) { formMDI.infoError.ErrorString = "NFY 3 : " + ex.Message; } }
/// <summary> /// Print button click, to print the selected details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { decimal decVoucherTypeId = 0; try { string strDeliveryMode = cmbDeliveryMode.Text; string strInvoiceNo = cmbOrderNo.Text; DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP(); if (dgvDeliveryNoteReport.RowCount > 0) { if (cmbVoucherType.Text == "All") { decVoucherTypeId = 0; } else { decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); } DataSet dsDeliveryNoteReport = spDeliveryNoteMaster.DeliveryNoteReportPrinting(1, Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decVoucherTypeId, this.dtpFromDate.Value, this.dtpToDate.Value, cmbStatus.Text, strDeliveryMode, strInvoiceNo); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.DeliveryNoteReportPrinting(dsDeliveryNoteReport); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "DNREP10:" + ex.Message; } }
/// <summary> /// On 'Print' button click to take print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvEmployeeAddressBook.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); EmployeeSP spEmployee = new EmployeeSP(); DataTable dtblEmployee = spEmployee.EmployeeViewAllForEmployeeAddressBook(cmbEmployeeCode.Text, txtMobile.Text, txtPhone.Text, txtEmail.Text); ds.Tables.Add(dtblEmployee); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.EmployeeAddressBookPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("EMP8 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { GodownInfo infoGodown = new GodownInfo(); GodownSP spGodown = new GodownSP(); infoGodown.GodownName = txtGodownName.Text.Trim(); infoGodown.Narration = txtNarration.Text.Trim(); infoGodown.Extra1 = string.Empty; infoGodown.Extra2 = string.Empty; if (spGodown.GodownCheckIfExist(txtGodownName.Text.Trim(), 0) == false) { decIdForOtherForms = spGodown.GodownAddWithoutSameName(infoGodown); RackAddCurrespondingtoGodown(); if (decIdForOtherForms > 0) { Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage("Godown name already exist"); txtGodownName.Focus(); } } catch (Exception ex) { formMDI.infoError.ErrorString = "G4:" + ex.Message; } }
/// <summary> /// Edit function /// </summary> public void EditFunction() { try { StandardRateInfo infoStandardRate = new StandardRateInfo(); StandardRateSP spStandardRate = new StandardRateSP(); infoStandardRate.StandardRateId = decStandardRate; infoStandardRate.ApplicableFrom = Convert.ToDateTime(txtFromDate.Text.ToString()); infoStandardRate.ApplicableTo = Convert.ToDateTime(txtToDate.Text.ToString()); infoStandardRate.ProductId = decProduct; infoStandardRate.UnitId = decUnitId; infoStandardRate.BatchId = Convert.ToDecimal(cmbBatch.SelectedValue); infoStandardRate.Rate = Convert.ToDecimal(txtRate.Text.ToString()); infoStandardRate.Extra1 = string.Empty; infoStandardRate.Extra2 = string.Empty; if (spStandardRate.StandardrateCheckExistence(decStandardRateId, Convert.ToDateTime(txtFromDate.Text.ToString()), Convert.ToDateTime(txtToDate.Text.ToString()), decProduct, infoStandardRate.BatchId) == false) { spStandardRate.StandardRateEdit(infoStandardRate); Messages.UpdatedMessage(); GridFill(decProduct); Clear(); } else { Messages.InformationMessage("Standard rate already exist for selected product and dates"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "SRP6" + ex.Message; } }
/// <summary> /// Calls frmEmployeePopup form to select and view Employee and enter key navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbEmployeeName_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { dtpMonth.Focus(); } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { frmEmployeeObj = new frmEmployeePopup(); frmEmployeeObj.MdiParent = formMDI.MDIObj; if (cmbEmployeeName.SelectedIndex > 0) { frmEmployeeObj.CallFromBonusDeductionregister(this, Convert.ToDecimal(cmbEmployeeName.SelectedValue.ToString())); } else { Messages.InformationMessage("Select employeename"); cmbEmployeeName.Focus(); } } } catch (Exception ex) { formMDI.infoError.ErrorString = "BDR12:" + ex.Message; } }
/// <summary> /// Function to call save or edit /// </summary> public void SaveOrEdit() { try { if (cmbEmployeeCode.SelectedIndex == -1) { Messages.InformationMessage("Select employee code"); cmbEmployeeCode.Focus(); } else if (txtBonusAmount.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter bonus Amount"); txtBonusAmount.Focus(); } else if (txtDeductionAmount.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter deduction Amount"); txtDeductionAmount.Focus(); } else { if (btnSave.Text == "Save") { if (PublicVariables.isMessageAdd) { if (Messages.SaveMessage()) { SaveFunction(); } } else { SaveFunction(); } } else { if (PublicVariables.isMessageEdit) { if (Messages.UpdateMessage()) { EditFunction(); } else { txtDate.Focus(); } } else { EditFunction(); } } } } catch (Exception ex) { MessageBox.Show("BD4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'save' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text)) { if (dgvChangeProductTax.RowCount < 1) { Messages.InformationMessage("There is no items in the grid"); cmbSearchBy.Focus(); } else { Save(); } } else { Messages.NoPrivillageMessage(); } } catch (Exception ex) { MessageBox.Show("CPT 15 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDeductionBll BllBonusDeduction = new BonusDeductionBll(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; if (BllBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction)) { Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage(" Employee bonus deduction already exist"); cmbEmployeeCode.Focus(); } } catch (Exception ex) { MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On doubleclicking on the grid, It displays the details to edit or delete a rack /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvRack_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { if (dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackName"].Value.ToString() != "NA") { RackBll BllRack = new RackBll(); RackInfo infoRack = new RackInfo(); decRackId = Convert.ToDecimal(dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackId"].Value.ToString()); infoRack = BllRack.RackView(decRackId); txtRackName.Text = infoRack.RackName; cmbGodown.SelectedValue = infoRack.GodownId.ToString(); txtNarration.Text = infoRack.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; strRackName = infoRack.RackName; txtRackName.Focus(); } else { Messages.InformationMessage("Default Rack cannot update or delete"); Clear(); } } } catch (Exception ex) { MessageBox.Show("R19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save new productgroup /// </summary> private void SaveFunction() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); infoProductGroup.GroupName = txtProductGroupName.Text.Trim(); infoProductGroup.GroupUnder = Convert.ToDecimal(cmbUnder.SelectedValue.ToString()); infoProductGroup.Narration = txtNarration.Text.Trim(); infoProductGroup.Extra1 = string.Empty; infoProductGroup.Extra2 = string.Empty; if (spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim(), 0) == false) { decIdForOtherForms = spProductGroup.ProductGroupAdd(infoProductGroup); Messages.SavedMessage(); ProductGroupUnderComboFill(); ProductGroupUnderComboFillForSearch(); GridFill(); Clear(); txtProductGroupName.Focus(); } else { Messages.InformationMessage("Product group already exists"); txtProductGroupName.Focus(); } } catch (Exception ex) { MessageBox.Show("PG4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }