/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { //判断类型是否还在使用 var mode = new BllSysAppointed().Exists(" Gid='" + id + "'"); if (mode == true) { msg.success = false; msg.msg = "此类别正在使用,暂不能删除."; } else { int result = new BllSysGroup().DeleteStatus(id); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "删除失败."; } LogInsert(OperationTypeEnum.操作, "类型删除操作", "删除操作成功."); } } catch (Exception ex) { LogInsert(OperationTypeEnum.异常, "类型删除操作", "删除操作异常消息:" + ex.Message.ToString()); } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { BllAdActive Master = new BllAdActive(); var Model = Master.LoadData(id); if (Model != null) { Model.Status = (int)StatusEnum.除; int result = Master.Update(Model); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } LogInsert(OperationTypeEnum.操作, "广告删除", "广告删除操作成功."); } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; LogInsert(OperationTypeEnum.异常, "广告删除", "操作异常信息:" + ex); } WriteJsonToPage(msg.ToString()); }
public void SaveData(ModSysCompanyPaySet t) { BllSysCompanyPaySet bll = new BllSysCompanyPaySet(); ModJsonResult json = new ModJsonResult(); t.CompanyID = CurrentMaster.Cid; if (!string.IsNullOrEmpty(Request["modify"])) //修改 { var model = bll.LoadData(t.Id); if (model != null) { t.Status = model.Status; } int result = bll.Update(t); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } else { t.Status = (int)StatusEnum.正常; t.Id = Guid.NewGuid().ToString(); int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } } WriteJsonToPage(json.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { BllSysDataBaseBack Back = new BllSysDataBaseBack(); var Model = Back.LoadData(id); if (Model != null) { Model.Status = (int)StatusEnum.删除; int result = Back.Update(Model); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// DisableUse /// </summary> public void DisableUse() { var msg = new ModJsonResult(); try { string key = Request["id"]; int result = new BllAdActive().UpdateStatus(0, key); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } LogInsert(OperationTypeEnum.操作, "广告禁用", "禁用操作成功."); } catch (Exception ex) { LogInsert(OperationTypeEnum.异常, "广告禁用", "操作异常信息:" + ex); } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 单位审核 /// </summary> public void CompanyWaitWork() { var msg = new ModJsonResult(); string key = Request["id"]; string Introduction = Request["Introduction"].ToString(); string Attr = Request["Attribute"].ToString();//类型 1:通过 2:不通过 var model = Bll.LoadData(key); try { BllSysFlow bllsyscompany = new BllSysFlow(); if (bllsyscompany.WaitWork(CurrentMaster.Id, CurrentMaster.Cid, Introduction, key, int.Parse(Attr))) { msg.success = true; //发送短信 WebService.SDKService msm = new WebService.SDKService(); } else { msg.success = false; msg.msg = "操作失败"; } LogInsert(OperationTypeEnum.访问, "待办任务", "审核操作成功."); WriteJsonToPage(msg.ToString()); } catch (Exception ex) { LogInsert(OperationTypeEnum.异常, "待办任务", "审核操作异常消息:" + ex.Message.ToString()); } }
/// <summary> /// 撤销社会单位申请 /// </summary> public void DeleteIndex(string id) { var msg = new ModJsonResult(); try { StringBuilder sb = new StringBuilder(); //撤销流程 sb.Append("delete from Sys_Flow where Id=(select FlowId from Sys_CompanyCognate where Id='" + id + "' );"); sb.AppendLine(); sb.Append("delete from Sys_CompanyCognate where Id='" + id + "';"); int result = Bll.ExecuteNonQueryByText(sb.ToString()); if (result <= 0) { msg.success = false; msg.msg = " 撤销失败,请稍后再操作!"; LogInsert(OperationTypeEnum.操作, "单位申请撤销", "撤销失败."); } else { LogInsert(OperationTypeEnum.操作, "单位申请撤销", "撤销成功."); msg.success = true; } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; LogInsert(OperationTypeEnum.异常, "单位申请撤销", "操作异常信息:" + ex); } WriteJsonToPage(msg.ToString()); }
public void SaveDeptListData() { ModJsonResult json = new ModJsonResult(); string NameList = Request["NameList"].ToString(); string CreateCompanyId = Request["CreateCompanyId"].ToString();//单位编号 string[] str = NameList.Split(','); StringBuilder sb = new StringBuilder(); for (int i = 0; i < str.Length; i++) { sb.Append("insert into Sys_Company(Id,Name,Level,Attribute,Status,CreateCompanyId)"); sb.Append(" values("); sb.Append("'" + Guid.NewGuid().ToString() + "',"); sb.Append("'" + str[i] + "',"); sb.Append("'" + 0 + "',"); sb.Append("'" + (int)CompanyType.部门 + "',"); sb.Append("'" + (int)StatusEnum.正常 + "',"); sb.Append("'" + CreateCompanyId + "'"); sb.Append(")"); sb.AppendLine(); } int result = bll.ExecuteNonQueryByText(sb.ToString()); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } WriteJsonToPage(json.ToString()); }
/// <summary> /// 文件重命名 /// </summary> public void ReName(string id) { var msg = new ModJsonResult(); try { BllSysFileAttach Back = new BllSysFileAttach(); var Model = Back.LoadData(id); if (Model != null) { Model.NameOld = Request["FileName"].ToString(); int result = Back.Update(Model); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
public void ChangeUser() { var msg = new ModJsonResult(); try { string UserId = Request["UserId"].ToString().Trim(); //当前人 string comResponsibleId = Request["comResponsibleId"].ToString(); //一键变更责任人. StringBuilder sb = new StringBuilder(); //设备信息 sb.Append("update Sys_Appointed set ResponsibleId='" + comResponsibleId + "' where ResponsibleId='" + UserId + "';"); sb.AppendLine(); //巡检记录 sb.Append("update Sys_AppointCheckNotes set ResponsibleId='" + comResponsibleId + "' where ResponsibleId='" + UserId + "';"); sb.AppendLine(); int result = new BllSysMaster().ExecuteNonQueryByText(sb.ToString()); msg.success = true; msg.msg = "操作成功"; } catch (Exception aa) { msg.success = false; msg.msg = "操作失败," + aa.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { int result = bll.DeleteStatus(id); if (result > 0) { msg.success = true; //清空用户部门信息 string sql = "update Sys_Master set OrganizaId='' where OrganizaId='" + id + "';"; bll.ExecuteNonQueryByText(sql); } else { msg.success = false; msg.msg = "操作失败"; } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 用户审核不通过 /// </summary> public void GTPAuditcancel() { BllSysMaster Bll = new BllSysMaster(); string Introduction = Request["Introduction"].ToString(); var msg = new ModJsonResult(); string key = Request["id"]; var model = Bll.LoadData(key); int result = Bll.Delete(key); if (result > 0) { msg.success = true; //发送短信 WebService.SDKService msm = new WebService.SDKService(); string sn = ConfigurationManager.AppSettings["sn"]; string pwd = ConfigurationManager.AppSettings["pwd"]; string smstext = "您在电梯宝申请的账户信息审核没有通过,原因:【" + Introduction + "】,请麻烦您尽快重新申请.为您审批通过."; result = msm.sendSMS(sn.Trim().ToString(), pwd.Trim().ToString(), "", model.LoginName.Split(new char[] { ',' }), smstext, "", "GBK", 3, Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmssfff"))); } else { msg.success = false; msg.msg = "操作失败"; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 用户审核通过 /// </summary> public void GTPAudit() { BllSysMaster Bll = new BllSysMaster(); var msg = new ModJsonResult(); string key = Request["id"]; var model = Bll.LoadData(key); int result = Bll.UpdateStatus(1, key); if (result > 0) { msg.success = true; //发送短信 WebService.SDKService msm = new WebService.SDKService(); string sn = ConfigurationManager.AppSettings["sn"]; string pwd = ConfigurationManager.AppSettings["pwd"]; string smstext = "亲,恭喜您,您在电梯宝申请的账户信息审核已通过,第一次使用,系统赠送您【" + model.Money.ToString("#0.00") + "】元保证金,赶紧登录电梯宝,体验一下吧."; result = msm.sendSMS(sn.Trim().ToString(), pwd.Trim().ToString(), "", model.LoginName.Split(new char[] { ',' }), smstext, "", "GBK", 3, Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmssfff"))); } else { msg.success = false; msg.msg = "操作失败"; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 保存选择 /// </summary> public void SaveSelect() { var msg = new ModJsonResult(); try { string checkid = Request["checkid"].ToString(); //获取选中的Id string CId = Request["CId"].ToString().Trim() == ""?CurrentMaster.Cid:Request["CId"].ToString(); //公司编号 StringBuilder sb = new StringBuilder(); sb.Append("delete from Sys_Group where ParentId !='0';"); sb.AppendLine(); sb.Append("insert into Sys_Group(Id,Name,ParentId,CompanyId,CreaterId) select newId() as Id,Name,Id as ParentId,'" + CId + "' as CompanyId,'" + CurrentMaster.Id + "' as CreaterId from Sys_Dirc where Id in(" + checkid + ")"); int result = new BllSysGroup().ExecuteNonQueryByText(sb.ToString()); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败."; } LogInsert(OperationTypeEnum.操作, "设备分类引用操作", "删除操作成功."); } catch (Exception ex) { LogInsert(OperationTypeEnum.异常, "设备分类引用操作", "删除操作异常消息:" + ex.Message.ToString()); } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { BllOrderUserMoneyRecord User = new BllOrderUserMoneyRecord(); var Model = User.LoadData(id); if (Model != null) { Model.Status = (int)StatusEnum.除; int result = User.Update(Model); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
public void SaveData(ModSysBtnValue t) { BllSysBtn bll = new BllSysBtn(); ModJsonResult json = new ModJsonResult(); if (!string.IsNullOrEmpty(Request["modify"])) //修改 { var model = bll.LoadData(t.Id); model.Name = t.Name; model.NameTip = t.NameTip; model.IConName = t.IConName; model.ActionName = t.ActionName; int result = bll.Update(model); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } else { t.Id = Guid.NewGuid().ToString(); t.Status = (int)StatusEnum.正常; int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } } WriteJsonToPage(json.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { //判断岗位下是否还存在员工 var mode = new BllSysMaster().Exists(" OrganizaId=" + id); if (mode == true) { msg.success = false; msg.msg = "此岗位下还有员工,暂不能删除."; } else { if (bll.DeleteStatus(id) > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 已过期的数量(红色),异常状态设备数量(黄色),半年内即将过期的数量(蓝色),其他正常数量(绿色) /// </summary> public void ChartPart() { BllSysAppointed Bll = new BllSysAppointed(); var msg = new ModJsonResult(); List <Hashtable> info = new List <Hashtable>(); try { string CompanyId = Request["CompanyId"].ToString() == "" ? CurrentMaster.Cid : Request["CompanyId"].ToString(); DataSet ds = Bll.ChartAppointed(CompanyId); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Hashtable table = new Hashtable(); table.Add("已过期数量", ds.Tables[0].Rows[i]["Count1"].ToString()); table.Add("异常状态设备量", ds.Tables[0].Rows[i]["Count2"].ToString()); table.Add("半年内即将过期数量", ds.Tables[0].Rows[i]["Count3"].ToString()); table.Add("正常数量", ds.Tables[0].Rows[i]["Count4"].ToString()); info.Add(table); } } msg.data = JsonHelper.ToJson(info); LogInsert(OperationTypeEnum.访问, "设备统计模块", "访问页面成功."); } catch (Exception ex) { LogInsert(OperationTypeEnum.异常, "设备统计模块", "查询列表错误消息:" + ex.Message.ToString()); } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 保存上级单位选择的社会单位信息 /// </summary> /// <param name="mod"></param> public void SaveParentIndex() { ModJsonResult json = new ModJsonResult(); try { string[] IdList = Request["IdList"].ToString().Split(','); if (IdList.Length > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < IdList.Length; i++) { string FlowId = Guid.NewGuid().ToString(); sb.Append(" insert into Sys_CompanyCognate(Id,EmployerId,CId,Status,FlowId,SelectType)"); sb.Append(" values("); sb.Append("'" + Guid.NewGuid().ToString() + "',"); sb.Append("'" + IdList[i] + "',"); //社会单位编号 sb.Append("'" + CurrentMaster.Cid + "',"); //上级单位编号 sb.Append("'0',"); sb.Append("'" + FlowId + "',"); sb.Append("'2'"); sb.Append(");"); sb.AppendLine(); //添加流程审核模块 sb.Append("insert into Sys_Flow(Id,Title,FlowType,FlowStatus,Reamrk,ApprovalUser,ApprovalTime,CompanyId,MasterId)"); sb.Append(" values("); sb.Append("'" + FlowId + "',"); sb.Append("'" + CurrentMaster.Company.Name + "向您提交查看单位信息申请',"); sb.Append("'" + 3 + "',");//(1:单位管理员注册时的审核 2:普通用户注册审核 3:用户单位变更审核) sb.Append("'" + 0 + "',"); sb.Append("'',"); sb.Append("'" + CurrentMaster.Id + "',"); sb.Append("'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"); sb.Append("'" + IdList[i] + "',");//审核单位编号 sb.Append("'" + CurrentMaster.Id + "'"); sb.Append(")"); sb.AppendLine(); } int result = Bll.ExecuteNonQueryByText(sb.ToString()); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; LogInsert(OperationTypeEnum.操作, "保存单位关联", "保存失败."); } else { LogInsert(OperationTypeEnum.操作, "保存单位关联", "保存成功."); } } } catch (Exception ex) { json.msg = "保存失败!"; json.success = false; LogInsert(OperationTypeEnum.异常, "保存单位关联", "操作异常信息:" + ex); } WriteJsonToPage(json.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { string sql = "update Sys_QRCode set Status=" + (int)StatusEnum.除 + " where Id in(" + id + ")"; if (new BllSysQRCode().ExecuteNonQueryByText(sql) > 0) //int result = new BllSysQRCode().DeleteStatus(id); { LogInsert(OperationTypeEnum.操作, "二维码删除", "操作成功."); msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; LogInsert(OperationTypeEnum.操作, "二维码删除", "操作失败."); } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; LogInsert(OperationTypeEnum.异常, "二维码删除", "操作异常信息:" + ex); } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 数据还原 Rollback /// </summary> public void Rollback(string id) { var msg = new ModJsonResult(); try { BllSysDataBaseBack Bll = new BllSysDataBaseBack(); var Model = Bll.LoadData(id); if (Model != null) { int result = Bll.Rollback(Model.LinkUrl); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 禁用状态 /// </summary> public void EnableUse() { var msg = new ModJsonResult(); if (CurrentMaster != null) { if (CurrentMaster.Id == Request["LoginUserId"].ToString()) { string key = Request["id"]; int result = new BllAdActive().UpdateStatus(1, key); if (result > 0) { msg.success = true; LogInsert(OperationTypeEnum.操作, "新闻公告", CurrentMaster.UserName + "公告启用操作成功."); } else { msg.success = false; msg.msg = "操作失败"; LogInsert(OperationTypeEnum.异常, "新闻公告", CurrentMaster.UserName + "公告启用操作,操作失败."); } } else { msg.success = false; msg.msg = "用户信息已失效,请刷新或登陆."; } } else { msg.success = false; msg.msg = "用户信息已过期,请重新登陆."; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { //判断类型是否还在使用 var mode = new BllAdActive().Exists(" ActionFormId='" + id + "'"); if (mode == true) { msg.success = false; msg.msg = "此类别正在使用,暂不能删除."; } else { int result = new BllSysGroup().DeleteStatus(id); if (result > 0) { msg.success = true; LogInsert(OperationTypeEnum.操作, "公告类别", CurrentMaster.UserName + "删除类别成功."); } else { msg.success = false; msg.msg = "删除失败."; } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { //判断类型是否还在使用 var mode = new BllSysAppointed().Exists(" Places in(" + id + ")"); if (mode == true) { msg.success = false; msg.msg = "此地址正在使用,暂不能删除."; } else { if (new BllFireBox().DeleteStatus(id) > 0) { LogInsert(OperationTypeEnum.操作, "设备位置删除", "操作成功."); msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; LogInsert(OperationTypeEnum.操作, "设备位置删除", "操作失败."); } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; LogInsert(OperationTypeEnum.异常, "设备位置删除", "操作异常信息:" + ex); } WriteJsonToPage(msg.ToString()); }
public void SaveModelData(ModSysModel mod) { BllSysModel Bll = new BllSysModel(); ModJsonResult json = new ModJsonResult(); if (!string.IsNullOrEmpty(Request["modify"])) //修改 { ModSysModel modLod = Bll.LoadData(mod.Id); modLod.ModelName = mod.ModelName; modLod.Sort = mod.Sort; modLod.Remark = mod.Remark; int result = Bll.Update(modLod); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } else { mod.CreateTime = DateTime.Now; mod.CompanyId = CurrentMaster.Cid; mod.Id = Guid.NewGuid().ToString(); mod.Status = (int)StatusEnum.正常; int result = Bll.Insert(mod); if (result <= 0) { json.success = false; json.msg = "新增失败,请稍后再操作!"; } } WriteJsonToPage(json.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { int result = new BllSysRole().DeleteRoleInMaster(id); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } LogInsert(OperationTypeEnum.操作, "角色配置", CurrentMaster.UserName + "角色配置删除操作正常."); } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; LogInsert(OperationTypeEnum.异常, "角色配置", CurrentMaster.UserName + "角色配置删除操作异常." + msg.msg); } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { string sql = "update Sys_Company set Status=" + (int)StatusEnum.除 + " where Id in(" + id + ")"; if (bll.ExecuteNonQueryByText(sql) > 0) { msg.success = true; LogInsert(OperationTypeEnum.操作, "供应商删除", "供应商删除成功."); } else { msg.success = false; msg.msg = "操作失败"; LogInsert(OperationTypeEnum.操作, "供应商删除", "供应商删除失败."); } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
public void SaveData(ModSysDirc t) { BllSysDirc bll = new BllSysDirc(); ModJsonResult json = new ModJsonResult(); if (!string.IsNullOrEmpty(Request["modify"])) //修改 { var model = bll.LoadData(t.Id); model.Name = t.Name; model.OrderNum = t.OrderNum; //判断名称是否存在 int count = 0; bool flag = bll.Exists("Sys_Group", " and CompanyId='" + t.CompanyId + "' and Name='" + t.Name + "' and Type=" + t.Type + " and Id<>'" + t.Id + "' and Status!=" + (int)StatusEnum.除, out count); if (flag) { json.success = false; json.msg = " 保存失败,该名称已经存在!"; } else { int result = bll.Update(model); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } } else { //判断名称是否存在 int count = 0; bool flag = bll.Exists("Sys_Dirc", " and Name='" + t.Name + "' and Type=" + t.Type + " and Status!=" + (int)StatusEnum.除, out count); if (flag) { json.success = false; json.msg = " 保存失败,该名称已经存在!"; } else { t.Id = Guid.NewGuid().ToString(); t.Status = (int)StatusEnum.正常; t.CreaterId = CurrentMaster.Id; t.CreateTime = DateTime.Now; t.CompanyId = CurrentMaster.Cid; t.ParentId = "0"; t.Type = int.Parse(Request["Type"]); int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } } } WriteJsonToPage(json.ToString()); }
/// <summary> /// 保存模块功能分配 /// </summary> /// <param name="jsonStr"></param> /// <param name="key"></param> public void SaveRoles() { try { string jsonStr = Request["json"]; string key = Request["key"]; BllSysRoleFun bll = new BllSysRoleFun(); //保存用户角色菜单信息 string[] _str = jsonStr.Split(','); StringBuilder sb = new StringBuilder(); for (int i = 0; i < _str.Length; i++) { string[] str = _str[i].Split('|'); string funId = ""; string btnId = ""; if (str.Length > 1) //存在按钮 { funId = str[1]; btnId = str[0]; } else if (str.Length == 1) //模块链接没有按钮 { funId = str[0]; } var model = new ModSysRoleFun() { Id = Guid.NewGuid().ToString(), RoleId = key, FunId = funId, BtnId = btnId, UniteId = _str[i], //组合键 CreaterId = CurrentMaster.Id, CreaterName = CurrentMaster.UserName, CId = CurrentMaster.Cid }; sb.Append(bll.InsertRole(model)); sb.AppendLine(); } if (bll.InsertRoleByRoleId(key, sb.ToString()) > 0) { json.success = true; SearchClidRole(key); } else { json.success = false; } } catch (Exception ex) { json.success = false; json.msg = ex.Message; } WriteJsonToPage(json.ToString()); }
/// <summary> /// 数据备份 Back /// </summary> public void Back() { var msg = new ModJsonResult(); try { BllSysDataBaseBack Bll = new BllSysDataBaseBack(); string dbFileName =DateTime.Now.ToString("yyyyMMddHHmmss")+".bak"; string path = Server.MapPath("/UploadFile/DataBase"); new FileHelper().CreateDirectory(path); path = path+"//"+dbFileName; int result = Bll.BackDataBase(path); if (result > 0) { //判断文件是否存在 if (System.IO.File.Exists(path)) { //计算文件大小 System.IO.FileInfo objFI = new System.IO.FileInfo(path); string length =new FileHelper().CountSize(objFI.Length); //保存数据库 ModSysDataBaseBack model = new ModSysDataBaseBack(); model.Id = Guid.NewGuid().ToString(); model.LinkUrl = path; model.CreaterId = CurrentMaster.Id; model.CreateTime = DateTime.Now; model.Size =length; model.Status = (int)StatusEnum.正常; model.Remark = dbFileName; if (Bll.Insert(model) > 0) { msg.success = true; msg.msg = "备份成功"; } else { msg.success = false; msg.msg = "备份失败"; //删除备份文件 } } else { msg.success = false; msg.msg = "备份失败"; } } else { msg.success = false; msg.msg = "操作失败"; } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }