/// <summary> /// Saves a record to the T_DiliveryDet table. /// </summary> public Boolean Savet_DiliveryDetSP(T_DiliveryDet t_DiliveryDet, int formMode) { SqlCommand scom; bool retvalue = false; try { scom = new SqlCommand(); scom.CommandType = CommandType.StoredProcedure; scom.CommandText = "T_DiliveryDetSave"; scom.Parameters.Add("@DoNo", SqlDbType.VarChar, 20).Value = t_DiliveryDet.DoNo; scom.Parameters.Add("@Item", SqlDbType.VarChar, 20).Value = t_DiliveryDet.Item; scom.Parameters.Add("@ItemNamex", SqlDbType.VarChar, 50).Value = t_DiliveryDet.ItemNamex; scom.Parameters.Add("@Unit", SqlDbType.VarChar, 10).Value = t_DiliveryDet.Unit; scom.Parameters.Add("@Qty", SqlDbType.Decimal, 9).Value = t_DiliveryDet.Qty; scom.Parameters.Add("@Carton", SqlDbType.Decimal, 9).Value = t_DiliveryDet.Carton; scom.Parameters.Add("@ActualCartons", SqlDbType.Decimal, 9).Value = t_DiliveryDet.ActualCartons; scom.Parameters.Add("@Remarks", SqlDbType.VarChar, 150).Value = t_DiliveryDet.Remarks; scom.Parameters.Add("@Pass", SqlDbType.Bit, 1).Value = t_DiliveryDet.Pass; scom.Parameters.Add("@IsCNitem", SqlDbType.Bit, 1).Value = t_DiliveryDet.IsCNitem; scom.Parameters.Add("@CNNumber", SqlDbType.VarChar, 20).Value = t_DiliveryDet.CNNumber; scom.Parameters.Add("@InsMode", SqlDbType.Int).Value = formMode; // For insert scom.Parameters.Add("@RtnValue", SqlDbType.Int).Value = 0; u_DBConnection dbcon = new u_DBConnection(); retvalue = dbcon.RunQuery(scom); return(retvalue); } catch (Exception ex) { throw (ex); } }
public T_DiliveryDet Selectt_DiliveryDet(T_DiliveryDet objt_DiliveryDet) { try { strquery = @"SELECT * FROM dbo.T_DiliveryDet WHERE DoNo = '" + objt_DiliveryDet.DoNo.Trim() + "' AND Item = '" + objt_DiliveryDet.Item.Trim() + "'"; DataRow drType = u_DBConnection.ReturnDataRow(strquery); if (drType != null) { objt_DiliveryDet.DoNo = drType["DoNo"].ToString(); objt_DiliveryDet.Item = drType["Item"].ToString(); objt_DiliveryDet.ItemNamex = drType["ItemNamex"].ToString(); objt_DiliveryDet.Unit = drType["Unit"].ToString(); objt_DiliveryDet.Qty = decimal.Parse(drType["Qty"].ToString()); objt_DiliveryDet.Carton = decimal.Parse(drType["Carton"].ToString()); objt_DiliveryDet.ActualCartons = decimal.Parse(drType["ActualCartons"].ToString()); objt_DiliveryDet.Remarks = drType["Remarks"].ToString(); objt_DiliveryDet.Pass = bool.Parse(drType["Pass"].ToString()); objt_DiliveryDet.IsCNitem = bool.Parse(drType["IsCNitem"].ToString()); objt_DiliveryDet.CNNumber = drType["CNNumber"].ToString(); return(objt_DiliveryDet); } return(null); } catch (Exception ex) { throw ex; } }
public List <T_DiliveryDet> SelectT_DiliveryDetMulti(T_DiliveryDet objt_DiliveryDet2) { List <T_DiliveryDet> retval = new List <T_DiliveryDet>(); try { strquery = @"select * from t_DiliveryDet where DoNo = '" + objt_DiliveryDet2.DoNo + "'"; DataTable dtt_DiliveryDet = u_DBConnection.ReturnDataTable(strquery, CommandType.Text); foreach (DataRow drType in dtt_DiliveryDet.Rows) { if (drType != null) { T_DiliveryDet objt_DiliveryDet = new T_DiliveryDet(); objt_DiliveryDet.DoNo = drType["DoNo"].ToString(); objt_DiliveryDet.Item = drType["Item"].ToString(); objt_DiliveryDet.ItemNamex = drType["ItemNamex"].ToString(); objt_DiliveryDet.Unit = drType["Unit"].ToString(); objt_DiliveryDet.Qty = decimal.Parse(drType["Qty"].ToString()); objt_DiliveryDet.Carton = decimal.Parse(drType["Carton"].ToString()); objt_DiliveryDet.ActualCartons = decimal.Parse(drType["ActualCartons"].ToString()); objt_DiliveryDet.Remarks = drType["Remarks"].ToString(); objt_DiliveryDet.Pass = bool.Parse(drType["Pass"].ToString()); objt_DiliveryDet.IsCNitem = bool.Parse(drType["IsCNitem"].ToString()); objt_DiliveryDet.CNNumber = drType["CNNumber"].ToString(); retval.Add(objt_DiliveryDet); } } return(retval); } catch (Exception ex) { throw ex; } }
private void btn_edit_Click(object sender, EventArgs e) { errorProvider1.Clear(); try { if (txt_aremarks.Text.Trim() == "") { errorProvider1.SetError(txt_aremarks, "Audit remarks cannot be empty."); commonFunctions.SetMDIStatusMessage("Audit remarks cannot be empty.", 1); return; } if (codex.Trim() == "") { errorProvider1.SetError(dataGridView1, "Pelase select a delivery order from the list"); commonFunctions.SetMDIStatusMessage("Pelase select a delivery order from the list", 1); return; } if (!GridPass()) { errorProvider1.SetError(dataGridView2, "There is a variance in DO QTY and actual QTY"); commonFunctions.SetMDIStatusMessage("There is a variance in DO QTY and actual QTY", 1); return; } if (!CartonChecking()) { errorProvider1.SetError(dataGridView2, "Invalied Carton details"); commonFunctions.SetMDIStatusMessage("Invalied Carton details", 1); return; } if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Approve, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes) { T_DIliveryHed objt_trnsferNote = new T_DIliveryHed(); objt_trnsferNote.DoNo = txt_DocNo.Text.Trim(); objt_trnsferNote.LocaCode = commonFunctions.GlobalLocation; objt_trnsferNote = new T_DIliveryHedDL().Selectt_DIliveryHed(objt_trnsferNote, 2); objt_trnsferNote.AuditRemarks = txt_aremarks.Text.Trim(); objt_trnsferNote.ReportedProblems = txt_repproblems.Text.Trim(); objt_trnsferNote.Audited = 1; objt_trnsferNote.AuditDate = DateTime.Now; objt_trnsferNote.AuditUser = commonFunctions.Loginuser; new T_DIliveryHedDL().Savet_DIliveryHedSP(objt_trnsferNote, 3); T_OrderTracking track = new T_OrderTracking(); track.DONo = txt_DocNo.Text.Trim(); track = new T_OrderTrackingDL().Selectt_OrderTracking(track, xEnums.OrderTrackingTypes.DoNumber); track.Audited = 1; track.AuditUser = commonFunctions.Loginuser; track.AuditDate = DateTime.Now; new T_OrderTrackingDL().Savet_OrderTrackingSP(track, 3); foreach (DataGridViewRow drow in dataGridView2.Rows) { if (drow.Cells[0].Value.ToString().Trim() != null) { T_DiliveryDet det = new T_DiliveryDet(); det.DoNo = txt_DocNo.Text.Trim(); det.Item = drow.Cells[0].Value.ToString().Trim(); det = new T_DiliveryDetDL().Selectt_DiliveryDet(det); det.Carton = commonFunctions.ToDecimal(drow.Cells[5].Value.ToString().Trim()); det.ActualCartons = commonFunctions.ToDecimal(drow.Cells[5].Value.ToString().Trim()); det.Remarks = drow.Cells[7].Value.ToString().Trim(); det.Pass = true; new T_DiliveryDetDL().Savet_DiliveryDetSP(det, 3); } } commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2); getProcessedDOs(); getDetails(""); } } catch (Exception ex) { LogFile.WriteErrorLog(MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception"); commonFunctions.SetMDIStatusMessage("Genaral Error when approving the delivery order", 1); } }