public Tuple <bool, string> InsertTenderAllotmentDetails(TenderAllotmentDetailsEntity entity) { SqlTransaction objTrans = null; using (sqlConnection = new SqlConnection(GlobalVariable.ConnectionString)) { DataSet ds = new DataSet(); sqlCommand = new SqlCommand(); try { if (sqlConnection.State == 0) { sqlConnection.Open(); } objTrans = sqlConnection.BeginTransaction(); //sqlCommand.Transaction = objTrans; //sqlCommand.Connection = sqlConnection; //foreach (var item in entity) //{ sqlCommand.Parameters.Clear(); sqlCommand.Dispose(); sqlCommand = new SqlCommand(); sqlCommand.Transaction = objTrans; sqlCommand.Connection = sqlConnection; sqlCommand.CommandText = "InsertTenderAllotmentDetails"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@AllotmentID", entity.AllotmentID); sqlCommand.Parameters.AddWithValue("@OrderNumber", entity.OrderNumber); sqlCommand.Parameters.AddWithValue("@PartyCode", entity.PartyCode); sqlCommand.Parameters.AddWithValue("@TotalDays", entity.TotalDays); sqlCommand.Parameters.AddWithValue("@TargetDate", entity.TargetDate); sqlCommand.Parameters.AddWithValue("@AssignedQty", entity.AssignedQty); sqlCommand.Parameters.AddWithValue("@Rate", entity.Rate); sqlCommand.Parameters.AddWithValue("@Spell", entity.Spell); sqlCommand.Parameters.AddWithValue("@Remarks", entity.Remarks); sqlCommand.ExecuteNonQuery(); // } objTrans.Commit(); sqlCommand.Parameters.Clear(); sqlCommand.Dispose(); return(new Tuple <bool, string>(true, GlobalVariable.SavedMessage)); } catch (Exception ex) { objTrans.Rollback(); AuditLog.WriteError(ex.Message + " : " + ex.StackTrace); return(new Tuple <bool, string>(false, GlobalVariable.ErrorMessage)); } finally { sqlConnection.Close(); sqlCommand.Dispose(); ds.Dispose(); } } }
public Tuple <bool, string> Post(TenderAllotmentDetailsEntity tenderAllotmentEntity = null) { ManageSQLForTenderAllotmentDetails manageSQLConnection = new ManageSQLForTenderAllotmentDetails(); return(manageSQLConnection.InsertTenderAllotmentDetails(tenderAllotmentEntity)); }