コード例 #1
0
        public ActionResult Index(string eid)
        {
            eid = _encryptionService.DecryptString2(eid);
            Int32 eduId = 0;

            if (eid == "" || eid == null)
            {
                eduId = EducationID;
            }
            else
            {
                eduId = Convert.ToInt32(eid);
            }
            EducationID = eduId;
            EducationTypesAvailableViewModel EducationTypesAvailableViewModel = new Domain.ViewModels.EducationTypeAvailableViewModel.EducationTypesAvailableViewModel();

            EducationTypesAvailableViewModel.EducationTypesAvailableResults = Mapper.Map <IEnumerable <EducationTypesAvailable> >(_educationService.GetEducationTypeByEducationID(eduId));
            EducationTypesAvailableViewModel.EducationDetailPageResults     = Mapper.Map <EducationDetailPageWithEducation>(_educationService.GetEducationDetailPageContent(eduId));
            EducationTypesAvailableViewModel.EducationCredentialResults     = Mapper.Map <IEnumerable <EducationCredential> >(_educationService.GetEducationCredentialByEducationID(eduId));
            EducationTypesAvailableViewModel.Education = Mapper.Map <Education>(_educationService.GetEducationByID(eduId));
            //   string a = EducationTypesAvailableViewModel.Education.CourseStartDate.ToString("yyyy-MM-dd");

            if (EducationTypesAvailableViewModel.Education.CourseStartDate <= DateTime.Now && EducationTypesAvailableViewModel.Education.CourseEndDate > DateTime.Now)
            {
                EducationTypesAvailableViewModel.Education.CanPurchase = true;
            }
            else
            {
                EducationTypesAvailableViewModel.Education.CanPurchase = false;
            }
            string decodedHTML = HttpUtility.HtmlDecode(EducationTypesAvailableViewModel.EducationDetailPageResults.PContent);

            if (decodedHTML != null)
            {
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = decodedHTML.Replace(GlobalConst.Message.SlashStoragePath, GlobalConst.Message.StoragePath);
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = EducationTypesAvailableViewModel.EducationDetailPageResults.PContent.Replace("/richtexteditor/", GlobalConst.Extension.http + GlobalConst.ConstantChar.Colon + GlobalConst.ConstantChar.ForwardSlash + GlobalConst.ConstantChar.ForwardSlash + Request.Url.Host.ToLower() + GlobalConst.ConstantChar.Colon + Request.Url.Port + "/richtexteditor/");
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = EducationTypesAvailableViewModel.EducationDetailPageResults.PContent.Replace("&nbsp;", "");
            }
            else
            {
                EducationTypesAvailableViewModel.EducationDetailPageResults.PContent = EducationTypesAvailableViewModel.EducationDetailPageResults.PContent;
            }
            return(View(EducationTypesAvailableViewModel));
        }
