private void txtmat_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Down) { gvMaterials.Focus(); } else if (e.KeyCode == Keys.Escape) { this.Close(); } else if (e.KeyCode == Keys.Enter) { try { e.Handled = true; Material_DL objMatDL = new Material_DL(ConnectionStringClass.GetConnection()); Material = objMatDL.Get(gvMaterials.SelectedRows[0].Cells["Column1"].Value.ToString()); this.Close(); } catch (Exception) { MessageBox.Show(this, "Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception) { MessageBox.Show(this, "Error occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void Initialize(SqlConnection Conn) { objUnitDL = new Unit_DL(Conn); objMaterialTypeDL = new MaterialType_DL(Conn); objFormDL = new Form_DL(Conn); objMaterialDL = new Material_DL(Conn); objMatCatDL = new MaterialCategory_DL(Conn); }
private void gvMaterials_CellClick(object sender, DataGridViewCellEventArgs e) { try { Material_DL objMatDL = new Material_DL(ConnectionStringClass.GetConnection()); Material = objMatDL.Get(gvMaterials.Rows[e.RowIndex].Cells["Column1"].Value.ToString()); this.Close(); } catch (Exception) { MessageBox.Show(this, "Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public RPDBatchActivityDetails Get(long RPDBatchActivityDetailsID) { MRPDataSetRPD dsMRP = new MRPDataSetRPD(); RPDBatch_DL objRPDBatch_DL = new RPDBatch_DL(Connection); Employee_DL objEmployee_DL = new Employee_DL(Connection); MainActivity_DL objMainActivity_DL = new MainActivity_DL(Connection); Machine_DL objMachine_DL = new Machine_DL(Connection); Material_DL objMaterial_DL = new Material_DL(Connection); RPDBatchActivityDetails obj = new RPDBatchActivityDetails(); try { da.FillByID(dsMRP.tblRPDBatchActivityDetails, RPDBatchActivityDetailsID); if (dsMRP.tblRPDBatchActivityDetails.Rows.Count > 0) { foreach (MRPDataSetRPD.tblRPDBatchActivityDetailsRow dr in dsMRP.tblRPDBatchActivityDetails) { obj.BatchActDetailsID = Convert.ToInt64(dr.BatchActDetailsID); obj.Comments = dr.Comments; obj.FinalQty = dr.FinalQty; obj.Frequency = dr.Frequency; obj.InitialVolume = dr.InitialVolume; obj.LossQty = dr.LossQty; obj.NoOfTrays = dr.NoOfTrays; obj.RPDBatchActID = Convert.ToInt64(dr.RPDBatchActID); obj.SieveSize = dr.SieveSize; obj.StartQty = dr.StartQty; obj.StartTime = dr.StartTime; obj.StopQty = dr.StopQty; obj.StopTime = dr.StopTime; obj.SupervisedBy = dr.SupervisedBy; } return(obj); } return(null); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { dsMRP.Dispose(); objRPDBatch_DL = null; objEmployee_DL = null; objMainActivity_DL = null; objMachine_DL = null; } }
private void gvMaterials_KeyUp(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { try { Material_DL objMatDL = new Material_DL(ConnectionStringClass.GetConnection()); Material = objMatDL.Get(gvMaterials.SelectedRows[0].Cells["Column1"].Value.ToString()); this.Close(); } catch (Exception) { MessageBox.Show(this, "Error Occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void btnMaterialDelete_Click(object sender, EventArgs e) { if (this.MaterialSelect) { DialogResult dr = MessageBox.Show(this, "Are you sure, You want to Delete selected Record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Material_DL objMaterialDL = new Material_DL(ConnectionStringClass.GetConnection()); try { int x = objMaterialDL.Delete(objSelectedMaterial.MaterialCode); MaterialClear(); if (x > 0) { MessageBox.Show(this, "Succesfully Deleted From Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadMaterials(Category); } } catch (SqlException sqlex) { if (sqlex.Number == 547) { MessageBox.Show(this, "Selected Material has references to another record or more. System will not allow to delete the record\nPlease contact your System Administrator for further information", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(this, "Error occured while deleteing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(this, "Error occured while deleteing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show(this, "Select a Record from the List", "Select a Record", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void Load_Data(SqlConnection Conn, string MatCode) { objMaterial_DL = new Material_DL(Conn); objStore_DL = new Store_DL(Conn); objDepartment_DL = new Department_DL(Conn); BasicMaterialCode = MatCode; objMaterial = objMaterial_DL.GetProcessdMaterial(BasicMaterialCode); if (objMaterial != null) { textBox1.Text = objMaterial.MaterialNameCode; //cmbStoreTo.DataSource = objStore_DL.GetData(); //cmbStoreTo.SelectedValue = objStore_DL.Get_Default(objDepartment_DL.GetByDepType("Store").DepID).StoreID; //cmbStoreTo.Enabled = true; } else { //cmbStoreTo.Enabled = false; textBox1.Text = "N/A"; } }
private void LoadMaterial(String Key) { txtmat.Text = Key; Material_DL objMatDL = new Material_DL(ConnectionStringClass.GetConnection()); if (Type == ControllerType.All) { bindMaterials.DataSource = objMatDL.Search(Key, 1); } else if (Type == ControllerType.Category) { bindMaterials.DataSource = objMatDL.Search(Key, Category, 1); } else if (Type == ControllerType.MainType) { bindMaterials.DataSource = objMatDL.Search_MainType(Key, MainType, 1); } else if (Type == ControllerType.MainType_Category) { bindMaterials.DataSource = objMatDL.Search_MainType_Category(Key, MainType, Category, 1); } }
public PRPDCAP Get(long PRPDCAPID) { MRPDataSetPRPD dsMRP = new MRPDataSetPRPD(); PRPDCAP obj = new PRPDCAP(); Employee_DL objEmployee_DL = new Employee_DL(Connection); Material_DL objMaterial_DL = new Material_DL(Connection); try { da.Connection = Connection; da.FillByID(dsMRP.tblPRPDCAP, PRPDCAPID); if (dsMRP.tblPRPDCAP.Rows.Count > 0) { MRPDataSetPRPD.tblPRPDCAPRow dr = (MRPDataSetPRPD.tblPRPDCAPRow)dsMRP.tblPRPDCAP.Rows[0]; if (!dr.IsAcceptQtyNull()) { obj.AcceptQty = dr.AcceptQty; } if (!dr.IsApprovedByNull()) { obj.ApprovedBy = objEmployee_DL.Get(dr.ApprovedBy); } if (!dr.IsApprovedDateNull()) { obj.ApprovedDate = dr.ApprovedDate; } obj.MaterialCode = (dr.CAPMaterial); obj.CAPQty = dr.CAPQty; if (!dr.IsDisposeQtyNull()) { obj.DisposeQty = dr.DisposeQty; } if (!dr.IsEnterdByNull()) { obj.EnteredBy = objEmployee_DL.Get(dr.EnterdBy); } obj.EnteredDate = dr.EnterdDate; obj.GRNNO = Convert.ToInt64(dr.GRNNO); obj.Instructions = dr.Instructions; obj.PRPDCAPID = Convert.ToInt64(dr.PRPDCAPID); obj.Remarks = dr.Remarks; if (!dr.IsReworkQtyNull()) { obj.ReworkQty = dr.ReworkQty; } obj.Status = (PRPDCAP.CAPStatus)dr.CAPStatus; if (!dr.IsTestedByNull()) { obj.TestedBy = objEmployee_DL.Get(dr.TestedBy); } if (!dr.IsTestDateNull()) { obj.TestedDate = dr.TestDate; } if (!dr.IsReworkMTNNull()) { obj.ReworkMTN = Convert.ToInt64(dr.ReworkMTN); } if (!dr.IsDisposeMTNNull()) { obj.DisposeMTN = Convert.ToInt64(dr.DisposeMTN); } return(obj); } return(null); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { da.Dispose(); dsMRP.Dispose(); objEmployee_DL = null; objMaterial_DL = null; } }