public async Task <HttpResponseMessage> GetStudentPayment(int batchID, int userID)
        {
            try
            {
                PaymentDAL dal = new PaymentDAL();
                List <StudentPaymentInfo> StudentPaymentInfo = await dal.GetStudentPayment(batchID, userID);

                List <RemodulePaymentInfo> RemodulePaymentInfoList = await dal.GetRemoduleStudent(batchID, userID);

                PaymentWrap paymentWrap = new PaymentWrap();
                paymentWrap.StudentPayment  = StudentPaymentInfo;
                paymentWrap.RemodulePayment = RemodulePaymentInfoList;
                if (paymentWrap != null)
                {
                    return(Request.CreateResponse <PaymentWrap>(HttpStatusCode.OK, paymentWrap));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
        public DataTable Payment_ConfirmationBLL(Customer aCustomer)
        {
            PaymentDAL aPaymentDAL = new PaymentDAL();
            DataTable  dTable      = aPaymentDAL.Payment_ConfirmationDAL(aCustomer);

            return(dTable);
        }
        public DataTable ViewPayment_InformationIn_textboxBLL(Customer aCustomer)
        {
            PaymentDAL aPaymentDAL = new PaymentDAL();
            DataTable  dTable      = aPaymentDAL.ViewPayment_InformationIn_textboxDAL(aCustomer);

            return(dTable);
        }
        public async Task <HttpResponseMessage> GetPayment(int courseID = 0, int batchID = 0, int?userID = 0, string year = "", string month = "", string type = "Total", int currentIndex = 1, int maxRows = 5)
        {
            try
            {
                if (String.IsNullOrEmpty(year) || year == "\"\"")
                {
                    DateTime dateTime = DateTime.Now;
                    year = dateTime.ToString("yyyy");
                }
                PaymentDAL            dal  = new PaymentDAL();
                List <MIUPaymentInfo> data = await dal.GetPayment(courseID, batchID, userID, year, month, type, currentIndex, maxRows);

                if (data != null)
                {
                    return(Request.CreateResponse <List <MIUPaymentInfo> >(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
        public bool Payment_Cancel(int ReservationID, Cost aCost)
        {
            PaymentDAL aPaymentDAL = new PaymentDAL();
            bool       res         = aPaymentDAL.Cancel_PaymentDAL(ReservationID, aCost);

            return(res);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Payment payment = PaymentDAL.Get(1);

            Console.WriteLine(payment);
            Console.Read();
        }
Esempio n. 7
0
    public DataSet Find_Pay_Firstly(String str)
    {
        PaymentDAL PDAL = new PaymentDAL();
        DataSet    data = null;

        data = PDAL.Find_Pay_First(str);

        return(data);
    }
Esempio n. 8
0
        void GetPaymentByUserId_Test()
        {
            //Pass
            Assert.NotEmpty(PaymentDAL.GetPaymentByUserId(1));

            //Fail
            Assert.Empty(PaymentDAL.GetPaymentByUserId(1000000));
            Assert.Empty(PaymentDAL.GetPaymentByUserId(-5));
        }
Esempio n. 9
0
        void GetPaymentById()
        {
            //pass
            Assert.NotNull(PaymentDAL.GetPaymentById(1));
            Assert.NotNull(PaymentDAL.GetPaymentById(3));

            //fail
            Assert.Null(PaymentDAL.GetPaymentById(-1));
            Assert.Null(PaymentDAL.GetPaymentById(3000));
        }
Esempio n. 10
0
        public SqlDataAdapter GetReciept(Users u)
        {
            SqlDataAdapter rd;

            PaymentDAL p = new PaymentDAL();

            SqlParameter[] sp = new SqlParameter[1];
            sp[0] = new SqlParameter("@policy", u.PolicyNumber);
            rd    = p.GenerateReciept(sp);

            return(rd);
        }
Esempio n. 11
0
        public int PayPremium(Users u)
        {
            PaymentDAL p = new PaymentDAL();

            SqlParameter[] sp = new SqlParameter[3];
            sp[0] = new SqlParameter("@channel", u.ChannelID);
            sp[1] = new SqlParameter("@policy", u.PolicyNumber);
            sp[2] = new SqlParameter("@date", u.PayedOn);
            int i = p.RecordPay(sp);

            return(i);
        }
Esempio n. 12
0
        public static List <TenantPayment> GetPaymentsByUser(int buildingId, int userId)
        {
            var x = PaymentConverter.ListToDTOTenantPayment(PaymentDAL.GetPaymentsByBuilding(buildingId));
            var y = PaymentDAL.GetPaymentsForUser(userId).ToList();

            x.ForEach(z =>
            {
                z.Status      = y.Select(t => t.payment_id).Contains(z.PaymentId) ? true : false;
                z.TenantId    = userId;
                z.PaymentDate = y.FirstOrDefault(u => u.payment_id == z.PaymentId)?.paymentDate ?? default(DateTime);
            });
            return(x);
        }
Esempio n. 13
0
        public static void AddPayment(Expenditure expenditure)
        {
            List <tenant_tbl> tenants = TenantBL.GetAllTenantByBuilding(expenditure.building_id);
            payment_tbl       p       = new payment_tbl
            {
                building_id  = expenditure.building_id,
                description  = expenditure.description,
                sum          = expenditure.sum / tenants.Count,
                pay_for_date = DateTime.Now,
            };

            PaymentDAL.Addpayment(p);
        }
Esempio n. 14
0
 public int CancelPaymentBLL(Payment aPayment)
 {
     if (aPayment.CID == 0)
     {
         return(3);
     }
     else
     {
         PaymentDAL aPaymentDAL = new PaymentDAL();
         int        res         = aPaymentDAL.CancelPaymentDAL(aPayment);
         return(res);
     }
 }
Esempio n. 15
0
 public bool SavePaymenInformationtBLL(Payment aPayment)
 {
     if (aPayment.PaymentStatus == "" || aPayment.Discount < 0 || aPayment.LastPayment < 0)
     {
         return(false);
     }
     else
     {
         PaymentDAL aPAymentDAL = new PaymentDAL();
         bool       res         = aPAymentDAL.SavePaymenInformationtDAL(aPayment);
         return(res);
     }
 }
Esempio n. 16
0
 public bool save_PaymentInformationBLL(Customer aCustomer, Record aRecord, Cost aCost)
 {
     if (aCustomer.Id == 0 || aRecord.PaymentStatus == "" || aCost.TotalCost == 0 ||(aCost.LastPayment==0 && aCost.Discount==0))
     {
         return false;
     }
     else
     {
         PaymentDAL aPaymentDAL = new PaymentDAL();
         bool result = aPaymentDAL.save_PaymentInformationDAL(aCustomer, aRecord, aCost);
         return result;
     }
 }
 public bool Confirm_PaymentBLL(Customer aCustomer, Record aRecord, Cost aCost)
 {
     if (aCustomer.Name == "" || aCustomer.Age < 18 || aCustomer.Sex == "" || aCustomer.DOB == "" || aCustomer.Profession == "" || aCustomer.ProfessionAddress == "" || aCustomer.PresentAddress == "" || aCustomer.PermanentAddress == "" || aCustomer.ContactNo == "" || aCustomer.Email == "" || aCustomer.NIDorPassportNo == "" || aRecord.RoomID == 0 || aRecord.RoomNO == "" || aRecord.BookingDate == "" || aRecord.CheckInDate == "" || aRecord.CheckOutDate == "" || aRecord.PaymentStatus == "" || aCost.TotalCost == 0 || aCost.Due == 0)
     {
         return(false);
     }
     else
     {
         PaymentDAL aPaymentDAL = new PaymentDAL();
         bool       Result      = aPaymentDAL.Confirm_PaymentDAL(aCustomer, aRecord, aCost);
         return(Result);
     }
 }
 public bool Cancel_Customer_DiscountBLL(Cost aCost)
 {
     if (aCost.TotalCost == 0 || aCost.Due == 0 || aCost.Discount == 0)
     {
         return(false);
     }
     else
     {
         PaymentDAL aPaymentDAL = new PaymentDAL();
         bool       Result      = aPaymentDAL.Cancel_Customer_DiscountDAL(aCost);
         return(Result);
     }
 }
        // GET: Admin/Payments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var payment = new PaymentDAL().ViewDetail(id);

            if (payment == null)
            {
                return(HttpNotFound());
            }
            return(View(payment));
        }
        public DataTable Get_CustomerDetails_For_DiscountBLL(Cost aCost)
        {
            DataTable dTable = null;

            if (aCost.Id == 0)
            {
                return(dTable);
            }
            else
            {
                PaymentDAL aPaymentDAL = new PaymentDAL();
                dTable = aPaymentDAL.Get_CustomerDetails_For_DiscountDAL(aCost);
                return(dTable);
            }
        }
        // GET: Admin/Payments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var payment = new PaymentDAL().ViewDetail(id);

            if (payment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PaymentMethodID = new SelectList(db.PaymentMethods, "PaymentMethodID", "Name", payment.PaymentMethodID);
            ViewBag.PaymentStatusID = new SelectList(db.PaymentStatus, "PaymentStatusID", "Name", payment.PaymentStatusID);
            return(View(payment));
        }
Esempio n. 22
0
    public int Delete_Pay(Payment P)
    {
        PaymentDAL PDAL = new PaymentDAL();

        try
        {
            return(PDAL.Delete_Pay(P));
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
        }
    }
Esempio n. 23
0
    public DataTable BindGrid_with(Payment P)
    {
        PaymentDAL PDAL = new PaymentDAL();

        try
        {
            return(PDAL.GetData_with(P));
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
        }
    }
Esempio n. 24
0
    public int Insert(Payment pay_det)
    {
        PaymentDAL PDAL = new PaymentDAL();

        try
        {
            return(PDAL.Insert(pay_det));
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
            pay_det = null;
        }
    }
Esempio n. 25
0
    public int Update_Pay(Payment pay_det)
    {
        PaymentDAL PDAL = new PaymentDAL();

        try
        {
            return(PDAL.Update_Pay(pay_det));
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
            pay_det = null;
        }
    }
Esempio n. 26
0
        public void CreateBill_Test()
        {
            //Pass
            Bill bill = new Bill()
            {
                App       = ApplicationDAL.GetApplicationById(3),
                User      = UserDAL.GetUserById(2),
                Payment   = PaymentDAL.GetPaymentById(2),
                UnitPrice = ApplicationDAL.GetApplicationById(3).Price
            };

            Assert.True(CreateBill(bill));

            //Fail
            //buy this app that has bougth
            bill = new Bill()
            {
                App       = ApplicationDAL.GetApplicationById(1),
                User      = UserDAL.GetUserById(1),
                UnitPrice = ApplicationDAL.GetApplicationById(1).Price * 0.5,
            };
            Assert.False(CreateBill(bill));

            //buy an app that haven't sold!
            bill = new Bill()
            {
                App       = ApplicationDAL.GetApplicationById(1000),
                User      = UserDAL.GetUserById(1),
                UnitPrice = ApplicationDAL.GetApplicationById(1).Price * 0.5,
            };
            Assert.False(CreateBill(bill));

            //buy an app by an user haven't resigter!
            bill = new Bill()
            {
                App       = ApplicationDAL.GetApplicationById(7),
                User      = UserDAL.GetUserById(100),
                UnitPrice = ApplicationDAL.GetApplicationById(1).Price * 0.5,
            };
            Assert.False(CreateBill(bill));
        }
        public ActionResult Create([Bind(Include = "PaymentID,OrderID,PaymentMethodID,PaymentStatusID,PaymentDate,TotalPrice,Note,CreateDate,CreateUser,ModifiedDate,ModifiedUser,TransactionID,TrackingID,IsActive")] Payment payment)
        {
            var UserSession = (UserLogin)Session[TechDeviShopVs002.Common.CommonConstants.USER_SESSION];

            if (ModelState.IsValid)
            {
                var _dal = new PaymentDAL();

                payment.CreateUser = UserSession.UserID;

                int id = _dal.Insert(payment);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "Payments"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm thanh toán ko thành công");
                }
            }
            ViewBag.PaymentMethodID = new SelectList(db.PaymentMethods, "PaymentMethodID", "Name", payment.PaymentMethodID);
            ViewBag.PaymentStatusID = new SelectList(db.PaymentStatus, "PaymentStatusID", "Name", payment.PaymentStatusID);
            return(View(payment));
        }
Esempio n. 28
0
        protected void btnAddPayment_Click(object sender, EventArgs e)
        {
            int _payAmount = 0;

            int.TryParse(txtPayAmount.Text, out _payAmount);
            DateTime _payDate = new DateTime();

            DateTime.TryParse(txtPayDate.Text, out _payDate);
            if (_payDate.Year < 2000)
            {
                _payDate = Convert.ToDateTime("01/01/2000");
            }
            Payment newPay = new Payment();

            newPay.Amount      = _payAmount;
            newPay.PaymentDate = _payDate;
            newPay.RecordDate  = System.DateTime.Now;
            newPay.Comment     = txtPayComment.Text.Trim();
            PaymentDAL newDal = new PaymentDAL();

            newDal.SavePayment(newPay);
            dsPaymentListing.DataBind();
            grdPaymentList.DataBind();
        }
Esempio n. 29
0
        //public static List<Payment> GetAlltenantPayment(int buildingId)
        //{
        //    var x = PaymentConverter.ListToDTOTenantPayment(PaymentDAL.GetPaymentsByBuilding(buildingId));
        //    var y =TenantPayment.
        //    x.ForEach(z =>
        //    {
        //        z.Status = y.Select(t => t.payment_id).Contains(z.PaymentId) ? true : false;
        //        z.TenantId = userId;
        //        z.PaymentDate = y.FirstOrDefault(u => u.payment_id == z.PaymentId)?.paymentDate ?? default(DateTime);
        //    });
        //    return x;


        //    return PaymentConverter.ListToDTO(PaymentDAL.GetPaymentsByBuilding(buildingId));
        //}

        public static Payment GetById(int id)
        {
            return(PaymentConverter.ToDTO(PaymentDAL.GetById(id)));
        }
Esempio n. 30
0
 public static List <Payment> GetPaymentsByBuilding(int buildingId)
 {
     return(PaymentConverter.ListToDTO(PaymentDAL.GetPaymentsByBuilding(buildingId)));
 }