コード例 #2
0
        public ActionResult Add(EducationModule educationmodule, string hdEducationModuleID, string moduleTime, List <HttpPostedFileBase> list_ModuleFile2)
        {
            EducationModule1          educationModule1 = new EducationModule1();
            List <HttpPostedFileBase> list_ModuleFile  = new List <HttpPostedFileBase>();


            if (list_ModuleFile2.Count() > 0 && list_ModuleFile2[0] != null)
            {
                list_ModuleFile = list_ModuleFile2;
            }
            else if (educationmodule.EducationModuleVideo != null)
            {
                list_ModuleFile.Add(educationmodule.EducationModuleVideo);
            }
            else if (educationmodule.EducationModuleText != null)
            {
                educationmodule.EducationModuleText = educationmodule.EducationModuleText;
            }
            educationmodule.EducationModuleDate = System.DateTime.Now;

            if (educationmodule.EducationModuleVideo == null)
            {
                if (educationmodule.EducationModuleTime != null && educationmodule.EducationModuleTime != "")
                {
                    educationmodule.EducationModuleTime = educationmodule.EducationModuleTime + ":01";
                }
            }

            if (moduleTime != null && moduleTime != "")
            {
                educationmodule.EducationModuleTime = moduleTime;
            }

            if (hdEducationModuleID == "")
            {
                if (educationmodule.EducationModuleDescription == null)
                {
                    educationmodule.EducationModuleDescription = "";
                }
                var moduleID = _educationModuleService.AddEducationModule(Mapper.Map <HCRGUniversityMgtApp.NEPService.EducationModuleService.EducationModule>(educationmodule));
                educationmodule.EducationModuleID = moduleID;
                educationmodule.flag = true;
                educationmodule      = UploadModulefiles(educationmodule, list_ModuleFile, educationmodule.EducationModuleID, educationmodule.EducationModuleText);
            }
            else
            {
                if (educationmodule.EducationModuleDescription == null)
                {
                    educationmodule.EducationModuleDescription = "";
                }
                educationmodule.EducationModuleID = Convert.ToInt32(hdEducationModuleID);
                var moduleID = _educationModuleService.UpdateEducationModule(Mapper.Map <HCRGUniversityMgtApp.NEPService.EducationModuleService.EducationModule>(educationmodule));
                educationmodule.flag = false;
            }
            educationModule1.EducationID                = educationmodule.EducationID;
            educationModule1.EducationModuleDate        = educationmodule.EducationModuleDate;
            educationModule1.EducationModuleDescription = educationmodule.EducationModuleDescription;

            educationModule1.EducationModuleID        = educationmodule.EducationModuleID;
            educationModule1.EducationModuleName      = educationmodule.EducationModuleName;
            educationModule1.EducationModuleTypeFile  = educationmodule.EducationModuleTypeFile;
            educationModule1.EducationModulePosition  = educationmodule.EducationModulePosition;
            educationModule1.EducationModuleTime      = educationmodule.EducationModuleTime;
            educationModule1.EducationModulePDFName   = educationmodule.EducationModulePDFName;
            educationModule1.EducationModulePPTName   = educationmodule.EducationModulePPTName;
            educationModule1.EducationModuleVideoName = educationmodule.EducationModuleVideoName;
            educationModule1.flag = educationmodule.flag;
            Education edu = new Education();

            edu = Mapper.Map <Education>(_educationService.GetEducationByID(educationModule1.EducationID));
            educationModule1.ReadyToDisplay = edu.ReadyToDisplay;
            return(Json(educationModule1, GlobalConst.Message.text_html));
        }
コード例 #3
0
        public ActionResult Add(string EducationTypeID, string CredentialID)
        {
            bool checkCourseValdation = _shoppingeducationService.checkCoursePurchaseValidationByUserID(HCRGUser.UID, EducationID);

            if (!checkCourseValdation)
            {
                bool check = _shoppingeducationService.checkEducationinShoppingCart(HCRGUser.UID, EducationID, GlobalConst.CartType.Course);
                if (!check)
                {
                    EducationShoppingTemp            educationShoppingTemp            = new EducationShoppingTemp();
                    EducationTypesAvailableViewModel educationTypesAvailableViewModel = new EducationTypesAvailableViewModel();
                    educationTypesAvailableViewModel.EducationTypesAvailableResults = Mapper.Map <IEnumerable <EducationTypesAvailable> >(_educationService.GetEducationTypeByEducationID(EducationID));
                    HCRGUniversityApp.Domain.Models.EducationShoppingCartModel.EducationShoppingCart myList = new HCRGUniversityApp.Domain.Models.EducationShoppingCartModel.EducationShoppingCart();

                    var _res = _userService.getUserAllAccessPassByUserID(HCRGUser.UID);
                    if (_res != null)
                    {
                        if (_res.AllAccessEndDate.Value < DateTime.Now)
                        {
                            User _user1 = new User();
                            _user1 = Mapper.Map <User>(_userService.GetUserByID(HCRGUser.UID));
                            _user1.IsAllAccessPricing  = null;
                            _user1.UserAllAccessPassID = null;
                            _userService.UpdateUser(Mapper.Map <HCRGUniversityApp.NEPService.UserService.User>(_user1));
                        }
                    }


                    HCRGUniversityApp.Domain.Models.UserModel.User _user = new Domain.Models.UserModel.User();
                    _user = Mapper.Map <HCRGUniversityApp.Domain.Models.UserModel.User>(_userService.GetUserByID(HCRGUser.UID));


                    //if (_user.IsCoursePreview.Value != null)
                    if (_user.IsCoursePreview == true)
                    {
                        int cnt = 0;

                        foreach (HCRGUniversityApp.Domain.Models.EducationModel.EducationTypesAvailable viewmodel in educationTypesAvailableViewModel.EducationTypesAvailableResults)
                        {
                            if (_educationService.GetEducationByID(EducationID).IsCoursePreview != null)
                            {
                                cnt = 1;
                                myList.EduorProID          = EducationID;
                                myList.EducationTypeID     = viewmodel.EducationTypeID;
                                myList.Price               = viewmodel.Price;
                                myList.UserID              = Convert.ToInt32(HCRGUser.UID);
                                myList.Quantity            = 1;
                                myList.Date                = DateTime.Now;
                                myList.ShippingPaymentID   = null;
                                myList.UserAllAccessPassID = _user.UserAllAccessPassID;
                                myList.TaxPercentage       = GlobalConst.ConstantChar.CourserTaxPercentage;
                                if (CredentialID != null)
                                {
                                    myList.CredentialID = int.Parse(CredentialID);
                                }
                            }
                            else
                            {
                                cnt = 0;
                            }
                        }

                        if (cnt == 1)
                        {
                            _shoppingeducationService.AddEducationShoppingOrderAllAccessPass(Mapper.Map <HCRGUniversityApp.NEPService.ShoppingEducationService.EducationShoppingCart>(myList));
                            return(Json(GlobalConst.Message.GoToMyEducation, GlobalConst.Message.text_html));
                        }
                    }



                    Domain.Models.UserModel.UserAllAccessPass _userAllAccessPass = new Domain.Models.UserModel.UserAllAccessPass();

                    if (_user.UserAllAccessPassID.HasValue)
                    {
                        _userAllAccessPass = Mapper.Map <HCRGUniversityApp.Domain.Models.UserModel.UserAllAccessPass>(_userService.getUserAllAccessPassByID(_user.UserAllAccessPassID.Value));

                        if (_userAllAccessPass.AllAccessEndDate.Value < System.DateTime.Now)
                        {
                            _user.IsAllAccessPricing  = null;
                            _user.UserAllAccessPassID = null;
                            _userService.UpdateUser(Mapper.Map <HCRGUniversityApp.NEPService.UserService.User>(_user));
                        }
                    }

                    // when courser price is zero ie coruse is free of cost.
                    foreach (HCRGUniversityApp.Domain.Models.EducationModel.EducationTypesAvailable viewmodel in educationTypesAvailableViewModel.EducationTypesAvailableResults)
                    {
                        if (viewmodel.Price == 0)
                        {
                            myList.EduorProID          = EducationID;
                            myList.EducationTypeID     = viewmodel.EducationTypeID;
                            myList.Price               = viewmodel.Price;
                            myList.UserID              = Convert.ToInt32(HCRGUser.UID);
                            myList.Quantity            = 1;
                            myList.Date                = DateTime.Now;
                            myList.ShippingPaymentID   = null;
                            myList.UserAllAccessPassID = null;
                            myList.TaxPercentage       = GlobalConst.ConstantChar.CourserTaxPercentage;
                            if (CredentialID != null)
                            {
                                myList.CredentialID = int.Parse(CredentialID);
                            }
                            _shoppingeducationService.AddEducationShoppingOrderAllAccessPass(Mapper.Map <HCRGUniversityApp.NEPService.ShoppingEducationService.EducationShoppingCart>(myList));
                            return(Json(GlobalConst.Message.GoToMyEducation, GlobalConst.Message.text_html));
                        }
                    }


                    if (!_user.UserAllAccessPassID.HasValue)
                    {
                        foreach (HCRGUniversityApp.Domain.Models.EducationModel.EducationTypesAvailable viewmodel in educationTypesAvailableViewModel.EducationTypesAvailableResults)
                        {
                            educationShoppingTemp.EducationID     = EducationID;
                            educationShoppingTemp.EducationTypeID = viewmodel.EducationTypeID;
                            educationShoppingTemp.Amount          = viewmodel.Price;
                            educationShoppingTemp.UserID          = Convert.ToInt32(HCRGUser.UID);
                            educationShoppingTemp.Quantity        = 1;
                            educationShoppingTemp.Date            = DateTime.Now;
                            educationShoppingTemp.TaxPercentage   = GlobalConst.ConstantChar.CourserTaxPercentage;
                            if (CredentialID != null)
                            {
                                educationShoppingTemp.CredentialID = int.Parse(CredentialID);
                            }
                        }
                        var EducationShoppingTempModelid = _shoppingeducationService.AddEducationToShoppingCart(Mapper.Map <HCRGUniversityApp.NEPService.ShoppingEducationService.EducationShoppingTemp>(educationShoppingTemp));
                        return(Json(educationShoppingTemp, GlobalConst.Message.text_html));
                    }
                    else
                    {
                        foreach (HCRGUniversityApp.Domain.Models.EducationModel.EducationTypesAvailable viewmodel in educationTypesAvailableViewModel.EducationTypesAvailableResults)
                        {
                            myList.EduorProID          = EducationID;
                            myList.EducationTypeID     = viewmodel.EducationTypeID;
                            myList.Price               = viewmodel.Price;
                            myList.UserID              = Convert.ToInt32(HCRGUser.UID);
                            myList.Quantity            = 1;
                            myList.Date                = DateTime.Now;
                            myList.ShippingPaymentID   = _userAllAccessPass.ShippingPaymentID.Value;
                            myList.UserAllAccessPassID = _user.UserAllAccessPassID;
                            myList.TaxPercentage       = GlobalConst.ConstantChar.CourserTaxPercentage;
                            if (CredentialID != null)
                            {
                                myList.CredentialID = int.Parse(CredentialID);
                            }
                        }

                        var _rest = _userService.GetUserSubscriptionDetails();

                        if (myList.Price >= _rest.AllAccessParametersCoursePriceStart && myList.Price <= _rest.AllAccessParametersCoursePriceEnd)
                        {
                            _shoppingeducationService.AddEducationShoppingOrderAllAccessPass(Mapper.Map <HCRGUniversityApp.NEPService.ShoppingEducationService.EducationShoppingCart>(myList));
                            return(Json(GlobalConst.Message.GoToMyEducation, GlobalConst.Message.text_html));
                        }
                        else
                        {
                            foreach (HCRGUniversityApp.Domain.Models.EducationModel.EducationTypesAvailable viewmodel in educationTypesAvailableViewModel.EducationTypesAvailableResults)
                            {
                                educationShoppingTemp.EducationID         = EducationID;
                                educationShoppingTemp.EducationTypeID     = viewmodel.EducationTypeID;
                                educationShoppingTemp.Amount              = viewmodel.Price;
                                educationShoppingTemp.UserID              = Convert.ToInt32(HCRGUser.UID);
                                educationShoppingTemp.Quantity            = 1;
                                educationShoppingTemp.Date                = DateTime.Now;
                                educationShoppingTemp.UserAllAccessPassID = null;
                                myList.TaxPercentage = GlobalConst.ConstantChar.CourserTaxPercentage;
                                if (CredentialID != null)
                                {
                                    educationShoppingTemp.CredentialID = int.Parse(CredentialID);
                                }
                            }
                            var EducationShoppingTempModelid = _shoppingeducationService.AddEducationToShoppingCart(Mapper.Map <HCRGUniversityApp.NEPService.ShoppingEducationService.EducationShoppingTemp>(educationShoppingTemp));
                            return(Json(educationShoppingTemp, GlobalConst.Message.text_html));
                        }
                    }
                }
                else
                {
                    return(Json(GlobalConst.Message.AlreadyAddToCart, GlobalConst.Message.text_html));
                }
            }
            else
            {
                return(Json(GlobalConst.Message.CourseAlreadyInProgress, GlobalConst.Message.text_html));
            }
        }