//public PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec Get(String PRPDBatchID, long ActID) //{ // MRPDataSetPRPD dsMRP = new MRPDataSetPRPD(); // PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec objPRPDBatchActivityInstructionsCollec = new PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec(); // MainActivity_DL objMainActivity_DL = new MainActivity_DL(Connection); // PRPDBatch_DL objPRPDBatch_DL = new PRPDBatch_DL(Connection); // Machine_DL objMachine_DL = new Machine_DL(Connection); // try // { // da.FillByActID(dsMRP.tblPRPDBatchActivityInstructions,ActID); // foreach (MRPDataSetPRPD.tblPRPDBatchActivityInstructionsRow dr in dsMRP.tblPRPDBatchActivityInstructions) // { // PRPDBatchActivityInstructions objPRPDBatchActivityInstructions = new PRPDBatchActivityInstructions(); // objPRPDBatchActivityInstructions.PRPDBatch = objPRPDBatch_DL.Get(dr.PRPDBatchID); // objPRPDBatchActivityInstructions.Activity = objMainActivity_DL.Get(Convert.ToInt64(dr.ActivityID)); // if (!dr.IsMachineIDNull()) // { // objPRPDBatchActivityInstructions.Machine = objMachine_DL.Get(dr.MachineID); // } // objPRPDBatchActivityInstructions.InstructionDesc = dr.InstructionDesc; // objPRPDBatchActivityInstructions.ParticleSize = dr.ParticleSize; // objPRPDBatchActivityInstructions.PRPDBatchActivityInstructionsID = Convert.ToInt64(dr.PRPDBatchActivityInstructionsID); // objPRPDBatchActivityInstructionsCollec.Add(objPRPDBatchActivityInstructions); // } // return objPRPDBatchActivityInstructionsCollec; // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } // finally // { // dsMRP.Dispose(); // objMainActivity_DL = null; // objPRPDBatch_DL = null; // } //} public PRPDBatchActivityInstructions Get(long PRPDBatchActivityInstructionsID) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@PRPDBatchActivityInstructionsID", PRPDBatchActivityInstructionsID) }; DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_PRPDBatchActivityInstructionsByID", paramList); PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); if (dt.Rows.Count > 0) { obj.PRPDBatchActivityInstructionsID = Convert.ToInt64(dt.Rows[0]["PRPDBatchActivityInstructionsID"]); obj.PRPDBatch = objPRPDBatch_DL.Get(Convert.ToString(dt.Rows[0]["PRPDBatchID"])); obj.ActivityID = Convert.ToInt64(dt.Rows[0]["ActivityID"]); obj.MachineCode = Convert.ToString(dt.Rows[0]["MachineID"]); obj.Machine = objMachine_DL.Get(Convert.ToString(dt.Rows[0]["MachineID"])); obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(dt.Rows[0]["ActivityID"])); obj.ParticleSize = Convert.ToString(dt.Rows[0]["ParticleSize"]); obj.InstructionDesc = Convert.ToString(dt.Rows[0]["InstructionDesc"]); } return(obj); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void btnDelete_Click(object sender, EventArgs e) { try { DialogResult Result = new DialogResult(); Result = MessageBox.Show(this, "Are You Sure You Want to Delete the Selected Instructions ", "Delete Instructions", MessageBoxButtons.YesNo); if (Result == DialogResult.Yes) { PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); obj = objPRPDBatchActivityInstructions_DL.Get(Convert.ToInt64(dgvActivityInstructions.CurrentRow.Cells["colPRPDBatchActivityInstructionsID"].Value)); objPRPDBatchActivityInstructions_DL.Delete(obj); dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text); dgvActivityInstructions.AutoGenerateColumns = false; dgvActivityInstructions.DataSource = objSourceInstructions; objSourceInstructions.DataSource = dtPRPDBatchInstructions; objSourceInstructions.ResetBindings(true); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec Get() { try { DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_PRPDBatchActivityInstructions"); PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec objCollec = new PRPDBatchActivityInstructions.PRPDBatchActivityInstructionsCollec(); PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { obj.PRPDBatchActivityInstructionsID = Convert.ToInt64(dt.Rows[i]["PRPDBatchActivityInstructionsID"]); obj.PRPDBatch = objPRPDBatch_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchID"])); obj.Machine = objMachine_DL.Get(Convert.ToString(dt.Rows[i]["MachineID"])); obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(dt.Rows[i]["ActivityID"])); obj.ActivityID = Convert.ToInt64(dt.Rows[i]["ActivityID"]); obj.MachineCode = Convert.ToString(dt.Rows[i]["MachineID"]); obj.ParticleSize = Convert.ToString(dt.Rows[i]["ParticleSize"]); obj.InstructionDesc = Convert.ToString(dt.Rows[i]["InstructionDesc"]); objCollec.Add(obj); } } return(objCollec); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (cmbActivity.SelectedValue == null) { MessageBox.Show(this, "Please Fill All Fields", "Fill Records", MessageBoxButtons.OK); } else { PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(cmbActivity.SelectedValue)); if (cmbMachine.SelectedValue != null) { obj.Machine = objMachine_DL.Get(cmbMachine.SelectedValue.ToString()); obj.MachineCode = obj.Machine.MachineCode; } else { obj.MachineCode = "No Machine"; } obj.ParticleSize = "N/A"; if (txtInstruction.Text != "") { obj.InstructionDesc = txtInstruction.Text; } else { obj.InstructionDesc = "No"; } obj.PRPDBatch = objPRPDBatch_DL.Get(txtPRPDBatch.Text); objPRPDBatchActivityInstructions_DL.Add(obj); dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text); dgvActivityInstructions.AutoGenerateColumns = false; dgvActivityInstructions.DataSource = objSourceInstructions; objSourceInstructions.DataSource = dtPRPDBatchInstructions; objSourceInstructions.ResetBindings(true); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public int Delete(PRPDBatchActivityInstructions obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@Original_PRPDBatchActivityInstructionsID", obj.PRPDBatchActivityInstructionsID) }; return(Execute.RunSP_RowsEffected(Connection, "SPDELETE_PRPDBatchActivityInstructions", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { DialogResult Result = new DialogResult(); Result = MessageBox.Show(this, "Are You Sure You Want to Edit the Instruction", "Edit Instructions", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Result == DialogResult.Yes) { PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); obj = objPRPDBatchActivityInstructions_DL.Get(Convert.ToInt64(dgvActivityInstructions.CurrentRow.Cells["colPRPDBatchActivityInstructionsID"].Value)); obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(cmbActivity.SelectedValue)); obj.ParticleSize = "N/A"; obj.InstructionDesc = txtInstruction.Text; obj.PRPDBatch = objPRPDBatch_DL.Get(txtPRPDBatch.Text); if (cmbMachine.SelectedValue != null) { obj.Machine = objMachine_DL.Get(cmbMachine.SelectedValue.ToString()); objPRPDBatchActivityInstructions_DL.Update(obj); } else { obj.Machine = new Machine(); objPRPDBatchActivityInstructions_DL.Update_withoutMachine(obj); } dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text); dgvActivityInstructions.AutoGenerateColumns = false; dgvActivityInstructions.DataSource = objSourceInstructions; objSourceInstructions.DataSource = dtPRPDBatchInstructions; objSourceInstructions.ResetBindings(true); grpBatchInstructions.Enabled = false; btnEditMode.Text = "Edit Mode"; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void btnAdd_Click(object sender, EventArgs e) { cmbMachine.ValueMember = "MachineID"; cmbMachine.DisplayMember = "MachineName"; PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); try { obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(cmbActivityID.SelectedValue)); if (txtInstruction.Text != "") { obj.InstructionDesc = txtInstruction.Text; } else { obj.InstructionDesc = "No"; } obj.ParticleSize = "N/A"; if (cmbMachine.SelectedValue != null) { obj.MachineCode = cmbMachine.SelectedValue.ToString(); obj.Machine = objMachine_DL.Get(cmbMachine.SelectedValue.ToString()); obj.MachineName = obj.Machine.MachineName; } else { obj.MachineCode = "No Machine"; obj.MachineName = "No Machine"; } objPRPDBatchActivityInstructionsCollec.Add(obj); dgvActivityInstructions.AutoGenerateColumns = false; dgvActivityInstructions.DataSource = objSource; objSource.DataSource = objPRPDBatchActivityInstructionsCollec; objSource.ResetBindings(true); txtInstruction.Text = ""; cmbActivityID.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public int Update_withoutMachine(PRPDBatchActivityInstructions obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@PRPDBatchID", obj.PRPDBatch.PRPDBatchID), new SqlParameter("@ActivityID", obj.Activity.MainActID), new SqlParameter("@ParticleSize", obj.ParticleSize), new SqlParameter("@InstructionDesc", obj.InstructionDesc), new SqlParameter("@Original_PRPDBatchActivityInstructionsID", obj.PRPDBatchActivityInstructionsID) }; return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDBatchActivityInstructions_withoutMachine", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public int Add(PRPDBatchActivityInstructions obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@PRPDBatchID", obj.PRPDBatch.PRPDBatchID), new SqlParameter("@ActivityID", obj.Activity.MainActID), new SqlParameter("@MachineID", obj.MachineCode), new SqlParameter("@ParticleSize", obj.ParticleSize), new SqlParameter("@InstructionDesc", obj.InstructionDesc) }; return(Execute.RunSP_RowsEffected(Connection, "SPADD_PRPDBatchActivityInstructions", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void dgvActivityInstructions_CellClick(object sender, DataGridViewCellEventArgs e) { try { PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); obj = objPRPDBatchActivityInstructions_DL.Get(Convert.ToInt64(dgvActivityInstructions.CurrentRow.Cells["colPRPDBatchActivityInstructionsID"].Value)); cmbActivity.SelectedValue = obj.Activity.MainActID; if (obj.Machine != null) { cmbMachine.SelectedValue = obj.Machine.MachineCode; } txtInstruction.Text = obj.InstructionDesc; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
//private void cmbBatchMaterial_SelectedIndexChanged(object sender, EventArgs e) //{ // if (cmbBatchMaterial.SelectedValue != null) // { // Material obj = ucMaterialSelect1.Material; // lblUnit.Text = obj.MatUnit.UnitCode; // } //} private void btnDelete_Click(object sender, EventArgs e) { PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions(); if (dgvActivityInstructions.CurrentRow != null && dgvActivityInstructions.CurrentRow.Selected) { DialogResult dr = MessageBox.Show(this, "Are you sure you want to delete selected record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (dr == DialogResult.Yes) { obj = (PRPDBatchActivityInstructions)dgvActivityInstructions.CurrentRow.DataBoundItem; objPRPDBatchActivityInstructionsCollec.Delete(obj); dgvActivityInstructions.AutoGenerateColumns = false; dgvActivityInstructions.DataSource = objSource; objSource.DataSource = objPRPDBatchActivityInstructionsCollec; objSource.ResetBindings(true); } } else { MessageBox.Show(this, "Please select the record you want to delete", "Empty Selection", MessageBoxButtons.OK, MessageBoxIcon.Information); } }