예제 #1
0
        /// <summary>
        ///     Deletes the budgetProvidence.
        /// </summary>
        /// <param name="budgetProvidence">The budgetProvidence.</param>
        /// <returns>System.String.</returns>
        public string DeleteBudgetProvidence(BudgetProvidenceEntity budgetProvidence)
        {
            const string sql = @"uspDelete_BudgetProvidence";

            object[] parms = { "@BudgetProvidenceID", budgetProvidence.BudgetProvideId };
            return(Db.Delete(sql, true, parms));
        }
예제 #2
0
 /// <summary>
 ///     Takes the specified budgetProvidence.
 /// </summary>
 /// <param name="budgetProvidence">The budgetProvidence.</param>
 /// <returns></returns>
 private object[] Take(BudgetProvidenceEntity budgetProvidence)
 {
     return(new object[]
     {
         "@BudgetProvideID", budgetProvidence.BudgetProvideId,
         "@BudgetProvideName", budgetProvidence.BudgetProvideName,
         "@BudgetProvideCode", budgetProvidence.BudgetProvideCode,
         "@IsSystem", budgetProvidence.IsSystem,
         "@IsActive", budgetProvidence.IsActive
     });
 }
예제 #3
0
        /// <summary>
        ///     Inserts the budgetProvidence.
        /// </summary>
        /// <param name="budgetProvidenceEntity">The budgetProvidence entity.</param>
        /// <returns></returns>
        public BudgetProvidenceResponse InsertBudgetProvidence(BudgetProvidenceEntity budgetProvidenceEntity)
        {
            var response = new BudgetProvidenceResponse {
                Acknowledge = AcknowledgeType.Success
            };

            try
            {
                if (!budgetProvidenceEntity.Validate())
                {
                    foreach (var error in budgetProvidenceEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                using (var scope = new TransactionScope())
                {
                    budgetProvidenceEntity.BudgetProvideId = Guid.NewGuid().ToString();
                    response.Message = BudgetProvidenceDao.InsertBudgetProvidence(budgetProvidenceEntity);
                    if (!string.IsNullOrEmpty(response.Message))
                    {
                        response.Acknowledge = AcknowledgeType.Failure;
                        return(response);
                    }
                    scope.Complete();
                }
                response.BudgetProvidenceId = budgetProvidenceEntity.BudgetProvideId;
                return(response);
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                return(response);
            }
        }
예제 #4
0
        /// <summary>
        ///     Updates the budgetProvidence.
        /// </summary>
        /// <param name="budgetProvidence">The budgetProvidence.</param>
        /// <returns></returns>
        public string UpdateBudgetProvidence(BudgetProvidenceEntity budgetProvidence)
        {
            const string sql = @"uspUpdate_BudgetProvidence";

            return(Db.Update(sql, true, Take(budgetProvidence)));
        }
예제 #5
0
        /// <summary>
        ///     Inserts the budgetProvidence.
        /// </summary>
        /// <param name="budgetProvidence">The budgetProvidence.</param>
        /// <returns></returns>
        public string InsertBudgetProvidence(BudgetProvidenceEntity budgetProvidence)
        {
            const string sql = @"uspInsert_BudgetProvidence";

            return(Db.Insert(sql, true, Take(budgetProvidence)));
        }