/// <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> /// GridGodownComboFill /// </summary> public void GridGodownComboFill(decimal decProductId, int inRow, int inCol) { try { GodownBll BllGodown = new GodownBll(); List<DataTable> listGodown = new List<DataTable>(); listGodown = BllGodown.GodownViewAll(); dgvcmbGodown.DataSource = listGodown[0]; DataGridViewComboBoxCell dgvcmbGodownCell = (DataGridViewComboBoxCell)dgvProduct.Rows[inRow].Cells[inCol]; dgvcmbGodownCell.DataSource = listGodown[0]; dgvcmbGodown.ValueMember = "godownId"; dgvcmbGodown.DisplayMember = "godownName"; } catch (Exception ex) { MessageBox.Show("DN31: " + 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 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 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 add the products to grid /// </summary> public void AddToGrid() { BatchBll BllBatch = new BatchBll(); GodownBll BllGodown = new GodownBll(); try { SettingsBll BllSettings = new SettingsBll(); if (txtProductCode.Text.Trim() == null && txtProductCode.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter product code"); txtProductCode.Focus(); } else if (cmbItem.SelectedIndex == -1 && cmbItem.SelectedValue == null) { Messages.InformationMessage("Select a product"); cmbItem.Focus(); } else if (Convert.ToDecimal(txtQuantity.Text.Trim()) <= 0 || txtQuantity.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter quantity"); txtQuantity.Focus(); } else if (cmbUnit.SelectedValue == null) { Messages.InformationMessage("Select a unit"); cmbUnit.Focus(); } else if (BllSettings.SettingsStatusCheck("AllowZeroValueEntry") == "No" && decimal.Parse(txtRate.Text.Trim()) <= 0 || txtRate.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter rate"); txtRate.Focus(); } else { int inCurrentRowIndex = new int(); bool isExecutef = false; if (rowIdToEdit == 0) { dgvPointOfSales.Rows.Add(); inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1; isExecutef = true; } else { for (int i = 0; i < dgvPointOfSales.Rows.Count; ++i) { if (dgvPointOfSales.Rows[i].Cells["rowId"].Value.ToString() == rowIdToEdit.ToString()) { isExecutef = true; inCurrentRowIndex = i; break; } } } if (!isExecutef) { dgvPointOfSales.Rows.Add(); inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1; } ProductInfo infoProduct = new ProductInfo(); BatchInfo infoBatch = new BatchInfo(); RackInfo infoRack = new RackInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); UnitConvertionInfo InfoUnitConvertion = new UnitConvertionInfo(); infoProduct = BllProductCreation.ProductView(decProductId); decimal dcProductBatch = BllBatch.BatchIdViewByProductId(decProductId); InfoUnitConvertion = new UnitConvertionBll().UnitViewAllByProductId(decProductId); infoBatch = BllBatch.BatchView(dcProductBatch); decimal dcGodownId = infoProduct.GodownId; GodownInfo infoGodown = new GodownInfo(); infoGodown = BllGodown.GodownView(dcGodownId); decimal dcRackId = infoProduct.RackId; infoRack = new RackBll().RackView(dcRackId); dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = txtProductCode.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = cmbItem.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtQuantity"].Value = txtQuantity.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnit"].Value = cmbUnit.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = txtRate.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGrossValue"].Value = txtGrossValue.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxPercentage"].Value = cmbTax.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxAmount"].Value = txtTaxAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtNetAmount"].Value = txtNetAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtDiscount"].Value = txtDiscountAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTotalAmount"].Value = txtAmount.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxttaxid"].Value = Convert.ToDecimal(cmbTax.SelectedValue); dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchId"].Value = dcProductBatch; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackId"].Value = infoProduct.RackId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownId"].Value = infoProduct.GodownId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnitId"].Value = Convert.ToDecimal(cmbUnit.SelectedValue); dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtunitconversionId"].Value = InfoUnitConvertion.UnitconvertionId; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = txtBarcode.Text; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchno"].Value = infoBatch.BatchNo; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownName"].Value = infoGodown.GodownName; dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackName"].Value = infoRack.RackName; TotalAmountCalculation(); ClearGroupbox(); dgvPointOfSales.CurrentCell = dgvPointOfSales[0, dgvPointOfSales.Rows.Count - 1]; txtBarcode.Focus(); } } catch (Exception ex) { MessageBox.Show("POS:34" + 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 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 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); } }
//--------------------------------------------------------------ReturnFromGodownForm---------------------------- /// <summary> /// Function to fill godown combobox while return from godown when creating new godown /// </summary> /// <param name="decId"></param> public void ReturnFromGodownForm(decimal decId) { try { if (!isCallFromGrid) { GodownComboFill(); if (decId.ToString() != "0") { cmbDefaultGodown.SelectedValue = decId; } else if (strGodownName != string.Empty) { cmbDefaultGodown.SelectedValue = strGodownName; } else { cmbDefaultGodown.SelectedIndex = -1; } this.Enabled = true; cmbDefaultGodown.Focus(); this.WindowState = FormWindowState.Normal; this.Activate(); } else { DataGridViewComboBoxCell dgvGodownCell = (DataGridViewComboBoxCell)dgvProductCreation[dgvProductCreation.Columns["dgvcmbtgodown"].Index, dgvProductCreation.CurrentRow.Index]; DataGridViewComboBoxCell dgvRackCell = (DataGridViewComboBoxCell)dgvProductCreation[dgvProductCreation.Columns["dgvcmbrack"].Index, dgvProductCreation.CurrentRow.Index]; List<DataTable> listObj = new List<DataTable>(); GodownBll BllGodown = new GodownBll(); listObj = BllGodown.GodownViewAll(); dgvcmbtgodown.DataSource = listObj[0]; if (decId.ToString() != "0") { dgvProductCreation.CurrentRow.Cells["dgvcmbtgodown"].Value = decId; dgvRackCell.DataSource = null; } } } catch (Exception ex) { MessageBox.Show("PC:39" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill godown combobox in grid /// </summary> public void GodownGrigComboFill() { try { List<DataTable> listObj = new List<DataTable>(); GodownBll BllGodown = new GodownBll(); listObj = BllGodown.GodownViewAll(); DataRow drow = listObj[0].NewRow(); drow["godownName"] = string.Empty; drow["godownId"] = 0; listObj[0].Rows.InsertAt(drow, 0); dgvcmbtgodown.DataSource = listObj[0]; dgvcmbtgodown.DisplayMember = "godownName"; dgvcmbtgodown.ValueMember = "godownId"; } catch (Exception ex) { MessageBox.Show("PC:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill godown combobox in grid /// </summary> public void GodownComboFill() { try { List<DataTable> listObj = new List<DataTable>(); GodownBll BllGodown = new GodownBll(); listObj = BllGodown.GodownViewAll(); cmbDefaultGodown.DataSource = listObj[0]; cmbDefaultGodown.DisplayMember = "godownName"; cmbDefaultGodown.ValueMember = "godownId"; cmbDefaultGodown.SelectedValue = 1; } catch (Exception ex) { MessageBox.Show("PC:49" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the godown combobox /// </summary> public void DGVGodownComboFill() { try { GodownBll bllGodown = new GodownBll(); List<DataTable> ListObj = new List<DataTable>(); ListObj = bllGodown.GodownViewAll(); dgvcmbGodown.DataSource = ListObj[0]; dgvcmbGodown.ValueMember = "godownId"; dgvcmbGodown.DisplayMember = "godownName"; } catch (Exception ex) { MessageBox.Show("MR22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Godown Combobox /// </summary> public void GoDownComboFill() { try { GodownBll BllGodown = new GodownBll(); List<DataTable> listObj = new List<DataTable>(); listObj = BllGodown.GodownViewAll(); cmbGoDown.DataSource = listObj[0]; cmbGoDown.ValueMember = "godownId"; cmbGoDown.DisplayMember = "godownName"; if (GodownStatus()) { cmbGoDown.Enabled = true; btnGodownAdd.Enabled = true; btnRackAdd.Visible = false; if (listObj[0].Rows.Count == 1) { cmbRack.Enabled = true; btnRackAdd.Visible = true; RackComboFillByGodown(Convert.ToDecimal(cmbGoDown.SelectedValue)); } } else { cmbGoDown.Enabled = false; btnGodownAdd.Enabled = false; } } catch (Exception ex) { MessageBox.Show("MPC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }