/// <summary> /// Takes the specified b u commitment request entity. /// </summary> /// <param name="bUCommitmentRequestEntity">The b u commitment request entity.</param> /// <returns>System.Object[].</returns> private static object[] Take(OpeningCommitmentEntity bUCommitmentRequestEntity) { return(new object[] { "@RefID", bUCommitmentRequestEntity.RefId, "@RefDate", bUCommitmentRequestEntity.RefDate, "@PostedDate", bUCommitmentRequestEntity.PostedDate, "@RefNo", bUCommitmentRequestEntity.RefNo, "@RefType", bUCommitmentRequestEntity.RefType, "@AccountingObjectID", bUCommitmentRequestEntity.AccountingObjectId, "@AccountingObjectName", bUCommitmentRequestEntity.AccountingObjectName, "@TABMISCode", bUCommitmentRequestEntity.TABMISCode, "@BankAccount", bUCommitmentRequestEntity.BankAccount, "@BankName", bUCommitmentRequestEntity.BankName, "@ContractNo", bUCommitmentRequestEntity.ContractNo, "@ContractFrameNo", bUCommitmentRequestEntity.ContractFrameNo, "@BudgetSourceKind", bUCommitmentRequestEntity.BudgetSourceKind, "@TotalAmount", bUCommitmentRequestEntity.TotalAmount, "@TotalAmountOC", bUCommitmentRequestEntity.TotalAmountOC, "@IsForeignCurrency", bUCommitmentRequestEntity.IsForeignCurrency, // "@Posted",bUCommitmentRequestEntity.Posted, "@EditVersion", bUCommitmentRequestEntity.EditVersion, "@PostVersion", bUCommitmentRequestEntity.PostVersion, "@ProjectInvestmentCode", bUCommitmentRequestEntity.ProjectInvestmentCode, "@ProjectInvestmentName", bUCommitmentRequestEntity.ProjectInvestmentName, "@SignDate", bUCommitmentRequestEntity.SignDate, "@ContractAmount", bUCommitmentRequestEntity.ContractAmount, "@PrevYearCommitmentAmount", bUCommitmentRequestEntity.PrevYearCommitmentAmount, }); }
/// <summary> /// Deletes the bu plan receipt. /// </summary> /// <param name="bUCommitmentRequest">The b u commitment request.</param> /// <returns>System.String.</returns> public string DeleteOpeningCommitment(OpeningCommitmentEntity openingCommitment) { const string procedures = @"uspDelete_OpeningCommitment"; object[] parms = { "@RefId", openingCommitment.RefId }; return(Db.Delete(procedures, true, parms)); }
//private List<BankInfo> banks; public List <OpeningCommitmentEntity> GetOpeningCommitments(string connectionString) { List <OpeningCommitmentEntity> buentity = new List <OpeningCommitmentEntity>(); using (var context = new MISAEntity(connectionString)) { var querry = context.OpeningCommitmentDetails.ToList(); //var projects = context.Projects.ToList(); // var currencys = context.CCies.ToList(); //var budgetsource = context.BudgetSources.ToList(); //var listitems = context.ListItems.ToList(); //var fundstructures = context.FundStructures.ToList(); var budgetproviders = context.BudgetProvidences.ToList(); //var accountingobject = context.AccountingObjects.ToList(); //var projectexpenses = context.ProjectExpenses.ToList(); //var activity = context.Activities.ToList(); //var tasks = context.Tasks.ToList(); //banks = context.BankInfoes.ToList(); var resultcontext = context.OpeningCommitments.ToList(); foreach (var result in resultcontext) { var newresult = new OpeningCommitmentEntity(); newresult.RefId = result.RefID.ToString(); newresult.PostedDate = result.PostedDate; newresult.RefDate = result.PostedDate;//DB misa không có field refdate newresult.RefNo = result.RefNo; newresult.RefType = ConvRefType.ConvRefType(result.RefType); newresult.BudgetSourceKind = result.BudgetSourceKind; newresult.TotalAmount = result.TotalAmount; newresult.TotalAmountOC = result.TotalAmountOC; newresult.IsForeignCurrency = result.IsForeignCurrency; newresult.EditVersion = result.EditVersion; newresult.PostVersion = result.PostVersion; newresult.AccountingObjectId = result.AccountingObjectID.ToString(); newresult.AccountingObjectName = result.AccountingObjectName; newresult.TABMISCode = result.TABMISCode; newresult.BankAccount = result.BankAccount; newresult.BankName = result.BankName; newresult.ContractNo = result.ContractNo; newresult.ContractFrameNo = result.ContractFrameNo; newresult.ProjectInvestmentCode = result.ProjectInvestmentCode; newresult.ProjectInvestmentName = result.ProjectInvestmentName; newresult.SignDate = result.SignDate; newresult.ContractAmount = result.ContractAmount; newresult.PrevYearCommitmentAmount = result.PrevYearCommitmentAmount; newresult.OpeningCommitmentDetails = OpeningCommitmentDetails(result.OpeningCommitmentDetails.ToList(), result.RefID.ToString()); buentity.Add(newresult); } } return(buentity); }
/// <summary> /// Updates the bu plan receipt. /// </summary> /// <param name="bUCommitmentRequest">The b u commitment request.</param> /// <returns>System.String.</returns> public string UpdateOpeningCommitment(OpeningCommitmentEntity openingCommitment) { const string procedures = @"uspUpdate_OpeningCommitment"; return(Db.Update(procedures, true, Take(openingCommitment))); }
/// <summary> /// Inserts the bu plan receipt. /// </summary> /// <param name="bUCommitmentRequest">The b u commitment request.</param> /// <returns>System.String.</returns> public string InsertOpeningCommitment(OpeningCommitmentEntity openingCommitment) { const string procedures = @"uspInsert_OpeningCommitment"; return(Db.Insert(procedures, true, Take(openingCommitment))); }
/// <summary> /// Inserts the bu commitment request. /// </summary> /// <param name="openingCommitment">The b u commitment request.</param> /// <returns>OpeningCommitmentResponse.</returns> public OpeningCommitmentResponse InsertOpeningCommitment(OpeningCommitmentEntity openingCommitment) { var openingCommitmentResponse = new OpeningCommitmentResponse { Acknowledge = AcknowledgeType.Success }; if (openingCommitment != null && !openingCommitment.Validate()) { foreach (var error in openingCommitment.ValidationErrors) { openingCommitmentResponse.Message += error + Environment.NewLine; } openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; return(openingCommitmentResponse); } using (var scope = new TransactionScope()) { if (openingCommitment != null) { var validOpeningCommitment = OpeningCommitmentDao.GetOpeningCommitmentbyRefNo(openingCommitment.RefNo); if (validOpeningCommitment != null) { openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; openingCommitmentResponse.Message = "Số cam kết chi " + openingCommitment.RefNo + " đã tồn tại !"; return(openingCommitmentResponse); } if (!string.IsNullOrEmpty(openingCommitmentResponse.Message)) { openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; return(openingCommitmentResponse); } openingCommitment.RefId = Guid.NewGuid().ToString(); openingCommitmentResponse.Message = OpeningCommitmentDao.InsertOpeningCommitment(openingCommitment); if (!string.IsNullOrEmpty(openingCommitmentResponse.Message)) { openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; return(openingCommitmentResponse); } foreach (var openingCommitmentDetail in openingCommitment.OpeningCommitmentDetails) { openingCommitmentDetail.RefId = openingCommitment.RefId; openingCommitmentDetail.RefDetailId = Guid.NewGuid().ToString(); if (!openingCommitmentDetail.Validate()) { foreach (var error in openingCommitmentDetail.ValidationErrors) { openingCommitmentResponse.Message += error + Environment.NewLine; } openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; return(openingCommitmentResponse); } openingCommitmentResponse.Message = OpeningCommitmentDetailDao.InsertOpeningCommitmentDetail(openingCommitmentDetail); if (!string.IsNullOrEmpty(openingCommitmentResponse.Message)) { openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; return(openingCommitmentResponse); } } if (openingCommitmentResponse.Message != null) { openingCommitmentResponse.Acknowledge = AcknowledgeType.Failure; scope.Dispose(); return(openingCommitmentResponse); } openingCommitmentResponse.RefId = openingCommitment.RefId; scope.Complete(); } return(openingCommitmentResponse); } }