public string saveChallanDetails(BOChallan objChallan, DataTable productTable) { string retMsg; retMsg = objDALChallan.saveChallanDetails(objChallan, productTable); return(retMsg); }
public string saveChallanDetails(BOChallan objBOChallan, DataTable productTable) { try { //Initialization objDB_Utility = new DB_Utility(); SqlConnection con = objDB_Utility.funcOpenConnection(); SqlCommand cmd = new SqlCommand("sp_saveChallanDetails", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; //Code to Insert Supplier Details Data into Database using stored procedure cmd.Parameters.AddWithValue("@challan_no", objBOChallan.challanNumber); cmd.Parameters.AddWithValue("@customer_id", objBOChallan.customerID); cmd.Parameters.AddWithValue("@challan_amount", objBOChallan.challanAmount); cmd.Parameters.AddWithValue("@payment_method", "cash"); SqlParameter tvparam = cmd.Parameters.AddWithValue("@dt_product_list", productTable); //tvparam.SqlDbType = SqlDbType.Structured; cmd.ExecuteNonQuery(); return("success"); } catch (Exception ex) { string filePath = @"..\ErrorLog.log"; using (System.IO.StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine("Error Code : 00029" + Environment.NewLine + "Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace + "" + Environment.NewLine + "Date :" + DateTime.Now.ToString()); writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine); } return(ex.Message); } finally { objDB_Utility.funcCloseConnection(); } }