/// <summary> /// Save Function /// </summary> public void SaveFunction() { try { SizeSP spSize = new SizeSP(); SizeInfo infoSize = new SizeInfo(); infoSize.Size = txtSize.Text.Trim(); infoSize.Narration = txtNarration.Text.Trim(); infoSize.Extra1 = String.Empty; infoSize.Extra2 = String.Empty; if (spSize.SizeNameCheckExistence(txtSize.Text.Trim().ToString(), 0) == false) { decIdentity = spSize.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> /// GridFill function /// </summary> public void GridFill() { try { DataTable dtbl = new DataTable(); SizeSP spSize = new SizeSP(); dtbl = spSize.SizeViewAlling(); dgvSize.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("SZ1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Delete Function /// </summary> public void DeleteFunction() { try { SizeSP spSize = new SizeSP(); if (spSize.SizeDeleting(decSizeId) <= 0) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); GridFill(); Clear(); } } catch (Exception ex) { MessageBox.Show("SZ5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Delete Function /// </summary> public void DeleteFunction() { try { SizeSP spSize = new SizeSP(); if (spSize.SizeDeleting(decSizeId) <= 0) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); GridFill(); Clear(); } } catch (Exception ex) { formMDI.infoError.ErrorString = "SZ5" + ex.Message; } }
/// <summary> /// Function to fill the Size combobox /// </summary> public void SizeComboFill() { try { SizeSP spSize = new SizeSP(); DataTable dtblSize = new DataTable(); dtblSize = spSize.SizeViewAll(); DataRow dr = dtblSize.NewRow(); dr[1] = "All"; dtblSize.Rows.InsertAt(dr, 0); cmbSize.DataSource = dtblSize; cmbSize.ValueMember = "sizeId"; cmbSize.DisplayMember = "size"; } catch (Exception ex) { MessageBox.Show("PSP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//-------------------------------------------------------------SizeComboFill--------------------------- public void SizeComboFill() { try { DataTable dtbl = new DataTable(); SizeSP spSize = new SizeSP(); dtbl = spSize.SizeViewAll(); cmbSize.DataSource = dtbl; cmbSize.DisplayMember = "size"; cmbSize.ValueMember = "sizeId"; cmbSize.SelectedValue = 1; } catch (Exception ex) { MessageBox.Show("PC:45" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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) { SizeSP spSize = new SizeSP(); SizeInfo infoSize = new SizeInfo(); infoSize = spSize.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> /// Delete Function /// </summary> public void DeleteFunction() { try { SizeSP spSize = new SizeSP(); if (spSize.SizeDeleting(decSizeId) <=0) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); GridFill(); Clear(); } } catch (Exception ex) { MessageBox.Show("SZ5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Edit Function /// </summary> public void EditFunction() { try { SizeSP spSize = new SizeSP(); 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 (spSize.SizeNameCheckExistence(txtSize.Text.Trim().ToString(), decSizeId) == false) { if (spSize.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> /// Function to fill Size combobox /// </summary> public void SizeComboFill() { try { SizeSP spSize = new SizeSP(); dtblSize = spSize.SizeViewAll(); dgvcmbSize.DataSource = dtblSize; dgvcmbSize.ValueMember = "sizeId"; dgvcmbSize.DisplayMember = "size"; SettingsSP spSettings = new SettingsSP(); } catch (Exception ex) { MessageBox.Show("MPC8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }