public string GetTreeNode(FormCollection context) { try { //sys_users TB_MessageBll dal = new TB_MessageBll(); string strTreeNode = JSONhelper.ToJson(dal.GetOrganizationTreegridData().ToList()); return(strTreeNode.Replace("FID", "id").Replace("UserName", "text").Replace("RoleName", "text")); } catch (Exception ex) { LogHelper.WriteLog(ex); return(ex.Message); } }
public string EditPassword() { string fid = Request["fid"]; string password = Request["password"]; int result = FranchiseeDal.Instance.UpdateWhatWhere(new { PASSWORD = StringHelper.MD5string(password) }, new { FID = fid }); if (result > 0) { return(JSONhelper.ToJson("密码修改成功!")); } else { return(JSONhelper.ToJson("密码修改失败!")); } }
public override void ProcessRequest(HttpContext context) { var msg = new { success = false, message = "session信息丢失" }; //Session登录 if (Sys_User != null) { msg = new { success = true, message = "ok" }; } else { msg = new { success = false, message = "session信息丢失" }; } context.Response.Write(JSONhelper.ToJson(msg)); context.Response.End(); }
public string DataBase(FormCollection context) { string path = Server.MapPath("~/dbase/"); DirectoryInfo di = new DirectoryInfo(path); var query = from n in di.GetFiles() orderby n.CreationTime descending select new { FileName = n.Name, FileSize = ((float)n.Length / 1024 / 1024).ToString("N3") + " M", CreateDate = n.CreationTime.ToString("yyyy-MM-dd HH:mm:ss") }; return(JSONhelper.ToJson(query)); }
public string PriorityList() { List <object> list = new List <object>(); for (int i = 1; i <= 5; i++) { list.Add(new { id = i, text = i + "级", iconCls = "icon-bullet_blue" }); } return(JSONhelper.ToJson(list)); }
public string SubDicCategory(string parentID) { List <object> list = new List <object>(); foreach (var item in SYS_SUBDICSBLL.Instance.GetByClassID(parentID)) { list.Add(new { id = item.FID, text = item.FNAME, iconCls = "icon-bullet_blue", }); } return(JSONhelper.ToJson(list)); }
/// <summary> /// 得到子表单实体Json /// </summary> /// <param name="cxt"></param> public void GetChildUserControlEntity(HttpContext cxt) { string outputJson = string.Empty; string id = PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("keyId")); if (!string.IsNullOrEmpty(id)) { var dtTemp = RDIFrameworkService.Instance.WorkFlowUserControlService.GetChildUserControl(Utils.UserInfo, id); if (dtTemp != null && dtTemp.Rows.Count > 0) { var entity = BaseEntity.Create <UserControlsEntity>(dtTemp); outputJson = JSONhelper.ToJson(entity); } } cxt.Response.Write(outputJson); }
public string GetClientUpdateFiles() { List <string> list = new List <string>(); var files = Directory.GetFiles(Server.MapPath("~/ClientUpdate")); foreach (string file in files) { list.Add(string.Format("http://{0}//ClientUpdate//{1}", Request.Url.Authority, Path.GetFileName(file))); } return(JSONhelper.ToJson(new ResultClass() { errCode = 0, data = list })); }
public string GetMarketLocations() { var datalist = TB_PREMISEDal.Instance.GetAll(); List <object> list = new List <object>(); foreach (var item in datalist) { list.Add(new { id = item.FID, text = item.FNAME }); } return(JSONhelper.ToJson(list)); }
public string GetApprovalGroups() { var datalist = TB_REVIEWTEAMDal.Instance.GetAll(); List <object> list = new List <object>(); foreach (var item in datalist) { list.Add(new { id = item.FID, text = item.FNAME }); } return(JSONhelper.ToJson(list)); }
public string TB_ORGANIZATIONNoSaleArea(bool showDisable = true, string keywords = null) { string parentid = string.IsNullOrEmpty(Request["parentid"]) ? "0" : Request["parentid"]; List <V_ORGANIZATIONModel> datalist = null; if (!string.IsNullOrEmpty(keywords)) { datalist = V_ORGANIZATIONDal.Instance.GetAll().ToList(); } else { datalist = V_ORGANIZATIONDal.Instance.GetWhere(new { FPARENTALID = parentid }).ToList(); } List <object> list = new List <object>(); foreach (var item in datalist) { if (!showDisable && item.FSTATUS != 1) { continue; } if (item.FTYPE != 1) { continue; } if (string.IsNullOrEmpty(keywords) || item.FORGNAME.Contains(keywords) || item.FORGCODE.Contains(keywords)) { list.Add(new { FID = item.FID, FPARENTALID = item.FPARENTALID, FSTATUS = item.FSTATUS, FORGCODE = item.FORGCODE, FORGNAME = item.FORGNAME, FHEADER = item.FHEADER, FHEADERNAME = item.FHEADERNAME, FTYPE = item.FTYPE, FSTATUSNAME = item.FSTATUSNAME, FTYPENAME = item.FTYPENAME, state = "closed", }); } } return(JSONhelper.ToJson(list)); }
public string DicCategory() { List <object> list = new List <object>(); foreach (var item in SYS_DICSBLL.Instance.GetAll()) { list.Add(new { id = item.FID, //text = string.Format("{0}[{1}]", item.FCLASSNAME, item.FCLASSCODE), text = string.Format("{0}", item.FCLASSNAME), iconCls = "icon-bullet_blue", }); } return(JSONhelper.ToJson(list)); }
public string TreeJson() { try { IEnumerable <OrganizeModel> list1 = OrganizeDal.Instance.GetWhere(new { TYPE = 0 }); IEnumerable <OrganizeModel> list2 = OrganizeDal.Instance.GetWhere(new { TYPE = 1 }); List <TreeItem> data1 = new List <TreeItem>(); List <TreeItem> data2 = new List <TreeItem>(); data1.Add(new TreeItem() { id = "0", text = "总部" }); foreach (OrganizeModel model in list1) { data1.Add(new TreeItem() { id = model.FID, text = model.NAME }); } foreach (OrganizeModel model in list2) { data2.Add(new TreeItem() { id = model.FID, text = model.NAME }); } List <TreeItem> tree = new List <TreeItem>(); tree.Add(new TreeItem() { id = "", text = "华耐", children = data1 }); tree.Add(new TreeItem() { id = "1", text = "加盟商", children = data2 }); return(JSONhelper.ToJson(tree)); } catch (Exception ex) { return(""); } }
public string Remote_InsertICPOEntry(MApiModel.api3.Rootobject getapi3) { try { MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi(); MApiModel.recToken.Rootobject g_token = new MApiModel.recToken.Rootobject(); MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject(); tempToken.comid = int.Parse(getapi3.comid); tempToken.action = "getToken"; tempToken.khhm = "300384"; tempToken.openkey = hn.Common.StringHelper.MD5string("10011630"); g_token = Mapi.AccessApi1(tempToken); LogHelper.WriteLog(JSONhelper.ToJson(g_token)); getapi3.token = g_token.token; MApiModel.recApi3.Rootobject recapi3 = Mapi.AccessApi3(getapi3); LogHelper.WriteLog(JSONhelper.ToJson(recapi3)); if (recapi3.status == 0) { try { return(recapi3.resultInfo[0].pzhm); } catch { return("error:未返回编号"); } } else { return("error:" + recapi3.msg); } } catch (Exception ee) { return("error:" + ee.ToString()); } }
public Dictionary <string, string> ModelToDic <T>() { var t = typeof(T); var pis = t.GetProperties().ToList(); Dictionary <string, string> result = new Dictionary <string, string>(); pis.ForEach(p => { var value = p.GetValue(this, null); if (value != null) { result.Add(p.Name, JSONhelper.ToJson(value)); } }); return(result); }
public string Delete(FormCollection context) { try { UserBll.Instance.CheckUserOnlingState(); var rpm = GetRpm(context); JsonMessage message = TB_UnitGroupBll.Instance.DelectBT_UnitGroupModel(rpm.FID); return(JSONhelper.ToJson(new { errCode = 0, errMsg = message.Message })); } catch (Exception ex) { LogHelper.WriteLog(ex); return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message })); } }
/// <summary> /// 获取销区数据 下拉树 /// </summary> /// <returns></returns> public string GetSaleLocation(Constant.SysDics code) { var list = SYS_SUBDICSBLL.Instance.GetByCodeWithEnable(code); var list2 = from c in list where c.FPARENTID == null select c; return(JSONhelper.ToJson(list2.Select(s => new { id = s.FID, text = s.FNAME, children = list.Where(o => o.FPARENTID == s.FID).Select(o => new { id = o.FID, text = o.FNAME, }) }))); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; switch (PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("action"))) { case "Add": AddModule(context); break; case "Edit": EditModule(context); break; case "Delete": DeleteModule(context); break; case "GetModuleTree": var treeData = GetJsonData(GetModuleScope(PermissionItemScopeCode)); treeData = treeData.Replace("Id", "id").Replace("FullName", "text").Replace("Expand", "state").Replace("icon ", "").Replace("\"IconCss\"", "\"iconCls\""); //.Replace("\"state\":1", "\"state\":\"open\"").Replace("\"state\":0", "\"state context.Response.Write(treeData); break; case "GetModuleByParentId": GetModuleByParentId(context); break; case "GetModuleByIds": GetModuleByIds(context); break; case "GetEntity": context.Response.Write(JSONhelper.ToJson( RDIFrameworkService.Instance.ModuleService.GetEntity(Utils.UserInfo, PublicMethod.GetString(WebCommon.StringHelper.GetRequestObject("KeyId"))))); break; default: var jsonStr = GetJsonData(GetModuleScope(PermissionItemScopeCode)); jsonStr = jsonStr.Replace("icon ", "").Replace("\"IconCss\"", "\"iconCls\""); context.Response.Write(jsonStr); break; } }
public string SrcSave(FormCollection context) { try { string id = context["FID"]; if (!string.IsNullOrEmpty(id)) { SRCModel model = SRCDal.Instance.Get(id); model.FPRODUCTID = context["FPRODUCTID"]; model.FSRCNAME = context["FSRCNAME"]; model.FSRCCODE = context["FSRCCODE"]; model.FSRCMODEL = context["FSRCMODEL"]; model.FUNIT = context["FUNIT"]; model.FORDERUNIT = context["FORDERUNIT"]; model.FRATE = context["FRATE"].ToDecimal(); model.FWEIGHT = context["FWEIGHT"].ToDecimal(); SRCDal.Instance.Update(model); } else { SRCModel model = new SRCModel(); model.FPRODUCTID = context["FPRODUCTID"]; model.FSRCNAME = context["FSRCNAME"]; model.FSRCCODE = context["FSRCCODE"]; model.FSRCMODEL = context["FSRCMODEL"]; model.FUNIT = context["FUNIT"]; model.FORDERUNIT = context["FORDERUNIT"]; model.FRATE = context["FRATE"].ToDecimal(); model.FWEIGHT = context["FWEIGHT"].ToDecimal(); SRCDal.Instance.Insert(model); } return(JSONhelper.ToJson(new { errCode = 0, errMsg = "" })); } catch (Exception ex) { LogHelper.WriteLog(ex); return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message })); } }
public string CategoryList(bool appendAll = false) { //List<object> list = new List<object>(); //if (appendAll) //{ // list.Add(new // { // id = "", // text = "全部", // iconCls = "icon-bullet_blue", // }); //} IEnumerable <object> list = CategoryBll.Instance.GetCategoryTreegridList(); return(JSONhelper.ToJson(list)); }
public string GetSubDicByCategoryCode() { string categoryCode = Request["categoryCode"]; int category = 0; if (!int.TryParse(categoryCode, out category)) { return(""); } switch (category) { case 103: return(JSONhelper.ToJson(getSubDics(Constant.SysDics.价格政策类型))); default: break; } return(""); }
public string Delete(FormCollection context) { try { UserBll.Instance.CheckUserOnlingState(); //var rpm = GetRpm(context); string ids = context["json"]; TB_MessageBll.Instance.DelectBT_MessageModel(ids); return(JSONhelper.ToJson(new { errCode = 0, errMsg = "" })); } catch (Exception ex) { return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message })); } }
public string SYS_SUBDICS(string parentID = null) { IEnumerable <SYS_SUBDICSMODEL> dataList = SYS_SUBDICSBLL.Instance.GetByClassID(parentID).OrderBy(m => m.FNUMBER).ToList(); List <object> list = new List <object>(); foreach (var item in dataList.Where(d => (d.FPARENTID.IsNullOrEmpty() || d.FPARENTID == "0"))) { list.Add(new { FID = item.FID, FCLASSID = item.FCLASSID, FCREATETIME = item.FCREATETIME, FNAME = item.FNAME, FCREATOR = item.FCREATOR, FNUMBER = item.FNUMBER, FPARENTID = item.FPARENTID, FREMARK = item.FREMARK, FSTATUS = item.FSTATUS, FSTATUSNAME = item.FSTATUSNAME, FUPDATER = item.FUPDATER, FUPDATETIME = item.FUPDATETIME, children = dataList.Where(s => s.FPARENTID == item.FID).Select(s => new { FID = s.FID, FCLASSID = s.FCLASSID, FCREATETIME = s.FCREATETIME, FNAME = s.FNAME, FCREATOR = s.FCREATOR, FNUMBER = s.FNUMBER, FPARENTID = s.FPARENTID, FREMARK = s.FREMARK, FSTATUS = s.FSTATUS, FSTATUSNAME = s.FSTATUSNAME, FUPDATER = s.FUPDATER, FUPDATETIME = s.FUPDATETIME, }) }); } return(JSONhelper.ToJson(list)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var userName = context.Request["username"]; var password = context.Request["password"]; var validateCode = context.Request["validateCode"]; var saveCookieDays = PublicMethod.GetInt(context.Request["savedays"]); var msg = new { success = false, message = "亲,用户名不存在哦!仔细猜一哈。" }; var useValidateCode = ConfigHelper.GetValue("showValidateCode"); if (useValidateCode == "true" && !VcodePage.Validation(validateCode)) { msg = new { success = false, message = "亲,验证码不正确。" }; } else { User u = UserDal.Instance.GetUserBy(userName); if (u != null) { if (!u.IsDisabled) { bool flag = UserBll.Instance.UserLogin(userName, password, saveCookieDays); if (flag) { msg = new { success = true, message = "ok" }; } else { msg = new { success = false, message = "亲,用户名或密码不正确哦。" }; } } else { msg = new { success = false, message = "亲,您的帐号已被禁用,请联系管理员吧。" }; } } } context.Response.Write(JSONhelper.ToJson(msg)); context.Response.End(); }
public string TB_ORGANIZATION_Sale(string parentID, string saleLV = "") { int lv = 0;//销区等级 if (saleLV != "" && saleLV == "1") { lv = 1; } else { lv = 2; } string parentid = string.IsNullOrEmpty(parentID) ? "0" : parentID; var datalist = V_ORGANIZATIONDal.Instance.GetWhere(new { FPARENTALID = parentid }); if (datalist.Count() <= 0) { return(""); } List <object> list = new List <object>(); foreach (var item in datalist) { if (item.FSTATUS != 1) { continue; } if (item.FTYPE != (lv + 1))//销区等级过滤 { TB_ORGANIZATION_Sale_Recursion(item.FID, list, lv); continue; } list.Add(new { id = item.FID, text = item.FORGNAME }); TB_ORGANIZATION_Sale_Recursion(item.FID, list, lv); } return(JSONhelper.ToJson(list)); }
private void AddUser() { string PassSalt = StringHelper.RandomString(4); string PassWord = StringHelper.MD5string(HttpContext.Current.Request.Params["psys_user_txtPassWord"] + PassSalt); string UserName = HttpContext.Current.Request.Params["psys_user_txtUserName"]; Hashtable ht = new Hashtable(); ht.Add("UserName", $" and UserName ='******'"); var TempUser = Bll_Sys_User.Instance.getSysUserList(ht); Mod_Com_Json mod_Com_Json = new Mod_Com_Json(); if (TempUser == null) { Mod_Sys_User mod_Sys_User = new Mod_Sys_User(); mod_Sys_User.PassSalt = PassSalt; mod_Sys_User.PassWord = PassWord; mod_Sys_User.RoleId = -1; mod_Sys_User.UserName = UserName; int result = Bll_Sys_User.Instance.Add(mod_Sys_User); if (result == 1) { mod_Com_Json.Data = ""; mod_Com_Json.Message = "成功"; mod_Com_Json.StatuCode = "200"; } else { mod_Com_Json.Data = ""; mod_Com_Json.Message = "失败"; mod_Com_Json.StatuCode = "-1"; } } else { mod_Com_Json.Data = ""; mod_Com_Json.Message = "失败,用户名重复"; mod_Com_Json.StatuCode = "-1"; } HttpContext.Current.Response.ContentType = "application/json; charset=utf-8"; HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json)); }
/// <summary> /// 新增菜单 /// </summary> public void AddSys_Menue() { Mod_Sys_Menu _Sys_Menu = new Mod_Sys_Menu(); BindDataToModel(ref _Sys_Menu); int rval = Bll_Sys_Menu.Instance.Add(_Sys_Menu); Mod_Com_Json mod_Com_Json = new Mod_Com_Json(); if (rval >= 0) { mod_Com_Json.Message = "新增成功"; mod_Com_Json.StatuCode = "200"; } else { mod_Com_Json.Message = "新增失败"; mod_Com_Json.StatuCode = "-1"; } HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json)); }
//[HttpPost] //public string GetDic(FormCollection collection) //{ // string categoryId = Request["categoryId"]; // if (categoryId == "") // { // categoryId = collection["categoryId"]; // } // return DicBll.Instance.GetDicListByCode(categoryId); //} ///// <summary> ///// 获取客户分类数据字典 ///// </summary> ///// <param name="collection"></param> ///// <returns></returns> //[HttpPost] //public string GetDicCombotree(FormCollection collection) //{ // string categoryId = Request["categoryId"]; // if (categoryId == "") // { // categoryId = collection["categoryId"]; // } // var nodes = DicBll.Instance.GetDicIListByCode(categoryId); // var treeNodes = from n in nodes // select // new { id = n.FID, text = n.Title, children = n.children }; // return ""; //} /// <summary> /// 检测编码的有效性 /// </summary> /// <param name="num"></param> /// <param name="id"></param> /// <returns></returns> public string CheckCode(string code, string id) { try { UserBll.Instance.CheckUserOnlingState(); List <Dic> list = DicDal.Instance.CheckCode(code, id); if (list != null && list.Count > 0) { return(JSONhelper.ToJson(new { errCode = -1, errMsg = "编码已存在,请重新输入!" })); } return(JSONhelper.ToJson(new { errCode = 0 })); } catch (Exception ex) { LogHelper.WriteLog(ex); return(JSONhelper.ToJson(new { errCode = -1, errMsg = ex.Message })); } }
private void getRoleList() { int pageindex = int.Parse(HttpContext.Current.Request.Params["page"]); int pagesize = int.Parse(HttpContext.Current.Request.Params["rows"]); Mod_Com_Pager pager = new Mod_Com_Pager(pagesize, pageindex); Hashtable ht = new Hashtable(); DataSet ds = Bll_Sys_Role.Instance.getSysRoleList(ht, "RoleID", pager); DataTable dt = null; List <Mod_Sys_User> _Sys_User = new List <Mod_Sys_User>(); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } string result = $"\"total\":\"{pager.RowCount.ToString()}\",\"rows\":{JSONhelper.ToJson(dt)}"; result = "{" + result + "}"; HttpContext.Current.Response.Write(result); }
/// <summary> /// 删除菜单 /// </summary> public void DeleteSys_Menue() { Mod_Sys_Menu _Sys_Menu = new Mod_Sys_Menu(); BindDataToModel(ref _Sys_Menu); bool rval = Bll_Sys_Menu.Instance.Delete(_Sys_Menu.MenuId); Mod_Com_Json mod_Com_Json = new Mod_Com_Json(); if (rval) { mod_Com_Json.Message = "删除成功"; mod_Com_Json.StatuCode = "200"; } else { mod_Com_Json.Message = "删除失败"; mod_Com_Json.StatuCode = "-1"; } HttpContext.Current.Response.Write(JSONhelper.ToJson(mod_Com_Json)); }