public ActionResult Create(GlobalSetting instance)
 {
     ActionResult ar = VerifyIfProjectSelected("PRJNAME");
     if (null != ar) return ar;
     ViewBag.Title = "Create Global Setting";
     string requestKey = Request.Form.Keys[Request.Form.Keys.Count - 1] as string;
     if (requestKey.Contains(".")) requestKey = requestKey.Substring(0, requestKey.IndexOf("."));
     if (requestKey == "save")
     {
         if (ModelState.IsValid)
         {
             string log = "";
             this.GlobalSettingService.CurrentProjectId = (int)Session["PID"];
             bool isSuccess = this.GlobalSettingService.AddGlobalSetting(instance, out log);
             if (isSuccess)
             {
                 Session["Log_g"] = null;
                 Session["HasQueried_g"] = null;
                 return RedirectToAction("Index");
             }
             ViewBag.Log = log;
         }
         return View("Create", new GlobalSetting());
     }
     Session["Log_g"] = null;
     return RedirectToAction("Index");
 }
 public bool AddGlobalSetting(GlobalSetting globalSetting, out string log)
 {
     Guard.ArgumentNotNull(globalSetting, "globalSettingObject");
     int pid = (this.CurrentProjectId > 0) ? this.CurrentProjectId : 1;
     globalSetting.ProjectId = pid;
     return this.GlobalSettingRepository.AddGlobalSetting(globalSetting, out log);
 }
 private ActionResult Save(GlobalSetting updatedItem, int pageIndex)
 {
     int gsid = updatedItem.Id;
     if (null != updatedItem.Name)
     {
         this.GlobalSettingService.CurrentProjectId = (int)Session["PID"];
         string log="";
         GlobalSetting instance = new GlobalSetting { Id = gsid, Name = updatedItem.Name, Value = updatedItem.Value };
         bool isSuccess = this.GlobalSettingService.UpdateGlobalSetting(instance, out log);
         if (isSuccess)
         {
             Session["Log_g"] = null;
             Session["UpdatedId_g"] = null;
             return RedirectToAction("Index", new { pageIndex = pageIndex });
         }
         Session["Log_g"] = log;
         return Edit(gsid, pageIndex);
     }
     Session["Log_g"] = "Name Required!";
     return Edit(gsid, pageIndex);
 }