示例#1
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));
            }
        }
示例#2
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);
        }
示例#3
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));
            }
        }
示例#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);
            }
        }
示例#5
0
        public ActionResult UpdateDefaultLanguage(string id_encrypted)
        {
            CultureInformationVM cultureinfoVM = new CultureInformationVM();

            cultureBusiness.UpdateDefaultLanguage(Convert.ToInt32(id_encrypted));
            Response response = new Response();

            response.Status = "Success";
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
示例#6
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));
        }
示例#7
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));
        }
示例#8
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" }));
        }
示例#9
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));
        }