Beispiel #1
0
        public IHttpActionResult PosttblPayment(tblPayment tblPayment)
        {
            db.proc_payment(tblPayment.Payment_Amount, tblPayment.Payment_Status, tblPayment.Bid);
            db.SaveChanges();

            return(Ok("Paid"));
        }
Beispiel #2
0
        public object ApprovalOfBooking(int BookingID, bool Approval, int ApprovedBy, decimal RatePerHour, string Reason)
        {
            var        DC         = new DataClassesDataContext();
            tblBooking BookingObj = (from ob in DC.tblBookings
                                     where ob.BookingID == BookingID
                                     select ob).Single();

            BookingObj.IsApproved = Approval;
            BookingObj.ApprovedBy = ApprovedBy;
            BookingObj.Status     = (BookingObj.IsApproved == true) ? "Accepted" : "Rejected";
            BookingObj.Reason     = (BookingObj.IsApproved == true) ? Reason : null;

            if (Approval)
            {
                tblPayment PaymentObj = new tblPayment();
                var        Amount     = (BookingObj.EndTime.Hour - BookingObj.StartTime.Hour) * RatePerHour;
                PaymentObj.Amount       = Amount;
                PaymentObj.DueDate      = BookingObj.StartTime.Date.AddDays(-1);
                PaymentObj.InitiateDate = DateTime.Now;
                PaymentObj.PaymentFor   = Convert.ToInt32(BookingObj.FlatNo);
                PaymentObj.PaymentName  = "Facility Booking";
                PaymentObj.Penalty      = 0;
                PaymentObj.IsActive     = true;

                DC.tblPayments.InsertOnSubmit(PaymentObj);
            }

            DC.SubmitChanges();

            return(true);
        }
Beispiel #3
0
        public void LoadById()
        {
            try
            {
                using (BudgetManagementEntities dc = new BudgetManagementEntities())
                {
                    if (this.Id != Guid.Empty)
                    {
                        tblPayment make = dc.tblPayments.FirstOrDefault(c => c.Id == this.Id);

                        if (make != null)
                        {
                            this.Id          = make.Id;
                            this.Description = make.Description;
                        }
                        else
                        {
                            throw new Exception("Could not find the row.");
                        }
                    }
                    else
                    {
                        throw new Exception("Id is not set.");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IHttpActionResult PuttblPayment(int id, tblPayment tblPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblPayment.payment_Id)
            {
                return(BadRequest());
            }

            db.Entry(tblPayment).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblPaymentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult Payment(PaymentViewModel pvm)
        {
            tblPayment tb = new tblPayment();

            tb.MemberId    = pvm.MemberId;
            tb.PaidAmount  = pvm.PaidAmount;
            tb.PaymentDate = pvm.PaymentDate;
            _db.tblPayments.Add(tb);
            _db.SaveChanges();
            ViewBag.Message = "Payment Done Successfully";

            List <MemberViewModel> lstmemvm = new List <MemberViewModel>();

            var users = _db.tblUsers.ToList();

            foreach (var item in users)
            {
                tblMembership tbm = _db.tblMemberships.Where(m => m.UserId == item.UserId).FirstOrDefault();
                if (tbm != null)
                {
                    lstmemvm.Add(new MemberViewModel()
                    {
                        MemberId = tbm.MembershipId, Fullname = item.Fullname
                    });
                }
            }
            ViewBag.Fullname = lstmemvm;
            return(View());
        }
Beispiel #6
0
        public ActionResult PaymentSubmit(int a, int?b)
        {
            Thread.Sleep(2000);
            var temp = db.tblUsers.FirstOrDefault(it => it.ID == a);

            if (temp == null)
            {
                return(Content("Người dùng không tồn tại"));
            }
            if (b <= 1000 || b == null)
            {
                return(Content("Erro! Số tiền nộp sai!"));
            }
            string     res   = "Nộp tiền thành công cho ";
            var        actor = (tblUser)Session["User"];
            tblPayment pm    = new tblPayment();

            pm.IDUser   = a;
            pm.IDActor  = actor.ID;
            pm.Money    = b;
            pm.Status   = false;
            pm.Datetime = DateTime.Now;
            db.tblPayments.Add(pm);
            db.SaveChanges();

            res += db.tblUsers.FirstOrDefault(i => i.ID == a).Fullname.ToString() + ": " + b.ToString() + ", hãy chờ người xác nhận!";

            return(Content(res));
        }
Beispiel #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblPayment tblPayment = db.tblPayments.Find(id);

            db.tblPayments.Remove(tblPayment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        /// <summary>
        /// Creates placeholder credit card payment/transaction and sends the user to TouchNet to process the payment
        /// </summary>
        /// <param name="ID">Reservation ID</param>
        /// <returns>Redirect ActionResult</returns>
        public ActionResult CreditPayment(int ID)
        {
            tblReservation Reservation = _ODB.tblReservations.Where(e => e.ID == ID).SingleOrDefault();

            if (Reservation != null)
            {
                bool HasExistingPayments = Reservation.tblPayments.Where(e => e.Amount > 0).Count() > 0;
                bool IsStudentPayment    = Reservation.tblInvitation.ENumber == Current.User.ENumber;
                if (Reservation.tblInvitation.ENumber == Current.User.ENumber || Current.User.IsAdmin || Current.User.IsStaff)
                {
                    if (Reservation.CurrentAmountDue > 0)
                    {
                        if (Reservation.tblEventDate.HasOpenSlots || (Reservation.IsConfirmed && Reservation.CountUnpaidGuests > 0))
                        {
                            // create placeholder payment to store data on upay postback
                            tblPayment Payment = new tblPayment();
                            Payment.tblReservation = Reservation;
                            Payment.IsSupplemental = HasExistingPayments;
                            Payment.PaidBy         = IsStudentPayment ? "Student" : "Staff";
                            Payment.PaymentType    = DataConstants.PaymentTypes.CreditOrDebitCard;
                            Payment.Amount         = 0; // don't set amount until received
                            Payment.PaymentDate    = DateTime.Now;
                            _ODB.tblPayments.AddObject(Payment); _ODB.SaveChanges();

                            Current.User.BookmarkReservationID = Reservation.ID; // remember which reservation we're using so we can return the user to the correct page.

                            // Create a placeholder transaction to store credit card data
                            tblUPayTransaction transaction = Upay.CreateTouchnetTransaction(Payment);

                            SecureAccess.Utilities.Logging.Log(SecureAccess.Utilities.Logging.LogType.Audit, string.Format("Redirecting user {0} to {1} UPay site.", Current.User.Username, Reservation.tblInvitation.tblEvent.MarketplaceSite), SecureAccess.Utilities.Logging.Severity.Information);
                            Upay.PostToTouchnet(transaction, Reservation.CurrentAmountDue, HasExistingPayments, Payment.PaidBy);
                            return(null);
                        }
                        else
                        {
                            this.ShowPageError(string.Format("The selected event date '{0}' no longer has an open slot for event '{1}'. Please select another event date.", Reservation.tblEventDate.DateOfEvent.ToShortDateString(), Reservation.tblEventDate.tblEvent.Name));
                        }
                    }
                    else
                    {
                        this.ShowPageError(String.Format("You cannot submit a credit card payment. The Current Amount Due is {0}", Reservation.CurrentAmountDue));
                    }

                    return(this.RedirectToAction <StudentController>(c => c.Reservation(ID)));
                }
                else
                {
                    this.ShowPageError("You are not authorized to submit credit payments for this Reservation");
                }
            }
            else
            {
                this.ShowPageError("Could not find a reservation for the given ID");
            }

            return(this.RedirectToAction <StudentController>(c => c.Index()));
        }
        public ActionResult Delete(int?id)
        {
            tblPayment   P = db.tblPayments.SingleOrDefault(x => x.intPaymentID == id);
            PaymentModel M = new PaymentModel()
            {
                PaymentID = P.intPaymentID, Amount = (decimal)P.decAmount, AppoitmentID = (int)P.intAppoitmentID, Status = P.strStatus
            };

            return(View(M));
        }
Beispiel #10
0
 public ActionResult Edit([Bind(Include = "IDPayment,PaidDate,IDAdmission,TotalPaid,IDPaymentMethod,Bank,CheckNo,CheckDate,Notes,IsVerified,PostedDate")] tblPayment tblPayment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblPayment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblPayment));
 }
Beispiel #11
0
        public ActionResult AddEmployee()
        {
            if (Session["UserID"] == null && Session["UserName"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }

            try
            {
                if (ModelState.IsValid)
                {
                    int QID    = Convert.ToInt32(Request.Form["QID"]);
                    int PGID   = Convert.ToInt32(Request.Form["PGID"]);
                    int TypeID = Convert.ToInt32(Request.Form["TypeID"]);
                    if (IsEmployeeRecordExist(QID, PGID, TypeID))
                    {
                        return(Json(new { IsSelected = true, message = "Photographer is already selected for this type" }, JsonRequestBehavior.AllowGet));
                    }

                    tblOrder order = new tblOrder();
                    order.QuotationID        = QID;
                    order.PhotographerID     = PGID;
                    order.PhotographerTypeID = TypeID;
                    order.TotalPay           = Convert.ToDecimal(Request.Form["Salary"]);
                    order.CreatedDate        = DateTime.Now;
                    db.tblOrders.Add(order);
                    db.SaveChanges();
                    tblPayment payment = new tblPayment();
                    if (db.tblPayments.Where(P => P.PhotographerID == PGID).Count() > 0)
                    {
                        payment = db.tblPayments.SingleOrDefault(P => P.PhotographerID == PGID);
                        payment.RemainingPay   += Convert.ToDecimal(Request.Form["Salary"]);
                        db.Entry(payment).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    else
                    {
                        payment.PhotographerID = PGID;
                        payment.TotalPay       = 0;
                        payment.RemainingPay   = Convert.ToDecimal(Request.Form["Salary"]);
                        db.tblPayments.Add(payment);
                        db.SaveChanges();
                    }
                    return(Json(new { success = true, message = "Record inserted successfully" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { success = false, message = "Record is not inserted!" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = "Error! " + ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Details(int id)
        {
            tblPayment ad = dc.tblPayments.SingleOrDefault(ob => ob.PaymentId == id);

            ViewBag.DoctorName  = (from ob in dc.tblDoctors where ob.DoctorId == ad.DoctorId select ob).Take(1).SingleOrDefault().FirstName;
            ViewBag.PatientName = (from ob1 in dc.tblPatients where ob1.PatientId == ad.PatientId select ob1).Take(1).SingleOrDefault().FirstName;
            string name  = ViewBag.DoctorName;
            string pname = ViewBag.patientName;

            return(View(ad));
        }
        public IHttpActionResult GettblPayment(int id)
        {
            tblPayment tblPayment = db.tblPayments.Find(id);

            if (tblPayment == null)
            {
                return(NotFound());
            }

            return(Ok(tblPayment));
        }
        public IHttpActionResult PosttblPayment(tblPayment tblPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tblPayments.Add(tblPayment);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tblPayment.payment_Id }, tblPayment));
        }
        public void DeleteTest()
        {
            using (BudgetManagementEntities dc = new BudgetManagementEntities())
            {
                tblPayment tblpayment = dc.tblPayments.Where(c => c.Description == "UpdatedPayment").FirstOrDefault();
                dc.tblPayments.Remove(tblpayment);
                dc.SaveChanges();

                tblPayment newpayment = dc.tblPayments.Where(c => c.Description == "UpdatedPayment").FirstOrDefault();

                Assert.IsNull(newpayment);
            }
        }
        public void UpdateTest()
        {
            using (BudgetManagementEntities dc = new BudgetManagementEntities())
            {
                tblPayment tblpayment = dc.tblPayments.Where(c => c.Description == "TestPayment").FirstOrDefault();
                tblpayment.Description = "UpdatedPayment";

                dc.SaveChanges();

                tblPayment newpayment = dc.tblPayments.Where(c => c.Description == "UpdatedPayment").FirstOrDefault();

                Assert.AreNotEqual(newpayment.Description, "TestPayment");
            }
        }
        public IHttpActionResult DeletetblPayment(int id)
        {
            tblPayment tblPayment = db.tblPayments.Find(id);

            if (tblPayment == null)
            {
                return(NotFound());
            }

            db.tblPayments.Remove(tblPayment);
            db.SaveChanges();

            return(Ok(tblPayment));
        }
Beispiel #18
0
        // GET: tblPayments/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblPayment tblPayment = db.tblPayments.Find(id);

            if (tblPayment == null)
            {
                return(HttpNotFound());
            }
            return(View(tblPayment));
        }
        public ActionResult Create(PaymentModel P)
        {
            tblPayment pa = new tblPayment();

            pa.intPaymentID    = P.PaymentID;
            pa.intAppoitmentID = P.AppoitmentID;
            pa.decAmount       = P.Amount;
            pa.strStatus       = P.Status;

            db.tblPayments.Add(pa);
            db.SaveChanges();


            return(RedirectToAction("Index"));
        }
        public void InsertTest()
        {
            using (BudgetManagementEntities dc = new BudgetManagementEntities())
            {
                tblPayment tblpayment = new tblPayment();
                tblpayment.Id          = Guid.NewGuid();
                tblpayment.Description = "TestPayment";

                dc.tblPayments.Add(tblpayment);
                dc.SaveChanges();

                tblPayment newpayment = dc.tblPayments.Where(c => c.Description == "TestPayment").FirstOrDefault();

                Assert.AreEqual(newpayment.Description, "TestPayment");
            }
        }
        public ActionResult Edit(PaymentModel pm)
        {
            tblPayment p = db.tblPayments.SingleOrDefault(x => x.intPaymentID == pm.PaymentID);


            if (p != null)
            {
                p.intPaymentID    = pm.PaymentID;
                p.decAmount       = pm.Amount;
                p.intAppoitmentID = pm.AppoitmentID;
                p.strStatus       = pm.Status;

                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Beispiel #22
0
        public PaymentModel SavePGTransaction(PaymentModel objPaymentModel)
        {
            try
            {
                AVOAIALifeEntities Context      = new AVOAIALifeEntities();
                tblPolicy          objtblpolicy = new tblPolicy();
                objtblpolicy = Context.tblPolicies.Where(a => a.ProposalNo == objPaymentModel.ProposalNo).FirstOrDefault();

                if (objtblpolicy != null)
                {
                    tblPolicyPaymentMap policyPaymentMap = new tblPolicyPaymentMap();
                    policyPaymentMap.CreatedDate = DateTime.Now;
                    tblPayment payment = new tblPayment();
                    payment.CreatedDate = DateTime.Now;


                    payment.TxnNo            = objPaymentModel.TransactionNo;
                    payment.PaidAmount       = Convert.ToDecimal(objPaymentModel.PayableAmount);
                    payment.ChequeSubmission = false;
                    payment.ReceiptNo        = "NOTACK";
                    payment.PayerType        = objPaymentModel.ReqId;
                    if (payment.PaymentID == decimal.Zero)
                    {
                        Context.tblPayments.Add(payment);
                    }


                    policyPaymentMap.Premium       = objtblpolicy.tblProposalPremiums.FirstOrDefault().AnnualPremium;
                    policyPaymentMap.PaidAmount    = 0;
                    policyPaymentMap.PendingAmount = policyPaymentMap.Premium - policyPaymentMap.PaidAmount;
                    policyPaymentMap.tblPayment    = payment;
                    policyPaymentMap.tblPolicy     = objtblpolicy;
                    if (policyPaymentMap.PolicyPaymentMapID == decimal.Zero)
                    {
                        Context.tblPolicyPaymentMaps.Add(policyPaymentMap);
                    }
                }
                Context.SaveChanges();
                return(objPaymentModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #23
0
        public ActionResult Delete(int Id)
        {
            try
            {
                // get original record for unedited fields
                tblPayment record = db.tblPayments.Where(x => x.id == Id).Single();

                // Delete record
                db.Entry(record).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }

            return(Json(new { isDeleted = true }));
        }
Beispiel #24
0
        public int Insert()
        {
            int result = 0;

            try
            {
                using (BudgetManagementEntities dc = new BudgetManagementEntities())
                {
                    tblPayment make = new tblPayment();
                    make.Id          = Guid.NewGuid();
                    make.Description = this.Description;

                    dc.tblPayments.Add(make);
                    result = dc.SaveChanges();
                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult MakePayment()
        {
            if (Session["UserID"] == null && Session["UserName"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }

            try
            {
                int        PGID    = Convert.ToInt32(Request.Form["PGID"]);
                decimal    Amount  = Convert.ToDecimal(Request.Form["Amount"]);
                tblPayment payment = db.tblPayments.SingleOrDefault(P => P.PhotographerID == PGID);

                if (payment.RemainingPay < Amount)
                {
                    return(Json(new { success = false, message = "Amount must be less than remaining pay!" }, JsonRequestBehavior.AllowGet));
                }

                payment.TotalPay       += Amount;
                payment.RemainingPay   -= Amount;
                payment.PaymentDate     = DateTime.Now;
                db.Entry(payment).State = EntityState.Modified;
                db.SaveChanges();

                tblPaymentHistory paymentHistory = new tblPaymentHistory();
                paymentHistory.PhotographerID = PGID;
                paymentHistory.TotalPay       = Amount;
                paymentHistory.RemainingPay   = payment.RemainingPay;
                paymentHistory.PaymetnDate    = DateTime.Now;
                db.tblPaymentHistories.Add(paymentHistory);
                db.SaveChanges();

                return(Json(new { success = true, message = "Payment Done!" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #26
0
 public int Update()
 {
     try
     {
         using (BudgetManagementEntities dc = new BudgetManagementEntities())
         {
             if (this.Id != Guid.Empty)
             {
                 tblPayment make = dc.tblPayments.Where(c => c.Id == this.Id).FirstOrDefault();
                 make.Description = this.Description;
                 return(dc.SaveChanges());
             }
             else
             {
                 throw new Exception("Id is not set.");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public ActionResult payment1(tblPayment p)
        {
            if (ModelState.IsValid)                             //if validations are satisfied then it goes into model
            {
                tblBooking z = (tblBooking)Session["var"];      //here we are retrieving tblbooking object values that are stored in session variable


                bool s = Dbclass.getpayment(p);
                if (s == true)                                 //if payment is done successfully then it goes to insertion of booking
                {
                    string x = Dbclass.getbooking(z);          //for inserting into booking
                    ViewBag.g = x;
                }
                return(View());
            }
            else
            {
                ViewBag.msg    = Session["bill"].ToString();
                slist          = Dbclass.getstate();
                ViewBag.bankid = slist;
                return(View("payment"));                       //it will show where the validation is missing
            }
        }
Beispiel #28
0
        public PaymentModel AckPaymentandProcess(AVOAIALifeEntities Context, PaymentModel objPaymentModel, tblPolicy objtblpolicy)
        {
            SMSIntegration objSMSIntegration = new SMSIntegration();
            SMSDetails     objSMSDetails     = new SMSDetails();

            Common.CommonBusiness objCommonBusiness = new Common.CommonBusiness();
            #region UW deviations
            UWRuleLogic objLogic       = new UWRuleLogic();
            PolicyLogic objPolicyLogic = new PolicyLogic();
            objPaymentModel.Message = string.Empty;


            bool dataUpdated = false;
            var  ilData      = Context.tblLogILUpdates.Where(a => a.ProposalNo == objPaymentModel.ProposalNo).FirstOrDefault();
            if (ilData != null)
            {
                if (ilData.ServiceStatus == "SUCC" && ilData.ServiceName == "ModifyProposal")
                {
                    dataUpdated = true;
                }
            }
            if (dataUpdated)
            {
                //S003
                var CustomerDetails = objtblpolicy.tblPolicyRelationships.FirstOrDefault().tblPolicyClient;
                //var Title = Context.tblMasCommonTypes.Where(a => a.Code == CustomerDetails.Title).Select(a => a.ShortDesc).FirstOrDefault();
                //objSMSDetails.Salutation = objCommonBusiness.ConverttoTitlecase(Title);
                string Sal        = CustomerDetails.Title;
                var    Salutation = Context.tblMasCommonTypes.Where(a => a.Code == Sal && a.MasterType == "Salutation").Select(a => a.ShortDesc).FirstOrDefault();
                var    Salu       = Context.tblMasCommonTypes.Where(a => a.Description == Sal && a.MasterType == "Salutation").Select(a => a.ShortDesc).FirstOrDefault();
                if (!String.IsNullOrEmpty(Salutation))
                {
                    objSMSDetails.Salutation = Salutation;
                }
                else if (!String.IsNullOrEmpty(Salu))
                {
                    objSMSDetails.Salutation = Salu;
                }
                else
                {
                    objSMSDetails.Salutation = Sal;
                }
                var Name = "";
                if (CustomerDetails.FullName == "CORP")
                {
                    Name = CustomerDetails.CorporateName;
                }
                else
                {
                    Name = CustomerDetails.LastName;
                }
                objSMSDetails.Name           = objCommonBusiness.ConverttoTitlecase(Name);
                objSMSDetails.SMSTemplate    = "S003";
                objSMSDetails.ProposalNumber = objPaymentModel.ProposalNo;
                objSMSDetails.MobileNumber   = CustomerDetails.MobileNo;
                objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]);
                if (!String.IsNullOrEmpty(objSMSDetails.MobileNumber))
                {
                    objSMSIntegration.SMSNotification(objSMSDetails);
                }
                objPaymentModel = (PaymentModel)IL.RecieptEnquiry(objPaymentModel);
            }
            if ((objPaymentModel.PayingAmount) >= (Convert.ToDecimal(objPaymentModel.PayableAmount) - 100) || System.Web.Configuration.WebConfigurationManager.AppSettings["PublishEnvironment"] == "SIT")
            {
                AIA.Life.Models.Policy.Policy objPolicy = new AIA.Life.Models.Policy.Policy();
                objPolicy.ProposalFetch = true;
                objPolicy.ProposalNo    = objPaymentModel.ProposalNo;
                objPolicy.QuoteNo       = objtblpolicy.QuoteNo;
                objPolicy = objPolicyLogic.FetchProposalInfo(objPolicy);
                // //S012
                if (objPaymentModel.SelectedPayment == "othertypes")
                {
                    var createdBy = Context.tblPolicies.Where(a => a.ProposalNo == objPolicy.ProposalNo).Select(a => a.Createdby).FirstOrDefault();
                    objSMSDetails.MobileNumber = Context.tblUserDetails.Where(a => a.UserID.ToString() == createdBy).Select(a => a.ContactNo).FirstOrDefault();
                    //objSMSDetails.MobileNumber = Context.tblMasIMOUsers.Where(a => a.UserID == objPolicy.AgentCode).Select(a => a.MobileNo).FirstOrDefault();
                    objSMSDetails.SMSTemplate    = "S012";
                    objSMSDetails.PolicyNo       = objPaymentModel.ProposalNo;
                    objSMSDetails.Premium        = String.Format(CultureInfo.GetCultureInfo(1033), "{0:n0}", objPolicy.AnnualPremium); //Convert.ToString(objPolicy.AnnualPremium);
                    objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]);
                    objSMSIntegration.SMSNotification(objSMSDetails);
                }
                string Message = string.Empty;
                if (objtblpolicy.PolicyStageStatusID != 2376)/// Counter offer Case
                {
                    Message = objLogic.ValidateDeviation(objPolicy);
                }

                tblPayment tblPayment = objtblpolicy.tblPolicyPaymentMaps.OrderByDescending(a => a.PolicyPaymentMapID).FirstOrDefault().tblPayment;
                tblPayment.ChequeSubmission = true;
                tblPayment.ReceiptNo        = "ACK";
                string leadNo = Context.tblLifeQQs.Where(a => a.QuoteNo == objtblpolicy.QuoteNo).Select(a => a.tblContact).FirstOrDefault().LeadNo;
                if (dataUpdated)
                {
                    objPaymentModel = (PaymentModel)IL.ProposalPreIssueValidation(objPaymentModel);
                }

                if (!string.IsNullOrEmpty(Message.Trim()) || objtblpolicy.PolicyStageStatusID == 2376)// Or Counter offer Case
                {
                    objPaymentModel.Message = "Success";
                    if (objtblpolicy != null)
                    {
                        objtblpolicy.PolicyRemarks       = Message;
                        objtblpolicy.PolicyStageStatusID = 193;   // UW
                        objtblpolicy.IsAllocated         = false; // Pending for Allocation
                        objtblpolicy.ProposalSubmitDate  = DateTime.Now;
                        if (!string.IsNullOrEmpty(leadNo))
                        {
                            SamsClient samsClient = new SamsClient();
                            samsClient.UpdateLeadStatus(Context, Convert.ToInt32(leadNo), 9);
                        }
                        //SMS S005
                        var createdBy = Context.tblPolicies.Where(a => a.ProposalNo == objPolicy.ProposalNo).Select(a => a.Createdby).FirstOrDefault();
                        objSMSDetails.MobileNumber = Context.tblUserDetails.Where(a => a.UserID.ToString() == createdBy).Select(a => a.ContactNo).FirstOrDefault();
                        //objSMSDetails.WPMobileNumber= Context.tblMasIMOUsers.Where(a => a.UserID == objPolicy.UserName).Select(a => a.MobileNo).FirstOrDefault();
                        objSMSDetails.SMSTemplate    = "S005";
                        objSMSDetails.PolicyNo       = objPaymentModel.ProposalNo;
                        objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]);
                        objSMSIntegration.SMSNotification(objSMSDetails);
                    }
                    objPaymentModel.UWMessage = "" + Message;
                    Context.SaveChanges();

                    return(objPaymentModel);
                }
                #endregion



                if (!string.IsNullOrEmpty(objPaymentModel.ProposalNo) && dataUpdated)
                {
                    //objPaymentModel = (PaymentModel)IL.ProposalPreIssueValidation(objPaymentModel);
                    if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage) && (objPaymentModel.PreIssueValidations.Count <= 1))
                    {
                        if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                        {
                            Thread.Sleep(5000);
                            objPaymentModel = (PaymentModel)IL.ProposalUWApproval(objPaymentModel);
                            if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                            {
                                objPaymentModel = (PaymentModel)IL.QualityControl(objPaymentModel);
                                if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                                {
                                    objPaymentModel = (PaymentModel)IL.ProposalIssuance(objPaymentModel);
                                    if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                                    {
                                        objtblpolicy.PolicyNo            = objPaymentModel.ProposalNo = objPolicy.ProposalNo;
                                        objtblpolicy.PolicyStageStatusID = 192;// Issued
                                        DateTime today         = DateTime.Now;
                                        int[]    exceptionDays = new int[3] {
                                            29, 30, 31
                                        };
                                        if (exceptionDays.Contains(today.Day))
                                        {
                                            today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 28);
                                        }
                                        objtblpolicy.PolicyIssueDate = today;
                                        objtblpolicy.PolicyStartDate = today;
                                        objtblpolicy.PolicyEndDate   = today.AddYears(Convert.ToInt32(objtblpolicy.PolicyTerm));
                                        objPaymentModel.Message      = "Success";
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (dataUpdated)
                        {
                            if (!string.IsNullOrEmpty(leadNo))
                            {
                                SamsClient samsClient = new SamsClient();
                                samsClient.UpdateLeadStatus(Context, Convert.ToInt32(leadNo), 9);
                            }
                            objtblpolicy.PolicyStageStatusID = 193;// UW
                            objtblpolicy.IsAllocated         = false;
                            objtblpolicy.ProposalSubmitDate  = DateTime.Now;
                            objPaymentModel.UWMessage        = "Your proposal has been forwarded to underwriter for further processing.";
                        }
                        else
                        {
                            objPaymentModel.UWMessage = "Payment is Successful. Your proposal is under processing, you will be notified soon.";
                        }
                    }
                    Context.SaveChanges();
                }
            }
            else
            {
                if (objPaymentModel.PayingAmount == 0)
                {
                    objPaymentModel.UWMessage = "Payment is Successful. Your proposal is under processing, you will be notified soon.";
                }
                else
                {
                    objPaymentModel.UWMessage = "Your payment is successful. Payment reference number is " + objPaymentModel.TransactionNo;
                }
            }
            return(objPaymentModel);
        }
Beispiel #29
0
        public void InsertPayment()
        {
            try
            {
                using (KungFuEntities2 entities = new KungFuEntities2())
                {
                    var studentID = (from obj in entities.tblStudents
                                     where obj.STU_NUM == txtStudentNumber.Text
                                     select obj.STU_ID).FirstOrDefault();


                    //var query = entities.tblStudents.AsEnumerable().Where(s => s.STU_NUM.Contains(txtStudentNumber.Text)).Select(s => s.STU_ID).Distinct();
                    if (studentID != 0)
                    {
                        int ihdnPKID   = int.Parse(hdnPKId.Value);
                        var objPayment = entities.tblPayments.Where(s => s.PAYMENT_ID == ihdnPKID).OrderByDescending(s => s.PAYMENT_ID).FirstOrDefault();
                        if (objPayment == null)
                        {
                            objPayment = new tblPayment();
                        }
                        objPayment.PAYMENT_AMOUNT       = Convert.ToDecimal(txtAmount.Text);
                        objPayment.PAYMENT_DATE         = DateTime.ParseExact(txtDOP.Text, "MM/dd/yyyy", null);
                        objPayment.PAYMENT_TYPE_ID      = Convert.ToInt32(ddlPaymentType.SelectedValue);
                        objPayment.PAYMENT_CREATED_BY   = entities.tblInstructors.AsEnumerable().FirstOrDefault().INSTRUCTOR_ID;
                        objPayment.PAYMENT_CREATED_DATE = DateTime.Now;
                        objPayment.STU_ID         = Convert.ToInt32(studentID);
                        objPayment.PAYMENT_STATUS = chkIsApprove.Checked;

                        if (objPayment.PAYMENT_ID == 0)
                        {
                            entities.tblPayments.Add(objPayment);
                        }
                        else
                        {
                            objPayment.PAYMENT_MODIFY_BY     = entities.tblInstructors.Select(x => x.INSTRUCTOR_ID).FirstOrDefault();
                            objPayment.PAYMENT_MODIFIED_DATE = DateTime.Now;
                            entities.Entry(objPayment).State = System.Data.Entity.EntityState.Modified;
                        }
                        entities.SaveChanges();

                        objPayment = null;
                        if (hdnPKId.Value != "0")
                        {
                            Response.Redirect("PaymentList.aspx");
                        }

                        ResetControls();
                        divMessage.Visible  = true;
                        divErrorMsg.Visible = false;
                    }
                    else
                    {
                        divErrorMsg.Visible = true;
                        divMessage.Visible  = false;
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #30
0
        public ActionResult Index(tblPayment model, FormCollection coll)
        {
            model.Payment_Date = ToDate(coll["Payment_Date"]);
            model.Period_From  = ToDate(coll["Period_From"]);
            model.Period_To    = ToDate(coll["Period_To"]);
            model.Input_Date   = ToDate(coll["Input_Date"]);

            try
            {
                if (model.id == 0)
                {   // insert
                    model.Input_Date        = DateTime.Now.Date;
                    model.Deposit_Indicator = GetAttyBreakdown(model.Claim_Number);

                    // Insert into table
                    db.tblPayments.Add(model);
                    db.SaveChanges();

                    // get original record for unedited fields
                    tblPayment record = db.tblPayments.Where(x => x.id == model.id).Single();
                    return(Json(record));
                }
                else
                {   // update
                    // get original record for unedited fields
                    tblPayment record = db.tblPayments.Where(x => x.id == model.id).Single();

                    // transfer form fields
                    record.Claim_Number      = model.Claim_Number;
                    record.Payment_Date      = model.Payment_Date;
                    record.Period_From       = model.Period_From;
                    record.Period_To         = model.Period_To;
                    record.Amount            = model.Amount;
                    record.Input_Date        = model.Input_Date;
                    record.Inputter_Name     = model.Inputter_Name;
                    record.Deposit_Indicator = GetAttyBreakdown(model.Claim_Number);
                    record.Posted_Indicator  = model.Posted_Indicator;
                    record.Comment           = model.Comment;

                    // Update record
                    db.Entry(record).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    // transfer data
                    Payments payment = new Payments()
                    {
                        id                = record.id,
                        Claim_Number      = record.Claim_Number,
                        Payment_Date      = record.Payment_Date.ToString(),
                        Period_From       = record.Period_From.ToString(),
                        Period_To         = record.Period_To.ToString(),
                        Amount            = record.Amount,
                        Input_Date        = record.Input_Date.ToString(),
                        Inputter_Name     = record.Inputter_Name,
                        Deposit_Indicator = record.Deposit_Indicator,
                        Posted_Indicator  = record.Posted_Indicator,
                        Comment           = record.Comment
                    };

                    return(Json(payment));
                }
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }
        }