コード例 #1
0
        public Tuple <bool, string> InsertGodownTenderAllotmentDetails(TenderAllotmentToGodownEntity 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;

                    sqlCommand.Parameters.Clear();
                    sqlCommand.Dispose();

                    sqlCommand             = new SqlCommand();
                    sqlCommand.Transaction = objTrans;
                    sqlCommand.Connection  = sqlConnection;
                    sqlCommand.CommandText = "InsertGodownwiseTenderAllotmentDetails";
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.Parameters.AddWithValue("@GodownAllotementID", entity.GodownAllotementID);
                    sqlCommand.Parameters.AddWithValue("@OrderNumber", entity.OrderNumber);
                    sqlCommand.Parameters.AddWithValue("@Quantity", entity.Quantity);
                    sqlCommand.Parameters.AddWithValue("@GCode", entity.GCode);
                    sqlCommand.Parameters.AddWithValue("@Remarks", entity.Remarks);
                    sqlCommand.Parameters.AddWithValue("@RegAllotementID", entity.RegAllotementID);
                    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();
                }
            }
        }
コード例 #2
0
        public Tuple <bool, string> Post(TenderAllotmentToGodownEntity entity)
        {
            ManageSQLForTenderAllotmentToGodown manageSQLConnection = new ManageSQLForTenderAllotmentToGodown();

            return(manageSQLConnection.InsertGodownTenderAllotmentDetails(entity));
        }