/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { GodownInfo infoGodown = new GodownInfo(); GodownBll BllGodown = new GodownBll(); infoGodown.GodownName = txtGodownName.Text.Trim(); infoGodown.Narration = txtNarration.Text.Trim(); infoGodown.Extra1 = string.Empty; infoGodown.Extra2 = string.Empty; if (BllGodown.GodownCheckIfExist(txtGodownName.Text.Trim(), 0) == false) { decIdForOtherForms = BllGodown.GodownAddWithoutSameName(infoGodown); RackAddCurrespondingtoGodown(); if (decIdForOtherForms > 0) { Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage("Godown name already exist"); txtGodownName.Focus(); } } catch (Exception ex) { MessageBox.Show("G4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill datagridview /// </summary> public void Gridfill() { try { List <DataTable> listGodown = new List <DataTable>(); GodownBll BllGodown = new GodownBll(); listGodown = BllGodown.GodownOnlyViewAll(); dgvGodown.DataSource = listGodown[0]; } catch (Exception ex) { MessageBox.Show("G7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill cmbGodown /// </summary> public void FillGodownCombo() { try { GodownBll BllGodown = new GodownBll(); List <DataTable> listGodown = new List <DataTable>(); listGodown = BllGodown.GodownViewAll(); cmbGodown.DataSource = listGodown[0]; cmbGodown.ValueMember = "godownId"; cmbGodown.DisplayMember = "godownName"; } catch (Exception ex) { MessageBox.Show("R1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill controls for update /// </summary> public void FillControls() { try { GodownInfo infoGodown = new GodownInfo(); GodownBll BllGodown = new GodownBll(); infoGodown = BllGodown.GodownWithNarrationView(Convert.ToDecimal(dgvGodown.CurrentRow.Cells[1].Value.ToString())); txtGodownName.Text = infoGodown.GodownName; txtNarration.Text = infoGodown.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; decGodownId = infoGodown.GodownId; strGodownName = infoGodown.GodownName; } catch (Exception ex) { MessageBox.Show("G11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill cmbGodownSearch /// </summary> public void FillSearchCombo() { try { GodownBll BllGodown = new GodownBll(); List <DataTable> listGodown = new List <DataTable>(); listGodown = BllGodown.GodownViewAll(); cmbGodownSearch.DataSource = listGodown[0]; DataRow dr = listGodown[0].NewRow(); dr[1] = "All"; listGodown[0].Rows.InsertAt(dr, 0); cmbGodownSearch.ValueMember = "godownId"; cmbGodownSearch.DisplayMember = "godownName"; } catch (Exception ex) { MessageBox.Show("R2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Godown combobox /// </summary> public void GodownComboFill() { try { List <DataTable> listObj = new List <DataTable>(); GodownBll BllGodown = new GodownBll(); listObj = BllGodown.GodownViewAll(); DataRow dr = listObj[0].NewRow(); dr["godownName"] = "All"; dr["godownId"] = 0; listObj[0].Rows.InsertAt(dr, 0); cmbGodown.DataSource = listObj[0]; cmbGodown.DisplayMember = "godownName"; cmbGodown.ValueMember = "godownId"; } catch (Exception ex) { MessageBox.Show("ST:5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete /// </summary> public void DeleteFunction() { try { GodownBll BllGodown = new GodownBll(); if (BllGodown.GodownCheckReferenceAndDelete(decGodownId) <= 0) { Messages.ReferenceExistsMessage(); } else { Clear(); btnSave.Text = "Save"; Messages.DeletedMessage(); } } catch (Exception ex) { MessageBox.Show("G8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to Edit /// </summary> public void EditFunction() { try { GodownInfo infoGodown = new GodownInfo(); GodownBll BllGodown = new GodownBll(); infoGodown.GodownName = txtGodownName.Text.Trim(); infoGodown.Narration = txtNarration.Text.Trim(); infoGodown.Extra1 = string.Empty; infoGodown.Extra2 = string.Empty; infoGodown.GodownId = Convert.ToDecimal(dgvGodown.CurrentRow.Cells["dgvtxtGodownId"].Value.ToString()); if (txtGodownName.Text != strGodownName) { if (BllGodown.GodownCheckIfExist(txtGodownName.Text.Trim(), decGodownId) == false) { if (BllGodown.GodownEditParticularField(infoGodown)) { Messages.UpdatedMessage(); Clear(); } } else { Messages.InformationMessage("Godown name already exist"); txtGodownName.Focus(); } } else { BllGodown.GodownEditParticularField(infoGodown); Messages.UpdatedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("G5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }