Beispiel #1
0
        public void UpdateApplicationVariable(CultureInformationVM cultureInfoVM)
        {
            CultureInformationModel cultureModel = new CultureInformationModel();

            cultureModel = cultureBusiness.GetCultureDetails(cultureInfoVM.CultureInformationId.Decrypt());
            ErucaCRM.Utility.CultureInformationManagement.SetCultureObject(cultureModel.CultureName, cultureModel.LabelsXML, cultureModel.IsActive);
        }
Beispiel #2
0
        public ActionResult EditApplicationPage(string id_encrypted, string pageId_encrypted, string returnId = "", string redirectedFrom = "")
        {
            CultureInformationVM    cultureinfoVM    = new CultureInformationVM();
            CultureInformationModel cultureInfoModel = cultureBusiness.GetCultureDetails(Convert.ToInt32(id_encrypted));

            Mapper.Map(cultureInfoModel, cultureinfoVM);
            if (string.IsNullOrEmpty(cultureinfoVM.ExcelFilePath))
            {
                TempData["LanguageAdded"] = false;
                return(RedirectToAction("ManageLanguage", new { id_encrypted = Convert.ToInt32(id_encrypted).Encrypt() }));
            }
            else
            {
                ApplicationPageVM    pageVM    = new ApplicationPageVM();
                ApplicationPageModel pagemodel = new ApplicationPageModel();
                pagemodel = applicationPageBusiness.GetPageDetail(Convert.ToInt32(id_encrypted), Convert.ToInt32(pageId_encrypted));
                Mapper.Map(pagemodel, pageVM);
                ViewBag.Language             = cultureinfoVM.Language;
                ViewBag.CultureInformationId = cultureinfoVM.CultureInformationId;
                ViewBag.ApplicationPages     = GetPublicPages();
                ViewBag.ReturnPageId         = returnId;
                ViewBag.redirectedFrom       = redirectedFrom;
                return(View(pageVM));
            }
        }
Beispiel #3
0
        public ActionResult AddCustomPage(ApplicationPageVM pageVm)
        {
            ApplicationPageModel pageModel = new ApplicationPageModel();

            if (ModelState.IsValid == true)
            {
                Mapper.Map(pageVm, pageModel);
                applicationPageBusiness.AddCustomPage(pageModel);
                return(RedirectToAction("EditApplicationPage", new { id_encrypted = pageVm.ContentApplicationPage.CultureInformationId, pageId_encrypted = pageVm.ApplicationPageId }));
            }
            else
            {
                ApplicationPageVM        pageVM    = new ApplicationPageVM();
                ContentApplicationPageVM contentVM = new ContentApplicationPageVM();
                contentVM.CultureInformationId = pageVm.ContentApplicationPage.CultureInformationId;
                pageVM.ApplicationPageId       = pageVm.ApplicationPageId;
                pageVM.ContentApplicationPage  = contentVM;
                CultureInformationVM    cultureinfoVM    = new CultureInformationVM();
                CultureInformationModel cultureInfoModel = cultureBusiness.GetCultureDetails(pageVm.ContentApplicationPage.CultureInformationId.Decrypt());
                Mapper.Map(cultureInfoModel, cultureinfoVM);
                ViewBag.Language         = cultureinfoVM.Language;
                ViewBag.ApplicationPages = GetPublicPages();
                return(View(pageVm));
            }
        }
Beispiel #4
0
        public FileResult DownloadFile(string id_encrypted)
        {
            CultureInformationModel model  = cultureBusiness.GetCultureDetails(Convert.ToInt32(id_encrypted));
            CultureInformationVM    vmodel = new CultureInformationVM();

            Mapper.Map(model, vmodel);
            string filePath       = string.Empty;
            string returnfileName = string.Empty;

            if (!String.IsNullOrEmpty(vmodel.ExcelFilePath))
            {
                filePath       = Server.MapPath(@"~" + ReadConfiguration.CultureExcelFilePath + model.ExcelFilePath);
                returnfileName = vmodel.CultureDescription + Constants.EXCEL_FILE_EXTENSION;
            }
            else
            {
                model = cultureBusiness.GetDefaultCultureDetail();
                Mapper.Map(model, vmodel);
                filePath       = Server.MapPath(@"~" + ReadConfiguration.CultureExcelFilePath + vmodel.ExcelFilePath);
                returnfileName = vmodel.CultureDescription + Constants.EXCEL_FILE_EXTENSION;
            }

            if (System.IO.File.Exists(filePath))
            {
                return(File(filePath, "application/xlsx", returnfileName));
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        public CultureInformationModel GetCultureDetails(int CultureInformationId)
        {
            CultureInformationModel cultureInfoModelObj   = new CultureInformationModel();
            CultureInformation      cultureInformationObj = cultureInformationRepository.SingleOrDefault(r => r.CultureInformationId == CultureInformationId);

            AutoMapper.Mapper.Map(cultureInformationObj, cultureInfoModelObj);
            return(cultureInfoModelObj);
        }
Beispiel #6
0
        public void EditDocument(CultureInformationModel cultureInfomodel)
        {
            CultureInformation cultureInformationObj = cultureInformationRepository.SingleOrDefault(r => r.CultureInformationId == cultureInfomodel.CultureInformationId);

            cultureInformationObj.LabelsXML     = cultureInfomodel.LabelsXML;
            cultureInformationObj.ExcelFilePath = cultureInfomodel.ExcelFilePath;
            cultureInformationRepository.Update(cultureInformationObj);
        }
Beispiel #7
0
        public CultureInformationModel GetDefaultCultureDetail()
        {
            CultureInformation      cultureInformation      = cultureInformationRepository.SingleOrDefault(r => r.IsDefault == true);
            CultureInformationModel cultureInformationModel = new CultureInformationModel();

            AutoMapper.Mapper.Map(cultureInformation, cultureInformationModel);
            return(cultureInformationModel);
        }
Beispiel #8
0
        public ActionResult ManageLanguage(string id_encrypted)
        {
            CultureInformationVM    cultureinfoVM    = new CultureInformationVM();
            CultureInformationModel cultureInfoModel = cultureBusiness.GetCultureDetails(Convert.ToInt32(id_encrypted));

            Mapper.Map(cultureInfoModel, cultureinfoVM);
            ViewBag.Language             = cultureinfoVM.Language;
            ViewBag.CultureInformationId = cultureinfoVM.CultureInformationId;
            ViewBag.ApplicationPages     = GetPublicPages();
            return(View(cultureinfoVM));
        }
Beispiel #9
0
        public ActionResult SaveLanguage(CultureInformationVM cultureInformationVM)
        {
            Response response = new Response();

            response.Status = "Success";
            CultureInformationModel cultureModel = new CultureInformationModel();

            Mapper.Map(cultureInformationVM, cultureModel);
            cultureBusiness.SaveLanguage(cultureModel);
            UpdateApplicationVariable(cultureInformationVM);
            return(Json(response));
        }
Beispiel #10
0
        public ActionResult UpdateCultureDocument(CultureInformationVM cultureVM)
        {
            string                  FileName         = string.Empty;
            DataSet                 dsObject         = new DataSet();
            HttpPostedFileBase      file             = Request.Files[0];
            CultureInformationModel cultureInfoModel = new CultureInformationModel();
            string                  fileExtension    = Path.GetExtension(file.FileName);

            if (file.ContentLength > 0)
            {
                if ((fileExtension == ".xlsx" || fileExtension == ".xls"))
                {
                    if (!String.IsNullOrEmpty(cultureVM.ExcelFilePath))
                    {
                        if (cultureVM.CultureDescription.ToLower() != Path.GetFileNameWithoutExtension(file.FileName).ToLower())
                        {
                            return(Json(new { success = false, response = "You are saving a file which is for different culture." }));
                        }
                    }
                    try
                    {
                        string CultureDocPath = ReadConfiguration.CultureExcelFilePath;
                        string path           = Path.Combine(Server.MapPath(@"~" + CultureDocPath), cultureVM.CultureDescription + fileExtension);
                        CommonFunctions.UploadFile(file, path);
                        dsObject = CommonFunctions.ImportExceltoDataset(path);
                        string XmlContent = cultureBusiness.ProcessCultureSpecificData(dsObject, cultureVM.CultureName);
                        //Code for saving the xml for a selected culture  to the database
                        cultureVM.LabelsXML     = XmlContent;
                        cultureVM.ExcelFilePath = cultureVM.CultureDescription + fileExtension;
                        Mapper.Map(cultureVM, cultureInfoModel);
                        cultureBusiness.EditDocument(cultureInfoModel);
                        if (cultureVM.IsActive == true)
                        {
                            UpdateApplicationVariable(cultureVM);
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write(ex);
                    }
                }
                else
                {
                    return(Json(new { success = false, response = "File is not in correct forrect.Please select a Excel spread sheet." }));
                }
            }
            else
            {
                return(Json(new { success = false, response = "No file selected.Please select a Excel spread sheet." }));
            }
            return(Json(new { success = true, response = "Documentment uploaded  successfully" }));
        }
Beispiel #11
0
        public ActionResult AddCustomPage(string cultureInformationId_encrypted, string applicationPageId_encrypted, string redirectedFrom = "")
        {
            ApplicationPageVM        pageVM    = new ApplicationPageVM();
            ContentApplicationPageVM contentVM = new ContentApplicationPageVM();

            contentVM.CultureInformationId = Convert.ToInt32(cultureInformationId_encrypted).Encrypt();
            pageVM.ApplicationPageId       = Convert.ToInt32(applicationPageId_encrypted).Encrypt();
            pageVM.ContentApplicationPage  = contentVM;
            CultureInformationVM    cultureinfoVM    = new CultureInformationVM();
            CultureInformationModel cultureInfoModel = cultureBusiness.GetCultureDetails(Convert.ToInt32(cultureInformationId_encrypted));

            Mapper.Map(cultureInfoModel, cultureinfoVM);
            ViewBag.Language         = cultureinfoVM.Language;
            ViewBag.ApplicationPages = GetPublicPages();
            ViewBag.redirectedFrom   = redirectedFrom;
            return(View(pageVM));
        }
Beispiel #12
0
        public void SaveLanguage(CultureInformationModel cultureModel)
        {
            CultureInformation cultureInformation = cultureInformationRepository.SingleOrDefault(r => r.CultureInformationId == cultureModel.CultureInformationId);

            cultureInformation.IsActive = cultureModel.IsActive;
            cultureInformationRepository.Update(cultureInformation);
            List <ContentApplicationPage> contentPageList = new List <ContentApplicationPage>();
            List <ApplicationPage>        applicationPage = new List <ApplicationPage>();

            applicationPage = appliationPageRepository.GetAll(r => r.IsApplicationPage == true).ToList();
            foreach (var v in applicationPage)
            {
                ContentApplicationPage contentpage = new ContentApplicationPage();
                contentpage = contentApplicationPageRepository.SingleOrDefault(r => r.ApplicationPageId == v.ApplicationPageId && r.CultureInformationId == cultureModel.CultureInformationId);
                if (contentpage == null)
                {
                    contentpage = new ContentApplicationPage();
                    contentpage.ApplicationPageId    = v.ApplicationPageId;
                    contentpage.CultureInformationId = cultureModel.CultureInformationId;
                    contentpage.UseDefaultContent    = true;
                    contentApplicationPageRepository.Insert(contentpage);
                }
            }
        }