/// <summary> /// Grid cell double click for update or delete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSize_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { if (dgvSize.CurrentRow.Cells["dgvtxtsizeId"].Value != null && dgvSize.CurrentRow.Cells["dgvtxtsizeId"].Value.ToString()!=string.Empty) { decSizeId = Convert.ToDecimal(dgvSize.CurrentRow.Cells["dgvtxtsizeId"].Value.ToString()); if (decSizeId != 1) { SizeBll BllSize = new SizeBll(); SizeInfo infoSize = new SizeInfo(); infoSize = BllSize.SizeViewing(decSizeId); txtSize.Text = infoSize.Size; txtNarration.Text = infoSize.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; txtSize.Focus(); } else { Messages.InformationMessage(" NA Size canot update or delete"); Clear(); } } } } catch (Exception ex) { MessageBox.Show("SZ12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// GridFill function /// </summary> public void GridFill() { try { List<DataTable> listObj = new List<DataTable>(); SizeBll BllSize = new SizeBll(); listObj = BllSize.SizeViewAlling(); dgvSize.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show("SZ1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Save Function /// </summary> public void SaveFunction() { try { SizeBll BllSize = new SizeBll(); SizeInfo infoSize = new SizeInfo(); infoSize.Size = txtSize.Text.Trim(); infoSize.Narration = txtNarration.Text.Trim(); infoSize.Extra1 = String.Empty; infoSize.Extra2 = String.Empty; if (BllSize.SizeNameCheckExistence(txtSize.Text.Trim().ToString(), 0) == false) { decIdentity = BllSize.SizeAdding(infoSize); if (decIdentity>0) { Messages.SavedMessage(); GridFill(); Clear(); } } else { Messages.InformationMessage(" Size already exist"); txtSize.Focus(); } } catch (Exception ex) { MessageBox.Show("SZ2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Edit Function /// </summary> public void EditFunction() { try { SizeBll BllSize = new SizeBll(); SizeInfo infoSize = new SizeInfo(); infoSize.Size = txtSize.Text.Trim(); infoSize.Narration = txtNarration.Text.Trim(); infoSize.Extra1 = String.Empty; infoSize.Extra2 = String.Empty; infoSize.SizeId = decSizeId; if (BllSize.SizeNameCheckExistence(txtSize.Text.Trim().ToString(), decSizeId) == false) { if (BllSize.SizeEditing(infoSize)) { Messages.UpdatedMessage(); GridFill(); Clear(); } } else { Messages.InformationMessage("Size already exist"); txtSize.Focus(); } } catch (Exception ex) { MessageBox.Show("SZ3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Delete Function /// </summary> public void DeleteFunction() { try { SizeBll BllSize= new SizeBll(); if (BllSize.SizeDeleting(decSizeId) <= 0) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); GridFill(); Clear(); } } catch (Exception ex) { MessageBox.Show("SZ5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Size combobox /// </summary> public void SizeComboFill() { try { List<DataTable> listObj = new List<DataTable>(); SizeBll BllSize = new SizeBll(); listObj = BllSize.SizeViewAll(); DataRow dr = listObj[0].NewRow(); dr["size"] = "All"; dr["sizeId"] = 0; listObj[0].Rows.InsertAt(dr, 0); cmbSize.DataSource = listObj[0]; cmbSize.DisplayMember = "size"; cmbSize.ValueMember = "sizeId"; } catch (Exception ex) { MessageBox.Show("ST:6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//-------------------------------------------------------------SizeComboFill--------------------------- public void SizeComboFill() { try { List<DataTable> listObj = new List<DataTable>(); SizeBll BllSize = new SizeBll(); listObj = BllSize.SizeViewAll(); cmbSize.DataSource = listObj[0]; cmbSize.DisplayMember = "size"; cmbSize.ValueMember = "sizeId"; cmbSize.SelectedValue = 1; } catch (Exception ex) { MessageBox.Show("PC:45" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Size combobox /// </summary> public void SizeComboFill() { try { SizeBll BllSize = new SizeBll(); listObjSize = BllSize.SizeViewAll(); dgvcmbSize.DataSource = listObjSize[0]; dgvcmbSize.ValueMember = "sizeId"; dgvcmbSize.DisplayMember = "size"; SettingsBll BllSettings = new SettingsBll(); } catch (Exception ex) { MessageBox.Show("MPC8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }