/// <summary> /// Save Or Edit Function /// </summary> public void SaveOrEdit() { try { bool isOk = true; if (cbxShowCompanyNAmeAs.Checked && txtShowCompanyName.Text.Trim() == string.Empty) { MessageBox.Show("Enter company code", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); txtShowCompanyName.Focus(); isOk = false; } else if ((cbxShowPurchaseRate.Checked && CheckGroupBox()) || (!cbxShowPurchaseRate.Checked)) { if (PublicVariables.isMessageAdd) { if (Messages.SaveMessage()) { isOk = true; } else { isOk = false; } } if (isOk) { BarcodeSettingsInfo InfoSettings = new BarcodeSettingsInfo(); InfoSettings.ShowMRP = cbxShowMrp.Checked; InfoSettings.ShowProductCode = rbtnShowProductCode.Checked; InfoSettings.ShowCompanyName = cbxShowCompanyNAmeAs.Checked; InfoSettings.ShowPurchaseRate = cbxShowPurchaseRate.Checked; InfoSettings.CompanyName = txtShowCompanyName.Text.Trim(); InfoSettings.Zero = txtZero.Text.Trim(); InfoSettings.One = txtOne.Text.Trim(); InfoSettings.Two = txtTwo.Text.Trim(); InfoSettings.Three = txtThree.Text.Trim(); InfoSettings.Four = txtFour.Text.Trim(); InfoSettings.Five = txtFive.Text.Trim(); InfoSettings.Six = txtSix.Text.Trim(); InfoSettings.Seven = txtSeven.Text.Trim(); InfoSettings.Eight = txtEight.Text.Trim(); InfoSettings.Nine = txtNine.Text.Trim(); InfoSettings.Point = txtPoint.Text.Trim(); InfoSettings.Extra1 = string.Empty; InfoSettings.Extra2 = string.Empty; BarcodeSettingsSP spbarcodesetting = new BarcodeSettingsSP(); spbarcodesetting.BarcodeSettingsAdd(InfoSettings); Messages.SavedMessage(); this.Close(); } } } catch (Exception ex) { MessageBox.Show("BS5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to check the Barcode settings /// </summary> public void BarcodeSettingsViewAll() { try { BarcodeSettingsSP spbarcodesettings = new BarcodeSettingsSP(); DataTable dtbl = new DataTable(); dtbl = spbarcodesettings.BarcodeSettingsViewAll(); foreach (DataRow dr in dtbl.Rows) { if (dr["showMRP"].ToString() == "True") { cbxShowMrp.Checked = true; } else { cbxShowMrp.Checked = false; } if (dr["showPurchaseRate"].ToString() == "True") { cbxShowPurchaseRate.Checked = true; } else { cbxShowPurchaseRate.Checked = false; } if (dr["showCompanyName"].ToString() == "True") { cbxShowCompanyNAmeAs.Checked = true; } else { cbxShowCompanyNAmeAs.Checked = false; } if (dr["showProductCode"].ToString() == "True") { rbtnShowProductCode.Checked = true; } else { rbtnShowProductName.Checked = true; } txtShowCompanyName.Text = dr["companyName"].ToString(); if (cbxShowPurchaseRate.Checked == true) { txtEight.Text = dr["eight"].ToString(); txtFive.Text = dr["five"].ToString(); txtFour.Text = dr["four"].ToString(); txtNine.Text = dr["nine"].ToString(); txtOne.Text = dr["one"].ToString(); txtPoint.Text = dr["point"].ToString(); txtSeven.Text = dr["seven"].ToString(); txtSix.Text = dr["six"].ToString(); txtThree.Text = dr["three"].ToString(); txtTwo.Text = dr["two"].ToString(); txtZero.Text = dr["zero"].ToString(); } } } catch (Exception ex) { MessageBox.Show("BS6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Setting the check box Status /// </summary> public void FillSettings() { try { BarcodeSettingsInfo Info = new BarcodeSettingsSP().BarcodeSettingsView(1); if (Info.ShowMRP == true) { cbxShowMrp.Checked = true; } else { cbxShowMrp.Checked = false; } if (Info.ShowProductCode == true) { rbtnShowProductCode.Checked = true; } else { rbtnShowProductName.Checked = true; } if (Info.ShowCompanyName == true) { cbxShowCompanyNAmeAs.Checked = true; } else { cbxShowCompanyNAmeAs.Checked = false; } if (Info.ShowPurchaseRate == true) { cbxShowPurchaseRate.Checked = true; } else { cbxShowPurchaseRate.Checked = false; } txtShowCompanyName.Text = Info.CompanyName; if (txtShowCompanyName.Text == string.Empty) { CompanyInfo InfoCompany = new CompanyInfo(); CompanySP Sp = new CompanySP(); InfoCompany = Sp.CompanyView(1); txtShowCompanyName.Text = InfoCompany.CompanyName; } txtZero.Text = Info.Zero; txtOne.Text = Info.One; txtTwo.Text = Info.Two; txtThree.Text = Info.Three; txtFour.Text = Info.Four; txtFive.Text = Info.Five; txtSix.Text = Info.Six; txtSeven.Text = Info.Seven; txtEight.Text = Info.Eight; txtNine.Text = Info.Nine; txtPoint.Text = Info.Point; } catch (Exception ex) { MessageBox.Show("BS4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }