Ejemplo n.º 1
0
        public void AddEducationShoppingOrderAllAccessPass(DLModel.EducationShoppingCart shoppingcart)
        {
            DLModel.Order order = new DLModel.Order();
            order.UserID      = shoppingcart.UserID;
            order.OrderDate   = DateTime.Now;
            order.OrderNumber = System.DateTime.Now.ToShortDateString().Replace("/", "").ToString();
            int orderID = AddShoppingOrder(order);

            DLModel.EducationShopping educationShopping = new DLModel.EducationShopping();
            educationShopping.OrderID             = orderID;
            educationShopping.CoupanID            = shoppingcart.CoupanID;
            educationShopping.Date                = DateTime.Now;
            educationShopping.EducationID         = shoppingcart.EduorProID;
            educationShopping.EducationTypeID     = shoppingcart.EducationTypeID;
            educationShopping.Quantity            = shoppingcart.Quantity;
            educationShopping.Grandtotal          = shoppingcart.Price * shoppingcart.Quantity;
            educationShopping.UserID              = shoppingcart.UserID;
            educationShopping.ShippingPaymentID   = shoppingcart.ShippingPaymentID;
            educationShopping.UserAllAccessPassID = shoppingcart.UserAllAccessPassID;
            _educationShoppingRepository.Add((DLModel.EducationShopping) new DLModel.EducationShopping().InjectFrom(educationShopping));

            DLModel.MyEducation myEducation = new DLModel.MyEducation();
            myEducation.UserID          = shoppingcart.UserID;
            myEducation.EducationTypeID = shoppingcart.EducationTypeID;
            myEducation.EducationID     = shoppingcart.EduorProID;
            myEducation.PurchaseDate    = System.DateTime.Now.Date;
            myEducation.CredentialID    = shoppingcart.CredentialID;
            int MEID = _myEducatoinBL.AddMyEducation(myEducation);

            _myEducatoinBL.AddEducationModuleToMyEducationByEducationID(MEID, shoppingcart.EduorProID);
        }
Ejemplo n.º 2
0
 public void UpdateMyEducationForCertificateByMEID(int meid, bool isPrinted, string certificateName)
 {
     DLModel.MyEducation myeducation = new DLModel.MyEducation {
         MEID = meid,
         CertificatePrinted = isPrinted,
         CertificateURL     = certificateName
     };
     _myEducationRepository.Update(myeducation, hp => hp.CertificatePrinted, hp => hp.CertificateURL);
 }
Ejemplo n.º 3
0
        public void UpdateMyEducationCourseCompletedByMEMID(int MEMID, int MEID)
        {
            DLModel.MyEducationModule myeducationmodule = new DLModel.MyEducationModule {
                MEMID         = MEMID,
                Completed     = true,
                CompletedDate = System.DateTime.Now
            };
            _myEducationModuleRepository.Update(myeducationmodule, rk => rk.Completed, rk => rk.CompletedDate);

            // check if all the module is completed then need to set completed the my education coruse.
            //int meID = _myEducationModuleRepository.GetById(MEMID).MEID;
            if (_myEducationModuleRepository.GetAll(rk => rk.MEID == MEID && rk.Completed == false).Count() == 0)
            {
                // all module completd and need to set course completed
                DLModel.MyEducation myeducation = new DLModel.MyEducation
                {
                    MEID          = MEID,
                    Completed     = true,
                    CompletedDate = System.DateTime.Now
                };
                _myEducationRepository.Update(myeducation, rk => rk.Completed, rk => rk.CompletedDate);
            }
        }
Ejemplo n.º 4
0
 public int UpdateMyEducation(DLModel.MyEducation myEducation)
 {
     return(_myEducationRepository.Update((DLModel.MyEducation) new DLModel.MyEducation().InjectFrom(myEducation)));
 }
Ejemplo n.º 5
0
 public int AddMyEducation(DLModel.MyEducation myEducation)
 {
     return(_myEducationRepository.Add((DLModel.MyEducation) new DLModel.MyEducation().InjectFrom(myEducation)).MEID);
 }
