/// <summary> /// 写入操作日志信息 /// </summary> /// <returns></returns> public static void AddOpera(Model.System.sys_LoginUser loginUserModel, int menuId, string operaType, string memo) { Model.System.sys_Config configModel = new BLL.System.sys_Config().loadConfig(); if (configModel.logstatus == 1) { Model.System.sys_OperaLog operaModel = new Model.System.sys_OperaLog(); if (loginUserModel != null) { operaModel.PerId = loginUserModel.ID; operaModel.PerName = loginUserModel.PerName; operaModel.PerAccount = loginUserModel.Account; operaModel.MenuId = menuId; operaModel.OperaType = operaType; operaModel.Memo = memo; operaModel.OperaTime = DateTime.Now; operaModel.LoginIP = loginUserModel.LoginIP; try { new BLL.System.sys_OperaLog().Add(operaModel); } catch { throw; } } } }
private void GetListByPower(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { BLL.sys_Bulletin bll = new BLL.sys_Bulletin(); //int recordNum = RequestHelper.GetInt("recordNum",0); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string strWhere = ""; DataTable dt = bll.GetListByPower(strWhere, 0, loginUserModel.DepId).Tables[0]; string rowsStr = Utils.ToJson(dt); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":"); jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":"); jsonStr.Append(rowsStr); jsonStr.Append("}}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void GetList(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { BLL.System.sys_Mail_Send bll = new BLL.System.sys_Mail_Send(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string strWhere = " and a.OperaId=" + loginUserModel.ID.ToString(); DataTable dt = bll.GetList(strWhere).Tables[0]; string rowsStr = Utils.ToJson(dt); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":"); jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":"); jsonStr.Append(rowsStr); jsonStr.Append("}}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void GetUserInfo(HttpContext context) { try { string loginSalt = RequestHelper.GetQueryString("LoginSalt"); if (loginSalt == "") { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"Salt不能为空!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); if (loginUserModel == null || loginUserModel.Salt != loginSalt) { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"登录超时,请重新登录!\"}"); return; } context.Response.Write("{\"status\":\"1\",\"userName\":\"" + loginUserModel.PerName + "!\"}"); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string ID = RequestHelper.GetString("ID"); string MachineModel = RequestHelper.GetString("MachineModel"); string MachineLevel = RequestHelper.GetString("MachineLevel"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.Model.Base.base_MachineModel model = new SCZM.Model.Base.base_MachineModel(); SCZM.BLL.Base.base_MachineModel bll = new SCZM.BLL.Base.base_MachineModel(); model.ID = Utils.StrToInt(ID, 0); model.MachineModel = MachineModel; model.MachineLevel = Utils.StrToInt(MachineLevel, 0); model.OperaId = loginUserModel.ID; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (ID == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增机型:" + model.ID; } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改机型:" + model.ID; } } if (status == "1") { //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } int perId = RequestHelper.GetInt("id", 0); string perName = RequestHelper.GetString("perName"); string powerStr = RequestHelper.GetString("powerStr"); if (perId == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,人员ID不能为空!\"}"); return; } string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); BLL.System.sys_PersonPower bll = new BLL.System.sys_PersonPower(); DateTime operaTime = DateTime.Now; List <Model.System.sys_PersonPower> powerList = new List <Model.System.sys_PersonPower>(); string[] powerArray = powerStr.Split(','); Model.System.sys_PersonPower perPowerModel = new Model.System.sys_PersonPower(); foreach (string powerId in powerArray) { perPowerModel = new Model.System.sys_PersonPower(); perPowerModel.PerId = perId; perPowerModel.PowerId = Utils.StrToInt(powerId, 0); perPowerModel.FlagDel = false; perPowerModel.OperaName = loginUserModel.PerName; perPowerModel.OperaTime = operaTime; powerList.Add(perPowerModel); } if (bll.Update(powerList, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "设置人员权限:" + perName + "(" + perId.ToString() + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
/// <summary> /// 取得登录session信息 /// </summary> /// <returns></returns> public static Model.System.sys_LoginUser GetLoginInfo() { if (IsManagerLogin()) { Model.System.sys_LoginUser loginUserModel = HttpContext.Current.Session[Keys.SESSION_LoginUser] as Model.System.sys_LoginUser; if (loginUserModel != null) { return(loginUserModel); } } return(null); }
/// <summary> /// 从登录Model获取操作日志信息 /// </summary> /// <returns></returns> public static Model.System.sys_OperaLog GetOperaModel(Model.System.sys_LoginUser LoginUserModel) { Model.System.sys_OperaLog operaModel = new Model.System.sys_OperaLog(); if (LoginUserModel != null) { operaModel.PerId = LoginUserModel.ID; operaModel.PerName = LoginUserModel.PerName; operaModel.PerAccount = LoginUserModel.Account; operaModel.OperaTime = DateTime.Now; operaModel.LoginIP = LoginUserModel.LoginIP; } return(operaModel); }
private void GetPagePower(HttpContext context) { try { string loginSalt = RequestHelper.GetQueryString("LoginSalt"); string menuId = RequestHelper.GetQueryString("MenuId"); string url = RequestHelper.GetUrlReferrer(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string result = BaseWeb.CheckPageParam(loginSalt, menuId, url, loginUserModel); if (result != "") { context.Response.Write(result); return; } if (loginUserModel.IsAdmin == true) { context.Response.Write("{\"status\":\"1\",\"msg\":\"系统管理员权限!\",\"info\":\"\"}"); return; } int pageId = BaseWeb.GetPageId(menuId, url); if (pageId == 0) { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"非法传入页面!\"}"); return; } List <string[]> pageElementPowerList = BaseWeb.GetPageElementListByCache(loginUserModel.ID, pageId); string info = ""; foreach (string[] pageElementPower in pageElementPowerList) { if (pageElementPower[0] == "show" && pageElementPower[1] == "0") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"没有权限!\"}"); return; } if (pageElementPower[0] != "show" && pageElementPower[1] == "0") { info += pageElementPower[0] + ","; } } info = Utils.DelLastComma(info); context.Response.Write("{\"status\":\"1\",\"msg\":\"权限获取成功!\",\"info\":\"" + info + "\"}"); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + e.Message + "\"}"); } }
private void GetData(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { int roleId = RequestHelper.GetInt("id", 0); string roleStr = ""; BLL.System.sys_Role bll = new BLL.System.sys_Role(); if (roleId != 0) { DataTable dt = bll.GetList(roleId).Tables[0]; if (dt.Rows.Count == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,该条数据已被其他人删除!\"}"); return; } roleStr = Utils.ToJson(dt); } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); StringBuilder strWhere = new StringBuilder(); if (!loginUserModel.IsAdmin) { strWhere.Append(" and MenuType<>'system'"); } BLL.System.sys_Menu menuBll = new BLL.System.sys_Menu(); DataTable menuDT = menuBll.GetList(strWhere.ToString()).Tables[0]; DataTable powerDT = bll.GetRolePowerAllList(roleId).Tables[0]; string menuStr = DtToRolePowerJson(menuDT, powerDT, 0); menuStr = "[" + menuStr.Substring(1) + "]"; StringBuilder jsonStr = new StringBuilder(); if (roleId != 0) { jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"roleInfo\":" + roleStr + ",\"menuInfo\":" + menuStr + "}"); } else { jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"roleInfo\":\"\",\"menuInfo\":" + menuStr + "}"); } context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" +Utils.HtmlEncode(e.Message) + "\"}"); return; } }
/// <summary> /// 校验客户端LoginSalt /// </summary> /// <returns></returns> public static bool CheckLogin(string loginSalt) { bool result = false; Model.System.sys_LoginUser model = new Model.System.sys_LoginUser(); model = GetLoginInfo(); if (model != null) { if (model.Salt == loginSalt) { result = true; } } return(result); }
private void SaveData_All(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string ScheduleStr = RequestHelper.GetString("ScheduleStr"); string ScheduleType = RequestHelper.GetString("ScheduleType"); string ScheduleDate = RequestHelper.GetString("ScheduleDate"); string AttachmentList_Schedule = RequestHelper.GetString("AttachmentId_Schedule"); string Memo = RequestHelper.GetString("Memo").Trim(); string ScheduleId = RequestHelper.GetString("ScheduleId"); string PauseReason = RequestHelper.GetString("PauseReason"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.Model.Repair.repair_Schedule model = new SCZM.Model.Repair.repair_Schedule(); string[] modelList = ScheduleStr.Split(','); for (int i = 0; i < modelList.Length; i++) { model = new Model.Repair.repair_Schedule(); string[] modelPart = modelList[i].Split('⊥'); model.AssignmentId = Utils.StrToInt(modelPart[0].ToString(), 0); model.AssignmentProcedureId = Utils.StrToInt(modelPart[1].ToString(), 0); model.ProcedureId = Utils.StrToInt(modelPart[2].ToString(), 0); model.ScheduleType = Utils.StrToInt(ScheduleType, 0); if (Memo != "" && Utils.IsSafeSqlString(Memo)) { model.Memo = Utils.Filter(Memo); } if (ScheduleDate != "") { model.ScheduleDate = Utils.StrToDateTime(ScheduleDate); } if (AttachmentList_Schedule != "") { model.AttachmentList_Schedule = AttachmentList_Schedule; } model.OperaDepId = loginUserModel.DepId; model.OperaId = loginUserModel.ID; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; model.ID = Utils.StrToInt(ScheduleId, -1); model.PauseReason = Utils.StrToInt(PauseReason, -1); SaveData(model, context); } }
private void DelData(HttpContext context, string btn) { if (btn != "btnDel") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); //string status = "0"; string operaAction = ""; string operaMemo = ""; try { UpLoad upFiles = new UpLoad(); DataTable dt = bll.GetList("Source=1 and UseId=0").Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { upFiles.fileDel(dt.Rows[i]["FilePath"].ToString()); } } bll.Delete("Source=1 and UseId=0"); //status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = "清理上传文件"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); context.Response.Write("{\"status\":\"1\",\"msg\":\"清理成功!\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void GetHomePage(HttpContext context) { try { string loginSalt = RequestHelper.GetQueryString("LoginSalt"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); if (loginUserModel == null || loginUserModel.Salt != loginSalt) { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"对不起,登录超时,请重新登录!\"}"); return; } string vt = new BLL.System.sys_Config().loadConfig().webversiontime; BLL.System.sys_Mail_Send mailBll = new BLL.System.sys_Mail_Send(); int receiveNoRead = mailBll.GetReceiveNoRead(loginUserModel.ID); BLL.sys_Bulletin bll = new BLL.sys_Bulletin(); int recordNumBulletin = RequestHelper.GetInt("recordNumBulletin", 0); string strWhere = ""; DataTable bulletinDT = bll.GetListByPower(strWhere, recordNumBulletin, loginUserModel.DepId).Tables[0]; string bulletinInfo = Utils.ToJson(bulletinDT); BLL.System.sys_Menu menuBll = new BLL.System.sys_Menu(); DataTable todoDT = menuBll.GetTodoList(loginUserModel.ID).Tables[0]; string todoInfo = Utils.ToJson(todoDT); DataTable nodoDT = menuBll.GetNodoList(loginUserModel.ID).Tables[0]; string nodoInfo = Utils.ToJson(nodoDT); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"vt\":\"" + vt + "\""); jsonStr.Append(",\"receiveNoRead\":" + receiveNoRead); jsonStr.Append(",\"bulletinInfo\":" + bulletinInfo); jsonStr.Append(",\"todoInfo\":" + todoInfo); jsonStr.Append(",\"nodoInfo\":" + nodoInfo); jsonStr.Append("}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + e.Message + "\"}"); } }
private void ModifyPwd(HttpContext context) { try { string loginSalt = RequestHelper.GetQueryString("LoginSalt"); if (loginSalt == "") { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"Salt不能为空!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); if (loginUserModel == null || loginUserModel.Salt != loginSalt) { context.Response.Write("{\"status\":\"0.1\",\"msg\":\"登录超时,请重新登录!\"}"); return; } string oldPwd = RequestHelper.GetString("oldPwd"); string newPwd = RequestHelper.GetString("newPwd"); BLL.System.sys_Person bll = new BLL.System.sys_Person(); string errMessage = bll.UpdatePwd(loginUserModel.Account, oldPwd, newPwd); if (errMessage != "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + errMessage + "\"}"); return; } //写入操作日志 Model.System.sys_OperaLog operaModel = BaseWeb.GetOperaModel(loginUserModel); operaModel.OperaType = Enums.ActionEnum.Login.ToString(); operaModel.Memo = "修改密码"; new BLL.System.sys_OperaLog().Add(operaModel); context.Response.Write("{\"status\":\"1\",\"msg\":\"密码修改成功!\"}"); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
public void ImportData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string rows = RequestHelper.GetString("rows"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.BLL.Base.base_CustomerInformation bll = new SCZM.BLL.Base.base_CustomerInformation(); string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (rows != "") { if (bll.ImportData(rows, out operaMessage) > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "导入客户档案"; } } if (status == "1") { //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void GetPersonCombo(HttpContext context, string btn) { string emptyStr = "[{\"PerId\":\"0\",\"PerName\":\"无\",\"DepName\":\"无\",\"DepId\":\"0\"}]"; if (btn != "show") { context.Response.Write(emptyStr); return; } try { BLL.System.sys_Person bll = new BLL.System.sys_Person(); string DepId = RequestHelper.GetString("DepId"); string PostId = RequestHelper.GetString("PostId"); string FlagCtrl = RequestHelper.GetString("FlagCtrl"); string PerName = RequestHelper.GetString("q").Trim(); StringBuilder strWhere = new StringBuilder(); if (DepId != "") { strWhere.Append(" and a.DepId in(select ID from sys_Department where ','+SupList like '%," + DepId + ",%' or ID=" + DepId + ")"); } if (PostId != "") { strWhere.Append(" and a.PostId in(" + PostId + ")"); } if (FlagCtrl == "1") { Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); strWhere.Append(" and a.ID in(select CtrlPerId from v_sys_PersonCtrl where PerId=" + loginUserModel.ID.ToString() + ")"); } if (PerName != "") { strWhere.Append(" and a.PerName like '%" + PerName + "%' "); } DataTable dt = bll.GetComboList(strWhere.ToString()).Tables[0]; string rowsStr = Utils.ToJson(dt); context.Response.Write(rowsStr); } catch { context.Response.Write(emptyStr); } }
private void DelData(HttpContext context, string btn) { if (btn != "btnDel") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string idStr = RequestHelper.GetString("idStr"); string nameStr = RequestHelper.GetString("nameStr"); if (idStr == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要删除的记录!\"}"); return; } BLL.System.sys_Department bll = new BLL.System.sys_Department(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (bll.DeleteList(PageValidate.SafeLongFilter(idStr, 0), out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = "删除部门:" + nameStr + "(" + idStr + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void ResponseInfo(HttpContext context, string remsg) { JsonData jd = JsonMapper.ToObject(remsg); string status = jd["status"].ToString(); string msg = jd["msg"].ToString(); if (status == "0") { showError(context, msg); return; } string filePath = jd["path"].ToString(); //取得上传后的路径 string fileName = jd["name"].ToString(); //取得上传的文件名 Model.System.sys_Attachment model = new Model.System.sys_Attachment(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); model.Source = 1; model.FileName = fileName; model.FilePath = filePath; model.FileUse = ""; model.UseId = 0; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment(); int fileId = bll.Add(model, out operaMessage); Hashtable hash = new Hashtable(); hash["error"] = 0; hash["url"] = filePath; hash["fileName"] = fileName; hash["fileId"] = fileId; context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); context.Response.Write(JsonMapper.ToJson(hash)); context.Response.End(); }
private void GetData(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } int perId = RequestHelper.GetInt("id", 0); if (perId == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,人员ID不能为空!\"}"); return; } try { BLL.System.sys_PersonPower bll = new BLL.System.sys_PersonPower(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); StringBuilder strWhere = new StringBuilder(); if (!loginUserModel.IsAdmin) { strWhere.Append(" and MenuType<>'system'"); } BLL.System.sys_Menu menuBll = new BLL.System.sys_Menu(); DataTable menuDT = menuBll.GetList(strWhere.ToString()).Tables[0]; DataTable powerDT = bll.GetPerPowerAllList(perId).Tables[0]; string menuStr = DtToRolePowerJson(menuDT, powerDT, 0); menuStr = "[" + menuStr.Substring(1) + "]"; StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"menuInfo\":" + menuStr + "}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void SetTop(HttpContext context, string btn) { if (btn != "btnSetTop" && btn != "btnCancelSetTop") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string idStr = RequestHelper.GetString("idStr"); int flagTop = RequestHelper.GetInt("flagTop", 0); if (idStr == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要操作的记录!\"}"); return; } BLL.sys_Bulletin bll = new BLL.sys_Bulletin(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (bll.SetTop(PageValidate.SafeLongFilter(idStr, 0), flagTop, loginUserModel.ID, loginUserModel.PerName, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = (flagTop == 0 ? "取消" : "") + "置顶公告:(" + idStr + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void DeleteLastSchedule(HttpContext context, string btn) { if (btn != "btnDel") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string ID = RequestHelper.GetString("ID"); if (ID == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要删除的记录!\"}"); return; } string prevId = RequestHelper.GetString("prevId"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.BLL.Repair.repair_Schedule bll = new SCZM.BLL.Repair.repair_Schedule(); string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (bll.DeleteLastSchedule(Utils.StrToInt(ID, 0), Utils.StrToInt(prevId, 0), out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = "删除进度反馈:" + ID; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); } }
private void UndoData(HttpContext context, string btn) { if (btn != "btnUndo") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string IDStr = RequestHelper.GetString("IDStr"); if (IDStr == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要作废的记录!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.BLL.Repair.Repair_Assignment bll = new SCZM.BLL.Repair.Repair_Assignment(); string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (bll.UndoList(PageValidate.SafeLongFilter(IDStr, 0), out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = "作废维修派工:" + IDStr; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); } }
private void GetMenu(HttpContext context) { try { string loginSalt = RequestHelper.GetQueryString("LoginSalt"); if (loginSalt == "") { context.Response.Write("身份验证失败"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); if (loginUserModel == null || loginUserModel.Salt != loginSalt) { //context.Response.Write("{\"status\":\"0\",\"msg\":\"身份验证失败!\"}"); context.Response.Write("身份验证失败"); return; } string htmlStr = ""; DataTable dt = null; if (loginUserModel.IsAdmin == true) { dt = new BLL.System.sys_Menu().GetList("").Tables[0]; } else { dt = new BLL.System.sys_Person().GetUserMenu(loginUserModel.ID).Tables[0]; } DataTable btnDT = new BLL.System.sys_Menu().GetNoPowerBtn(loginUserModel.ID).Tables[0]; int levelOpenId = dt.Select("levelId=1").Length > 4 ? 1 : 2; htmlStr = AddNode(dt, btnDT, 1, levelOpenId, "0", "ID", "menuName", "supId", "sortId", "linkUrl", "levelId"); context.Response.Write(htmlStr); } catch { context.Response.Write("身份验证失败"); return; } }
private void InitPwd(HttpContext context, string btn) { if (btn != "btnInitPwd") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { int perId = RequestHelper.GetInt("id", 0); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); string operaAction = ""; string operaMemo = ""; BLL.System.sys_Person bll = new BLL.System.sys_Person(); string pwd = bll.InitPwd(perId); if (pwd == "") { context.Response.Write("{\"status\":\"1\",\"msg\":\"初始化密码失败!\"}"); return; } else { operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "初始化密码:(" + perId + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"1\",\"msg\":\"初始化成功,密码为" + pwd + "!\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string id = RequestHelper.GetString("id"); string supId = RequestHelper.GetString("supId"); string depName = RequestHelper.GetString("depName"); string depType = RequestHelper.GetString("depType"); string QDCode = RequestHelper.GetString("QDCode"); string depTel = RequestHelper.GetString("depTel"); string sortId = RequestHelper.GetString("sortId"); string flagUse = RequestHelper.GetString("flagUse"); //string ctrlDep = RequestHelper.GetString("ctrlDep"); if (supId == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"上级部门编码不能为空!\"}"); return; } if (depName == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"部门名称不能为空!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); BLL.System.sys_Department bll = new BLL.System.sys_Department(); Model.System.sys_Department model = new Model.System.sys_Department(); model.ID = Utils.StrToInt(id, 0); model.DepName = depName; model.DepTel = depTel; model.DepTypeId = Utils.StrToInt(depType, 1); model.QDCode = QDCode; model.SortId = Utils.StrToInt(sortId, 1); model.SupId = Utils.StrToInt(supId, 1); model.FlagUse = Utils.StrToBool(flagUse, true); model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; DataTable dt = bll.GetList(int.Parse(supId)).Tables[0]; model.SupList = dt.Rows[0]["SupList"].ToString() + model.SupId + ","; model.LevelId = Utils.ObjToInt(dt.Rows[0]["levelId"], 1) + 1; //List<Model.System.sys_DepartmentCtrl> ctrlModelList=new List<Model.System.sys_DepartmentCtrl> (); //Model.System.sys_DepartmentCtrl ctrlModel = new Model.System.sys_DepartmentCtrl(); //string[] ctrlDepIdArray = ctrlDep.Split(','); //string[] ctrlDepIdArrayNew= ctrlDepIdArray.Intersect(ctrlDepIdArray).ToArray(); //int ctrlDepId = 0; //foreach (string s in ctrlDepIdArrayNew) //{ // ctrlDepId = Utils.StrToInt(s, 0); // if (ctrlDepId != 0) // { // ctrlModel = new Model.System.sys_DepartmentCtrl(); // ctrlModel.CtrlDepId = ctrlDepId; // ctrlModelList.Add(ctrlModel); // } //} //model.sys_DepartmentCtrls = ctrlModelList; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (id == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增部门:" + model.DepName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改部门:" + model.DepName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string id = RequestHelper.GetString("id"); string processName = RequestHelper.GetString("processName"); string flagUse = RequestHelper.GetString("flagUse"); string memo = RequestHelper.GetString("memo"); string post = RequestHelper.GetString("post"); if (processName == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"审批流名称不能为空!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); BLL.System.sys_Process bll = new BLL.System.sys_Process(); Model.System.sys_Process model = new Model.System.sys_Process(); model.ID = Utils.StrToInt(id, 0); model.ProcessName = processName; model.FlagUse = Utils.StrToBool(flagUse, true); model.Memo = memo; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; List <Model.System.sys_ProcessDetail> detailModelList = new List <Model.System.sys_ProcessDetail>(); Model.System.sys_ProcessDetail detailModel = new Model.System.sys_ProcessDetail(); string[] postArray = post.Split(','); int postId = 0; int i = 0; foreach (string s in postArray) { postId = Utils.StrToInt(s, 0); if (postId != 0) { i++; detailModel = new Model.System.sys_ProcessDetail(); detailModel.OrderId = i; detailModel.PostId = postId; detailModelList.Add(detailModel); } } model.sys_ProcessDetails = detailModelList; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (id == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增审批流:" + model.ProcessName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改审批流:" + model.ProcessName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void Login(HttpContext context) { try { string account = RequestHelper.GetString("account"); string pwd = RequestHelper.GetString("pwd"); string url = RequestHelper.GetUrlReferrer(); //判断登录错误次数 if (context.Session["LoginNum"] != null && Convert.ToInt32(context.Session["LoginNum"]) > 5) { context.Response.Write("{\"status\":\"0\",\"msg\":\"错误超过5次,关闭浏览器重新登录!\"}"); return; } if (account.Trim() == "") { WriteError(context); context.Response.Write("{\"status\":\"0\",\"msg\":\"账号不能为空!\"}"); return; } if (pwd.Trim() == "") { WriteError(context); context.Response.Write("{\"status\":\"0\",\"msg\":\"密码不能为空!\"}"); return; } if (url.Trim() == "") { WriteError(context); context.Response.Write("{\"status\":\"0.1\",\"msg\":\"非法传入页面!\"}"); return; } String domain = Utils.GetUrlDomain(url).ToLower(); if (domain != "localhost" || RequestHelper.GetIP() != "127.0.0.1") { Model.System.sys_Config configModel = new BLL.System.sys_Config().loadConfig(); string[] domainArray = (configModel.webinsideurl + "," + configModel.weburl).Split(','); if (domain == "" || !domainArray.Contains(domain)) { WriteError(context); context.Response.Write("{\"status\":\"0.1\",\"msg\":\"非法传入页面!\"}"); return; } } BLL.System.sys_Person bll = new BLL.System.sys_Person(); Model.System.sys_LoginUser model = bll.GetModel(account, pwd, true); if (model == null) { WriteError(context); context.Response.Write("{\"status\":\"0\",\"msg\":\"用户名或密码有误,请重试!\"}"); return; } model.Salt = Utils.GetLetterOrNumberRandom(10); model.LoginTime = DateTime.Now; model.LoginIP = RequestHelper.GetIP(); // 保存登录人的Sessin context.Session[Keys.SESSION_LoginUser] = model; context.Session.Timeout = 45; //写入登录日志 string operaAction = Enums.ActionEnum.Login.ToString(); string operaMemo = "用户登录"; BaseWeb.AddOpera(model, 0, operaAction, operaMemo); context.Response.Write("{\"status\":\"1\",\"msg\":\"权限获取成功!\",\"userName\":\"" + model.PerName + "\",\"loginSalt\":\"" + model.Salt + "\"}"); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"" + e.Message + "\"}"); } }
private void GetList(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { string IntentionCode = RequestHelper.GetString("IntentionCode").Trim(); string CustTypeId = RequestHelper.GetString("CustTypeId").Trim(); string CustName = RequestHelper.GetString("CustName").Trim(); string MachineModel = RequestHelper.GetString("MachineModel").Trim(); string MachineCode = RequestHelper.GetString("MachineCode").Trim(); string PayType = RequestHelper.GetString("PayType").Trim(); string ReceiveDate_Start = RequestHelper.GetString("ReceiveDate_Start").Trim(); string ReceiveDate_End = RequestHelper.GetString("ReceiveDate_End").Trim(); StringBuilder strWhere = new StringBuilder(); //-------------------------------------------------------------- Model.System.sys_LoginUser LoginUserModel = BaseWeb.GetLoginInfo(); if (LoginUserModel.IsAdmin == false) { strWhere.Append(" and a.OperaId in (select CtrlPerId from v_sys_PersonCtrl where PerId=" + LoginUserModel.ID + ") "); } //------------------------------------------------------------------------- //维修意向号 if (IntentionCode != "" && Utils.IsSafeSqlString(IntentionCode)) { strWhere.Append(" and b.IntentionCode like '%" + Utils.Filter(IntentionCode) + "%'"); } //客户类型 if (CustTypeId != "") { strWhere.Append(" and b.CustTypeId=" + Utils.StrToInt(CustTypeId, 0)); } //客户名 if (CustName != "" && Utils.IsSafeSqlString(CustName)) { strWhere.Append(" and b.CustName like '%" + Utils.Filter(CustName) + "%'"); } //机型 if (MachineModel != "") { strWhere.Append(" and c.MachineModel LIKE '%" + Utils.Filter(MachineModel) + "%' "); } //机号 if (MachineCode != "") { strWhere.Append(" and b.MachineCode like '%" + Utils.Filter(MachineCode) + "%'"); } //付款方式 if (PayType != "") { strWhere.Append(" and a.PayType=" + Utils.StrToInt(PayType, 0)); } //收款时间 if (ReceiveDate_Start != "") { strWhere.Append(" and a.ReceiveDate>=cast('" + Utils.StrToDateTime(ReceiveDate_Start).ToString() + "' as datetime)"); } if (ReceiveDate_End != "") { strWhere.Append(" and a.ReceiveDate<=cast('" + Utils.StrToDateTime(ReceiveDate_End + " 23:59:59").ToString() + "' as datetime) "); } SCZM.BLL.Repair.repair_ReceiveFee bll = new SCZM.BLL.Repair.repair_ReceiveFee(); DataTable dt = bll.GetList(strWhere.ToString()).Tables[0]; string rowsStr = Utils.ToJson(dt); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":" + rowsStr + "}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string ID = RequestHelper.GetString("ID"); string IntentionId = RequestHelper.GetString("IntentionId"); string PayType = RequestHelper.GetString("PayType"); string ReceiveFee = RequestHelper.GetString("ReceiveFee"); string ReceiveDate = RequestHelper.GetString("ReceiveDate"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.Model.Repair.repair_ReceiveFee model = new SCZM.Model.Repair.repair_ReceiveFee(); SCZM.BLL.Repair.repair_ReceiveFee bll = new SCZM.BLL.Repair.repair_ReceiveFee(); model.ID = Utils.StrToInt(ID, 0); model.IntentionId = Utils.StrToInt(IntentionId, 0); model.PayType = Utils.StrToInt(PayType, 0); model.ReceiveFee = Utils.StrToDecimal(ReceiveFee, 0); if (ReceiveDate != "") { model.ReceiveDate = Utils.StrToDateTime(ReceiveDate); } model.OperaDepId = loginUserModel.DepId; model.OperaId = loginUserModel.ID; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (ID == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增收款确认:" + model.ID; } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改收款确认:" + model.ID; } } if (status == "1") { //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }