Esempio n. 1
0
 public bool SaveRFPDetail(PaymentRequestBudgetLine rfpDetail)
 {
     try
     {
         using (var context = SCMSEntities.Define())
         {
             context.PaymentRequestBudgetLines.Attach(rfpDetail);
             ((IObjectContextAdapter)context).ObjectContext.ObjectStateManager.ChangeObjectState(rfpDetail, System.Data.EntityState.Modified);
             return(context.SaveChanges() > 0 ? true : false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 2
0
        public ActionResult SaveR4P(Models.Request4Payment model)
        {
            try
            {
                model.EntityPaymentRqst.PurchaseOrderId = model.ReferenceId;
                //model.EntityPaymentRqst.RequestForAdvanceId = Guid.Empty;
                //model.EntityPaymentRqst.TravelAuthorisationId = Guid.Empty;

                model.EntityPaymentRqst.Id                 = Guid.NewGuid();
                model.EntityPaymentRqst.PreparedBy         = currentStaff.Id;
                model.EntityPaymentRqst.PreparedOn         = DateTime.Now;
                model.EntityPaymentRqst.CountryProgrammeId = countryProg.Id;
                model.EntityPaymentRqst.RequestDate        = model.EntityPaymentRqst.PreparedOn;
                model.EntityPaymentRqst.IsSubmitted        = true;
                model.EntityPaymentRqst.IsAuthorized       = false;
                model.EntityPaymentRqst.IsReviewed         = false;
                PaymentRequestBudgetLine m;
                EntityCollection <Model.PaymentRequestBudgetLine> RABlineList = new EntityCollection <PaymentRequestBudgetLine>();
                foreach (Models.R4PpaymentDetails item in model.paymentDetais)
                {
                    m    = new PaymentRequestBudgetLine();
                    m.Id = Guid.NewGuid();
                    m.PaymentRequestId    = model.EntityPaymentRqst.Id;
                    m.BudgetLineId        = item.BudgetLineId;
                    m.Amount              = item.Amount;
                    m.PurchaseOrderItemId = item.PoItemId;
                    RABlineList.Add(m);
                }
                string usmsge; bool issaved = false;
                model.EntityPaymentRqst.RefNumber = R4PSevice.GenerateUniquNumber(countryProg);
                if (R4PSevice.SaveRequest4Payment(model.EntityPaymentRqst, RABlineList))
                {
                    usmsge = Resources.Global_String_SavedSuccessfully; issaved = true;
                }
                else
                {
                    usmsge = Resources.Global_String_AnErrorOccurred;
                }
                ModelState.Clear();
                //return LoadR4P(model.EntityPaymentRqst.PaymentRqstType, usmsge, issaved);
                return(ViewR4P());
            }
            catch (Exception ex)
            {
                return(LoadR4P(model.EntityPaymentRqst.PaymentRqstType, ex.Message, false));
            }
        }