Ejemplo n.º 6
0
        public void AddEducationShoppingOrder(IEnumerable <DLModel.EducationShoppingCart> shoppingcart)
        {
            DLModel.Order order = new DLModel.Order();
            order.UserID      = shoppingcart.FirstOrDefault().UserID;
            order.OrderDate   = DateTime.Now;
            order.OrderNumber = System.DateTime.Now.ToShortDateString().Replace("/", "").ToString();
            int orderID = AddShoppingOrder(order);

            foreach (var item in shoppingcart)
            {
                if (item.CartType == "Course")
                {
                    DLModel.EducationShopping educationShopping = new DLModel.EducationShopping();
                    educationShopping.OrderID           = orderID;
                    educationShopping.CoupanID          = item.CoupanID;
                    educationShopping.Date              = DateTime.Now;
                    educationShopping.EducationID       = item.EduorProID;
                    educationShopping.EducationTypeID   = item.EducationTypeID;
                    educationShopping.Quantity          = item.Quantity;
                    educationShopping.Grandtotal        = item.Price * item.Quantity;
                    educationShopping.UserID            = item.UserID;
                    educationShopping.ShippingPaymentID = item.ShippingPaymentID.Value;
                    _educationShoppingRepository.Add((DLModel.EducationShopping) new DLModel.EducationShopping().InjectFrom(educationShopping));

                    DLModel.MyEducation myEducation = new DLModel.MyEducation();
                    myEducation.UserID          = item.UserID;
                    myEducation.EducationTypeID = item.EducationTypeID;
                    myEducation.EducationID     = item.EduorProID;
                    myEducation.PurchaseDate    = System.DateTime.Now.Date;
                    myEducation.CredentialID    = item.CredentialID;
                    int MEID = _myEducatoinBL.AddMyEducation(myEducation);
                    _myEducatoinBL.AddEducationModuleToMyEducationByEducationID(MEID, item.EduorProID);
                }
                else
                {
                    DLModel.ProductShopping productShopping = new DLModel.ProductShopping();
                    productShopping.OrderID           = orderID;
                    productShopping.CoupanID          = item.CoupanID;
                    productShopping.Date              = DateTime.Now;
                    productShopping.ProductID         = item.EduorProID;
                    productShopping.Quantity          = item.Quantity;
                    productShopping.Grandtotal        = item.Price * item.Quantity;
                    productShopping.UserID            = item.UserID;
                    productShopping.ShippingPaymentID = item.ShippingPaymentID.Value;
                    // _productShoppingRepository.Add((DLModel.ProductShopping)new DLModel.ProductShopping().InjectFrom(productShopping));
                    _productShoppingRepository.Add(productShopping);

                    HCRGUniversity.Core.Data.Model.ProductQuantity _productQuantity = new DLModel.ProductQuantity();
                    _productQuantity.ProdQuantity     = productShopping.Quantity;
                    _productQuantity.ProdQuantityDate = DateTime.Now;
                    _productQuantity.ProductID        = productShopping.ProductID;
                    _productQuantity.UserID           = productShopping.UserID;
                    _productQuantity.Mode             = "Sold";
                    _productQuantityRepository.Add(_productQuantity);

                    ////

                    //HCRGUniversity.Core.Data.Model.Product _product = _productRepository.GetById(_productQuantity.ProductID);
                    //_product.ProductCurrentBalance = _product.ProductCurrentBalance.Value - _productQuantity.ProdQuantity;
                    //_productRepository.Update((DLModel.Product)new DLModel.Product().InjectFrom(_product));
                }
            }



            //_educationShoppingTempBL.DeleteEducationShoppingCartByUserID(shoppingcart.FirstOrDefault().UserID);
            //_educationShoppingTempBL.DeleteProductShoppingCartByUserID(shoppingcart.FirstOrDefault().UserID);
        }