public ActionResult BatchDelete(string pageId, string formMode, string viewTitle, string gridString, string isCascadeDelete) { try { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); AssetsRepository arep = new AssetsRepository(); DataUpdate dbUpdate = new DataUpdate(); try { dbUpdate.BeginTransaction(); arep.DbUpdate = dbUpdate; arep.BatchDelete(sysUser, gridString, viewTitle, isCascadeDelete); dbUpdate.Commit(); return(Content("1")); } catch (Exception) { dbUpdate.Rollback(); return(Content(AppMember.AppText["DeleteExistRefrence"])); } finally { dbUpdate.Close(); } } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AssetsManageController.BatchDelete post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html")); } }
public ActionResult Select(string pageId, string showCheckbox, string selectIds) { try { TreeSelectModel model = new TreeSelectModel(); model.PageId = pageId; model.TreeId = TreeId.DepartmentTreeId; UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataTable list = new DataTable(); if (HttpContext.Cache["DepartmentTree"] == null) { DepartmentRepository drep = new DepartmentRepository(); list = drep.GetDepartmentTree(sysUser); HttpContext.Cache.Add("DepartmentTree", list, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero, CacheItemPriority.High, null); } else { list = (DataTable)HttpContext.Cache["DepartmentTree"]; } model.DataTree = list; if (showCheckbox == "true") { model.ShowCheckBox = true; } model.SelectId = selectIds; model.SearchUrl = Url.Action("SearchTree", "Department", new { Area = "BusinessCommon" }); return(PartialView("TreeSelect", model)); } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "DepartmentController.Select", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html")); } }
public virtual JsonResult DropList(string filterExpression, string pySearch) { try { ClearClientPageCache(Response); IEntry rep = EntryRepository; CacheInit.RefreshCache(HttpContext, rep, ControllerName + "DropList", DateTime.Now.AddMinutes(CacheExpiryMinute), CachePriority, CacheCreateType.IfNoThenGenerated); DataTable source = (DataTable)HttpContext.Cache[ControllerName + "DropList"]; filterExpression = DFT.HandleExpress(filterExpression); List <DropListSource> dropList = rep.DropList(source, filterExpression); if (DataConvert.ToString(pySearch) != "") { List <DropListSource> filterDrop = new List <DropListSource>(); foreach (var obj in dropList) { string pyf = PinYin.GetFirstPinyin(DataConvert.ToString(obj.Text)).ToUpper(); string[] pyfs = pyf.Split(','); foreach (string py in pyfs) { if (py.StartsWith(pySearch.ToUpper()) && !filterDrop.Contains(obj)) { filterDrop.Add(obj); } } } return(DropListJson(filterDrop)); } return(DropListJson(dropList)); } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "MasterController.DropList", ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(new JsonResult()); } }
protected override AdvanceGridLayout EntryGridLayout(string formMode) { string layourName = ""; if (DataConvert.ToString(formMode) == "") { formMode = Request.QueryString["formMode"]; } switch (formMode) { case "AssetsClass": layourName = "AssetsClassChangeReport"; break; case "Department": layourName = "AssetsDepartmentChangeReport"; break; case "StoreSite": layourName = "AssetsStoreSiteChangeReport"; break; } if (HttpContext.Cache[layourName + "GridLayout"] == null) { string areaName = RouteData.DataTokens["area"].ToString(); CacheInit.CreateAdvanceGridLayoutCache(HttpContext, areaName, layourName); } return((AdvanceGridLayout)HttpContext.Cache[layourName + "GridLayout"]); }
public ActionResult ReplaceFavorit(string tableName, string pkValue) { try { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataUpdate dbUpdate = new DataUpdate(); try { dbUpdate.BeginTransaction(); CacheRepository drep = new CacheRepository(); drep.DbUpdate = dbUpdate; drep.ReplaceFavorit(pkValue, sysUser.UserId, tableName); dbUpdate.Commit(); } catch (Exception ex) { dbUpdate.Rollback(); throw new Exception(ex.Message); } finally { dbUpdate.Close(); } return(Content("0", "text/html")); } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "MasterController.ReplaceFavorit", ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(Content(ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html")); } }
public ActionResult Entry(EntryModel model) { try { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); string hidenTreeId = model.TreeId + model.PageId + AppMember.HideString; try { if (model.RadioValue == "group") { model.Repository.SaveForGroup(model.GroupNo, DataConvert.ToString(Request.Form[hidenTreeId]), sysUser); } else if (model.RadioValue == "user") { model.Repository.SaveForUser(model.UserNo, DataConvert.ToString(Request.Form[hidenTreeId]), sysUser); } model.HasError = "false"; model.IsUser = false; model.GroupNo = ""; model.UserNo = ""; } catch (Exception ex) { model.Message = ex.Message; model.HasError = "true"; } model.AuthorityTree = model.Repository.GetAuthorityTree("", false); return(View(model)); } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AuthorityController.Entry post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html")); } }
public ActionResult Entry(EntryModel model) { try { if (CheckModelIsValid(model)) { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataUpdate dbUpdate = new DataUpdate(); try { dbUpdate.BeginTransaction(); PasswordModifiyRepository rep = new PasswordModifiyRepository(); rep.DbUpdate = dbUpdate; rep.ModifiyPassword(model, sysUser.UserId); dbUpdate.Commit(); } catch (Exception ex) { dbUpdate.Rollback(); throw new Exception(ex.Message); } finally { dbUpdate.Close(); } } return(View(model)); } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "PasswordModifiyController.Entry post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(new JsonResult()); } }
protected int Update(BarcodePrintRepository rep, Entry2Model model, string viewTitle) { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataUpdate dbUpdate = new DataUpdate(); try { dbUpdate.BeginTransaction(); rep.DbUpdate = dbUpdate; rep.Update(model, sysUser, viewTitle); dbUpdate.Commit(); return(1); } catch (Exception ex) { dbUpdate.Rollback(); model.Message = ex.Message; model.HasError = "true"; return(0); } finally { dbUpdate.Close(); } }
public JsonResult Menu() { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); AuthorityRepository rep = new AuthorityRepository(); DataTable dt = rep.GetUserMenu(sysUser.UserId); for (int i = 0; i < dt.Rows.Count; i++) { string urls = DataConvert.ToString(dt.Rows[i]["url"]); if (urls != "") { string[] url = urls.Split('/'); string urlmenu = Url.Action(url[3], url[2], new { Area = url[1] }); if (url.Length > 4) { urlmenu = urlmenu + url[4]; } dt.Rows[i]["url"] = urlmenu; } } var rows = DataTable2Object.Data(dt); //var rows = new object[4]; //rows[0] = new { id = 1, cell = new[] { "1", "周报", "", "0", "1", "10", "false", "false" } }; //rows[1] = new { id = 2, cell = new[] { "2", "用户组", "/BusinessCommon/Group/List", "1", "2", "3", "true", "true" } }; //rows[2] = new { id = 3, cell = new[] { "6", "系统", "", "0", "11", "18", "false", "false" } }; //rows[3] = new { id = 4, cell = new[] { "7", "用户", "/BusinessCommon/User/List", "1", "12", "13", "true", "true" } }; var result = new JsonResult(); result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; result.Data = new { page = 1, records = rows.Length, rows = rows, total = 1 }; return(result); }
public ActionResult Entry(EntryModel model) { if (ModelState.IsValid) { string gridHidStr = model.GridId + model.PageId + AppMember.HideString; List <Test> gridData = JsonHelper.JSONStringToList <Test>(Request.Form[gridHidStr]); string delPkHidStr = model.GridId + model.PageId + AppMember.DeletePK; string delPks = Request.Form[delPkHidStr]; UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataUpdate dbUpdate = new DataUpdate(); dbUpdate.BeginTransaction(); TestRepository rep = new TestRepository(dbUpdate); Dictionary <string, object> objs = new Dictionary <string, object>(); objs.Add("gridData", gridData); objs.Add("deletePks", delPks); try { rep.Save(objs, sysUser, model.ViewTitle); dbUpdate.Commit(); } catch (Exception ex) { dbUpdate.Rollback(); throw new Exception(ex.Message); } model.HasError = "false"; } else { model.HasError = "true"; } model.GridLayout = GridLayout(); return(View(model)); }
protected GridLayout UpEntryGridLayout() { if (HttpContext.Cache["MergeUpEntryGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", "MergeUpEntry"); } return((GridLayout)HttpContext.Cache["MergeUpEntryGridLayout"]); }
protected GridLayout EntryGridLayout() { if (HttpContext.Cache["DataImportGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "BusinessCommon", "DataImport"); } return((GridLayout)HttpContext.Cache["DataImportGridLayout"]); }
protected GridLayout EntryGridLayout() { if (HttpContext.Cache["DepreciationEntryGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", "DepreciationEntry"); } return((GridLayout)HttpContext.Cache["DepreciationEntryGridLayout"]); }
protected GridLayout EntryGridLayout() { if (HttpContext.Cache["MainIndex_ApproveGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "BusinessCommon", "MainIndex_Approve"); } return((GridLayout)HttpContext.Cache["MainIndex_ApproveGridLayout"]); }
protected Dictionary <string, GridInfo> GridLayout() { if (HttpContext.Cache["TestGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "BusinessCommon", "Test"); } return((Dictionary <string, GridInfo>)HttpContext.Cache["TestGridLayout"]); }
protected GridLayout StoreSiteGridLayout() { if (HttpContext.Cache["StoreSiteGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "BasicData", "StoreSite"); } return((GridLayout)HttpContext.Cache["StoreSiteGridLayout"]); }
protected GridLayout ApproveGridLayout() { if (HttpContext.Cache["ApproveGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "Common", "Approve"); } return((GridLayout)HttpContext.Cache["ApproveGridLayout"]); }
protected override Dictionary <string, GridInfo> GridLayout() { if (HttpContext.Cache["AssetsApproveGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsApprove", "/layout"); } return((Dictionary <string, GridInfo>)HttpContext.Cache["AssetsApproveGridLayout"]); }
public ActionResult Entry(EntryModel model) { AutoPeriodRepository rep = new AutoPeriodRepository(); UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); rep.Update(sysUser, model); return(View(model)); }
public JsonResult DepartmentDropList(string currentId) { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DepartmentRepository rep = new DepartmentRepository(); DataTable source = rep.GetDropListSource(sysUser.UserId, currentId); List <DropListSource> dropList = rep.DropList(source, ""); return(DropListJson(dropList)); }
protected virtual AdvanceGridLayout EntryGridLayout(string formMode) { if (HttpContext.Cache[ControllerName + "GridLayout"] == null) { string areaName = RouteData.DataTokens["area"].ToString(); CacheInit.CreateAdvanceGridLayoutCache(HttpContext, areaName, ControllerName); } return((AdvanceGridLayout)HttpContext.Cache[ControllerName + "GridLayout"]); }
protected GridLayout GridLayout() { if (HttpContext.Cache[ControllerName + "GridLayout"] == null) { string areaName = RouteData.DataTokens["area"].ToString(); CacheInit.CreateGridLayoutCache(HttpContext, areaName, ControllerName); } return((GridLayout)HttpContext.Cache[ControllerName + "GridLayout"]); }
protected override Dictionary <string, GridInfo> EntryGridLayout() { if (HttpContext.Cache[ControllerName + "GridLayout"] == null) { string areaName = RouteData.DataTokens["area"].ToString(); CacheInit.CreateGridLayoutCache(HttpContext, areaName, ControllerName, "/layout"); } return((Dictionary <string, GridInfo>)HttpContext.Cache[ControllerName + "GridLayout"]); }
protected AdvanceGridLayout EntryGridLayout2() { if (HttpContext.Cache[ControllerName + "GridLayout"] == null) { string areaName = RouteData.DataTokens["area"].ToString(); CacheInit.CreateAdvanceGridLayoutCache(HttpContext, areaName, ControllerName, "/gridLayout/columnLayout"); } return((AdvanceGridLayout)HttpContext.Cache[ControllerName + "GridLayout"]); }
protected int Update(IApproveEntry rep, ApproveEntryViewModel model, string pkValue, string approveReturn) { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataUpdate dbUpdate = new DataUpdate(); try { dbUpdate.BeginTransaction(); rep.DbUpdate = dbUpdate; if (model.FormMode != "approve") { //再申请的,将状态由再申请初期变为再申请 if (model.FormMode == "reapply") { ApproveRepository repApprove = new ApproveRepository(); repApprove.DbUpdate = rep.DbUpdate; repApprove.EditData(sysUser, model.ViewTitle, model.ApproveTableName, model.ApprovePkField, model.ApprovePkValue, "A", model.ApproveMind, model.ApproveNode); } if (CheckModelIsValid(model)) { rep.Update(model, sysUser, model.FormMode, pkValue, model.ViewTitle); } else { return(0); } } else { //ModelState.Clear(); if (ApproveAndUpdate(rep, model, pkValue, approveReturn, sysUser) == 0) { return(0); } int val = DealApprove(rep, model, approveReturn, ""); if (val == 0) { return(0); } } dbUpdate.Commit(); return(1); } catch (Exception ex) { dbUpdate.Rollback(); model.Message = ex.Message; model.HasError = "true"; AppLog.WriteLog(sysUser.UserName, LogType.Error, "UpdateError", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(0); } finally { dbUpdate.Close(); } }
protected override GridLayout GridLayout(string listMode, string selectMode) { string tag = ""; if (AppMember.ViewVersion == "Cus_Simple") { tag = "Cus_Simple_"; } if (listMode == "approve" || listMode == "reapply") { if (HttpContext.Cache["AssetsApproveGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "Common", "AssetsApprove"); } return((GridLayout)HttpContext.Cache["AssetsApproveGridLayout"]); } else { if (selectMode == "AssetsSelect") { if (HttpContext.Cache[tag + "AssetsSelectGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", tag + "AssetsSelect"); } return((GridLayout)HttpContext.Cache[tag + "AssetsSelectGridLayout"]); } else if (selectMode == "BorrowAssetsSelect") { if (HttpContext.Cache["BorrowAssetsSelectGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", "BorrowAssetsSelect"); } return((GridLayout)HttpContext.Cache["BorrowAssetsSelectGridLayout"]); } else { if (AppMember.DepreciationRuleOpen) { if (HttpContext.Cache[tag + "Assets_DepreciationRuleGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", tag + "Assets_DepreciationRule"); } return((GridLayout)HttpContext.Cache[tag + "Assets_DepreciationRuleGridLayout"]); } else { if (HttpContext.Cache[tag + "AssetsGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", tag + "Assets"); } return((GridLayout)HttpContext.Cache[tag + "AssetsGridLayout"]); } } } }
protected virtual GridLayout EntryGridLayout(string formMode) { string cacheName = "DropDownGridLayout"; string layoutName = "DropDownGrid"; if (HttpContext.Cache[cacheName] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "Common", layoutName, formMode, cacheName); } return((GridLayout)HttpContext.Cache[cacheName]); }
// // GET: /Home/ //protected override void OnResultExecuting(ResultExecutingContext filterContext) //{ // base.OnResultExecuting(filterContext); // //if (RouteData.DataTokens.Count > 0) // // AreaName = RouteData.DataTokens["area"].ToString(); // InitCssAndJs(); //} //protected override void OnException(ExceptionContext filterContext) //{ // base.OnException(filterContext); // TempData["Exception"] = filterContext.Exception.Message; //} //private void InitCssAndJs() //{ // string layoutContentPath = "~/Content/css/"; // string[] layoutCss = new string[]{ // "redmond/jquery-ui-1.8.18.custom.css", // "redmond/ui.jqgrid.css", // "tree/zTreeStyle/zTreeStyle.css", // //"button/Button.css", // "uploadify/uploadify.css", // "Site.css", // "pagecss.css" // }; // StringBuilder sb = new StringBuilder(); // foreach (var item in layoutCss) // { // sb.Append(@"<link type=""text/css"" rel=""stylesheet"" href="""); // sb.Append(Url.Content(layoutContentPath) + item); // sb.AppendLine(@"""/>"); // } // TempData["CssBlock"] = sb.ToString(); // sb.Clear(); // string jsPath = "~/Scripts/used/"; // string[] jqScript = new string[]{ // "jquery-1.7.1.min.js", // "jquery-ui-1.8.18.custom.min.js", // "jquery.ui.datepicker-zh-CN.js", // "jquery.layout.js", // "grid.locale-cn.js", // "jquery.jqGrid.min.js", // "tree/jquery.ztree.core-3.0.js", // "tree/jquery.ztree.excheck-3.0.js", // "json2.js", // //"btn.js", // "jquery.uploadify.min.js", // "app.customer.js", // }; // foreach (var item in jqScript) // { // sb.Append(@"<script type=""text/javascript"" src="""); // sb.Append(Url.Content(jsPath + item)); // sb.AppendLine(@" ""></script>"); // } // TempData["ScriptBlock"] = sb.ToString(); //} public ActionResult Index() { ClearClientPageCache(Response); //if (AppMember.AutoDepreciation == "true") // AutoDepreciation.ExcuteAutoUpdate(); //string autoBackup = ConfigurationManager.AppSettings["AutoBackup"].ToString(); //if (autoBackup == "true") // DataBaseBackupRepository.ExcuteAutoBackUp(); UserInfo sysUser = CacheInit.GetUserInfo(HttpContext, true); ViewData["sysUser"] = sysUser; return(View()); }
protected GridLayout EntryGridLayout() { string tag = ""; if (AppMember.ViewVersion == "Cus_Simple") { tag = "Cus_Simple_"; } if (HttpContext.Cache[tag + "BarcodePrintEntryGridLayout"] == null) { CacheInit.CreateGridLayoutCache(HttpContext, "AssetsBusiness", tag + "BarcodePrintEntry"); } return((GridLayout)HttpContext.Cache[tag + "BarcodePrintEntryGridLayout"]); }
protected void SetParentEntryModel(string pageId, string primaryKey, string formMode, string viewTitle, ApproveEntryViewModel model) { model.PageId = pageId; model.ViewTitle = viewTitle; model.FormMode = formMode; model.FormId = "EntryForm"; model.SaveUrl = Url.Action("Entry"); model.IsDisabled = true; model.CustomClick = false; //if (formMode != "approve") // model.CustomClick = true; //if (DataConvert.ToString(formMode).Contains("approve") ||DataConvert.ToString(formMode).Contains("reapply")) // model.ReturnUrl = Url.Action("List", new { listMode = formMode }); //else // model.ReturnUrl = Url.Action("List"); if (formMode.Contains("approve") || formMode.Contains("reapply")) { model.ApproveReturnUrl = Url.Action("Entry", new { approveReturn = "true" }); model.ApproveGridLayout = ApproveGridLayout(); model.ApprovePkValue = primaryKey; if (formMode == "approveinfo") { model.ReturnUrl = Url.Action("List"); } else { model.ReturnUrl = Url.Action("List", new { listMode = formMode.Contains("approve") ? "approve" : "reapply" }); if (formMode.Contains("approve") && formMode != "approveview") { ApproveRepository repApprove = new ApproveRepository(); UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataRow dr = repApprove.GetApproveData(model.ApproveTableName, primaryKey, sysUser.UserId); model.ApproveNode = DataConvert.ToString(dr["approveNode"]); model.ApproveLevel = DataConvert.ToString(dr["approveLevel"]); } } } else { if (formMode.Contains("actual")) { model.ReturnUrl = Url.Action("List", new { listMode = "actual" }); } else { model.ReturnUrl = Url.Action("List"); } } }