Exemplo n.º 1
0
        public JsonResult SaveDisplayOrder(Dictionary <string, string> stepsDictionary)
        {
            string message    = "Sucess! Reorder successfully";
            bool   isModified = true;

            try
            {
                if (stepsDictionary != null)
                {
                    ManageVariableModel model = new ManageVariableModel();
                    model.UpdateOrder(stepsDictionary);
                    message = "Sucess! Reorder successful";
                    var cacheProvider = CacheFactory.Get();
                    cacheProvider.ClearCache(CacheKeys.CACHE_VARIABLES);
                }
                else
                {
                    message = "Failure! Unable to Reorder";
                }
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog("VatiableController", "ManageVariablesOrder", ex, "");
                message    = "Failure! Unable to Reorder";
                isModified = false;
            }
            return(this.Json(new { message = message, isModified = isModified }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult AddEditVariable(Guid?id)
        {
            ManageVariableModel variableModel = new ManageVariableModel();

            if (id.HasValue && id.Value != Guid.Empty)
            {
                Guid langid = TSM.Model.TSMContext.CurrentLanguageID;
                variableModel.GetVariable(id.Value, langid);
            }
            if (variableModel.ManageChoices == null)
            {
                // variableModel.ManageChoices = new List<string>();
                variableModel.ManageChoices = new List <SelectListItem>();
            }
            return(View("~/Views/Admin/variable/ManageVariable.cshtml", variableModel));
        }
Exemplo n.º 3
0
        public ActionResult ManageVariablesOrder()
        {
            ManageVariableModel model = new ManageVariableModel();

            model.PopulateWithOrder();

            //for Ajax Specific Request
            if (Request.IsAjaxRequest())
            {
                return(View("~/Views/Shared/PartialViews/Admin/Variable/_ManageVariableOrder.cshtml", model));
            }
            else
            {
                return(View("~/Views/Shared/PartialViews/Admin/Variable/_ManageVariableOrder.cshtml", model));
            }
        }
Exemplo n.º 4
0
        public ActionResult AddEditVariable(ManageVariableModel variableModel, FormCollection form)
        {
            try
            {
                bool exist = false;
                if (variableModel.ID == Guid.Empty)
                {
                    exist = variableModel.CheckVariable();
                }
                if (exist == false)
                {
                    Variable variable      = variableModel.Save();
                    var      cacheProvider = CacheFactory.Get();
                    cacheProvider.ClearCache(CacheKeys.CACHE_VARIABLES);
                    cacheProvider.ClearCache(CacheKeys.CACHE_DOCUMENT_TYPE);

                    if (variableModel.ID != Guid.Empty)
                    {
                        TempData["Success"] = "true";
                        return(Redirect(Url.Action("Manage-Variable", "Admin") + "?id=" + variable.ID));
                    }
                    else
                    {
                        TempData["Success"] = "true";
                        return(Redirect(Url.Action("Manage-Variable", "Admin") + "?id=" + variable.ID));
                    }
                }
                else
                {
                    TempData["Exist"]   = "true";
                    TempData["Success"] = "false";
                }
            }
            catch (Exception ex)
            {
                //TempData["Failure"] = "true";
                TempData["Success"] = "false";
                TempData["Exist"]   = null;

                ErrorLog.WriteLog("VariableController", "Manage-Variable", ex, "");
            }
            return(View("~/Views/Admin/variable/ManageVariable.cshtml", variableModel));
        }
Exemplo n.º 5
0
        public JsonResult DeleteVariable(Guid id)
        {
            string message   = "Sucess! Deleted successfully";
            bool   isDeleted = true;

            try
            {
                ManageVariableModel model = new ManageVariableModel();
                model.Delete(id);
                var cacheProvider = CacheFactory.Get();
                cacheProvider.ClearCache(CacheKeys.CACHE_VARIABLES);
            }

            catch (Exception ex)
            {
                ErrorLog.WriteLog("VatiableController", "delete-variable", ex, id.ToString());
                message   = "Failure! Unable to delete";
                isDeleted = false;
            }
            return(this.Json(new { message = message, isDeleted = isDeleted }, JsonRequestBehavior.AllowGet));
        }