public void ReSetPwd() { var json = new ModJsonResult(); try { string id = Request["id"]; string pwd = DESEncrypt.Encrypt("666666"); int result = new BllSysMaster().ReSetPwd(id, pwd); if (result <= 0) { json.success = false; json.msg = "重置失败!"; } else { json.success = true; json.msg = "重置成功!"; } } catch (Exception ex) { json.success = false; json.msg = "操作失败!" + ex.Message; } Response.Write(new JavaScriptSerializer().Serialize(json).ToString()); Response.End(); }
public JsonResult GetCompanyByFlow(string Id) { var FlowModel = Bll.LoadData(Id); var companyModel = new ModSysCompany(); var MasterModel = new ModSysMaster(); if (FlowModel.FlowType != 3) { companyModel = new BllSysCompany().LoadData(FlowModel.CompanyId); MasterModel = new BllSysMaster().Get(FlowModel.MasterId); } else { MasterModel = new BllSysMaster().Get(FlowModel.ApprovalUser);//申请人编号 companyModel = new BllSysCompany().LoadData(MasterModel.Cid); } Hashtable ht = new Hashtable(); ht.Add("Introduction", FlowModel.Reamrk); //公司信息 if (companyModel != null) { ht.Add("Name", companyModel.Name); //公司名称 ht.Add("Address", companyModel.Address); //地址 ht.Add("LinkUser", companyModel.LinkUser); //联系 人 ht.Add("Phone", companyModel.Phone); //联系电话 ht.Add("Attribute", companyModel.Attribute); } if (MasterModel != null) { ht.Add("LoginName", MasterModel.LoginName); } return(Json(new { data = ht }, JsonRequestBehavior.AllowGet)); }
/// <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 SearchDataByCompany() { var search = base.GetSearch(); switch (CurrentMaster.Attribute) { case (int)AdminTypeEnum.消防部门管理员: search.AddCondition("Attribute=" + (int)AdminTypeEnum.消防用户); break; case (int)AdminTypeEnum.维保公司管理员: search.AddCondition("Attribute=" + (int)AdminTypeEnum.维保用户); break; case (int)AdminTypeEnum.供应商管理员: search.AddCondition("Attribute=" + (int)AdminTypeEnum.供应商用户); break; } if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterId='" + CurrentMaster.Id + "'"); } } var jsonResult = new BllSysMaster().SearchDataByCompany(search); WriteJsonToPage(jsonResult); }
/// <summary> /// 功能权限控制 /// </summary> public void funTree() { if (CurrentMaster != null) { string _typeId = Request["TypeID"]; _key = Request["key"]; string output; DataTable mytab; string name = (Request["TreeName"] == null ? "" : Request["TreeName"]); //查询过滤条件 if (CurrentMaster.Attribute != (int)AdminTypeEnum.普通员工) //超级管理员 { string where = ""; if (name != "") { where += " FunName like '%" + name + "%' and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; } else { where += " TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; } mytab = new BllSysFun().GetTreeList(where).Tables[0]; //获取所有树 } else { BllSysMaster mybase = new BllSysMaster(); _where += (name == "" ? " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常 : " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常 + " and FunName like '%" + name + "%'"); mytab = mybase.GetAuthByPage(CurrentMaster.RoleIdList, _where).Tables[0]; } GetTreeNode(mytab);//功能权限 } Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); }
/// <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 SearchData() { var search = base.GetSearch(); string OrganizaId = Request["OrganizaId"]; if (!string.IsNullOrEmpty(OrganizaId) && OrganizaId != "-1") { search.AddCondition("(OrganizaId='" + OrganizaId + "' or OrganizaId='' or OrganizaId in (select Id from GetCompanyByChildId('" + OrganizaId + "',1)))"); } else { //根据权限 if (CurrentMaster.Attribute == (int)AdminTypeEnum.系统管理员) { } else if (CurrentMaster.Attribute == (int)AdminTypeEnum.单位管理员 || CurrentMaster.Attribute == (int)AdminTypeEnum.供应商管理员 || CurrentMaster.Attribute == (int)AdminTypeEnum.维保公司管理员 || CurrentMaster.Attribute == (int)AdminTypeEnum.消防部门管理员) { //查看自己单位下人员的审核 search.AddCondition("Cid='" + CurrentMaster.Cid + "'"); } } search.AddCondition("(Attribute>=" + (int)AdminTypeEnum.单位用户 + " and Attribute<=" + (int)AdminTypeEnum.供应商用户 + ")"); search.AddCondition("(Status!=" + (int)StatusEnum.除 + " and Status!=-2)"); //过滤条件 if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterId='" + CurrentMaster.Id + "'"); } } var jsonResult = new BllSysMaster().SearchData(search); WriteJsonToPage(jsonResult); }
/// <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()); }
public void GetTreeByMaster() { string Attribute = Request["Attribute"]; //1:业务员 2:学生 string selectUserkey = (Request["select"] == null ? "" : Request["select"]); //选中的人员编号 if (Attribute == "6") { string where = " Cid='" + CurrentMaster.Company.Id + "' and IsSystem!=1 and Attribute=" + Attribute; string name = (Request["MasterName"] == null ? "" : Request["MasterName"]); //查询过滤条件 if (name != "") { where += " and UserName like '%" + name + "%'"; } DataTable mytab = new BllSysMaster().GetTreeList(where).Tables[0]; //获取所有树 GetTreeNode(mytab, selectUserkey); Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); } else { //查询班级 string where = " Type=1 and Status=" + (int)StatusEnum.正常; DataTable mytab = new BllSysGroup().GetTreeList(where).Tables[0]; //获取所有树 string userwhere = " Cid='" + CurrentMaster.Company.Id + "' and IsSystem!=1 and Attribute=" + Attribute; DataTable usermytab = new BllSysMaster().GetTreeList(userwhere).Tables[0]; //获取所有树 GetClassNode(mytab, usermytab, selectUserkey); Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); } }
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> /// <param name="childId"></param> /// <param name="master">登录用户对象</param> public void InitRoleTree(string childId, ModSysMaster master) { string output = ""; string _where = "1=1"; //获取 try { BllSysMaster mybase = new BllSysMaster(); string name = (Request["name"] == null ? "" : Request["name"]); //查询过滤条件 _where += (name == "" ? " and Status=" + (int)StatusEnum.正常 : " and Status=" + (int)StatusEnum.正常 + " and FunName like '%" + name + "%'"); if (!String.IsNullOrEmpty(master.RoleIdList)) { DataSet _mySet = mybase.GetAuthByPage(master.RoleIdList, _where); if (_mySet.Tables.Count > 0) { if (name == "") { output = JsonHelper.ToJson(new FunTreeCommon().GetFunTreeNodes(_mySet)); } else { output = JsonHelper.ToJson(new FunTreeCommon().GetSearchTreeNodes(_mySet)); } } else { var msg = new ModJsonResult(); msg.success = false; msg.msg = "您暂未有访问权限"; output = JsonHelper.ToJson(msg); } } else { var msg = new ModJsonResult(); msg.success = false; msg.msg = "您暂未有访问权限"; output = JsonHelper.ToJson(msg); } } catch { var msg = new ModJsonResult(); msg.success = false; output = JsonHelper.ToJson(msg); } Response.Write(output); Response.End(); }
public JsonResult MasterInfo(string cid) { var company = new BllSysCompany().LoadData(cid); ModSysMaster mod = new BllSysMaster().LoadData(company.MasterId); if (mod != null) { mod.Pwd = DESEncrypt.Decrypt(mod.Pwd); } return(Json(new { data = mod }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取页面按钮权限 /// </summary> public void GetRoleBtn() { var msg = new ModJsonResult(); if (CurrentMaster != null) { string pageAction = Request["PageAction"]; //超级管理员不用控权 if (CurrentMaster.IsMain) { DataSet ds = new BllSysMaster().GetPageBtns(pageAction, CurrentMaster.Attribute); if (ds.Tables.Count == 0) { msg.msg = "{}"; } else { if (ds.Tables[0].Rows.Count > 0) { msg.msg = JsonHelper.DataTableToJson(ds.Tables[0]); } else { msg.success = false; } } } else { DataSet ds = new BllSysMaster().GetAuthByBtn(pageAction, CurrentMaster.RoleIdList, CurrentMaster.Attribute); if (ds.Tables.Count == 0) { msg.msg = "{}"; } else { if (ds.Tables[0].Rows.Count > 0) { msg.msg = JsonHelper.DataTableToJson(ds.Tables[0]); } else { msg.success = false; } } } } else { msg.success = false; msg.errorCode = (int)SystemError.用户过期错误; } WriteJsonToPage(JsonHelper.ToJson(msg)); }
/// <summary> /// 页面列表 /// </summary> public void SearchMasterGrid() { var search = base.GetSearch(); //查询自己所属公司 search.AddCondition("Cid='" + CurrentMaster.Cid + "'"); search.AddCondition("Attribute=" + (int)AdminTypeEnum.普通员工); search.AddCondition("Status=" + (int)StatusEnum.正常); //过滤条件 var jsonResult = new BllSysMaster().SearchMasterGrid(search); WriteJsonToPage(jsonResult); }
public void UpdatePwd() { var json = new ModJsonResult(); try { string oldpwd = Request["oldpwd"]; string newpwd = Request["newpwd"]; string newpwd2 = Request["newpwd2"]; var CurrentMaster = new MasterContext().Master; if (DESEncrypt.Decrypt(CurrentMaster.Pwd) == oldpwd.Trim()) { BllSysMaster bll = new BllSysMaster(); if (DESEncrypt.Decrypt(CurrentMaster.Pwd) == newpwd) { json.success = false; json.msg = "修改密码不能和原密码相同!"; } else { string pwd = DESEncrypt.Encrypt(newpwd); int result = bll.upPwd(CurrentMaster.Id, pwd); if (result <= 0) { json.success = false; json.msg = "密码修改失败!"; } else { json.success = true; json.msg = "修改成功!"; CurrentMaster.Pwd = pwd; //重新赋值密码 } } } else { json.success = false; json.msg = "原密码输入错误!"; } } catch (Exception ex) { json.success = false; json.msg = "操作失败!" + ex.Message; } Response.Write(new JavaScriptSerializer().Serialize(json).ToString()); Response.End(); }
public void SaveParentData(ModSysMaster t) { BllSysMaster bll = new BllSysMaster(); ModJsonResult json = new ModJsonResult(); string HPact = Request["HPact"] == null ? "" : Request["HPact"];//用户上传头像 t.Pwd = (string.IsNullOrEmpty(t.Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(t.Pwd.Trim())); t.LoginName = t.LoginName.Trim(); t.UserName = t.UserName.Trim(); switch (CurrentMaster.Attribute) { case (int)AdminTypeEnum.消防部门管理员: t.Attribute = (int)AdminTypeEnum.消防用户; break; case (int)AdminTypeEnum.维保公司管理员: t.Attribute = (int)AdminTypeEnum.维保用户; break; case (int)AdminTypeEnum.供应商管理员: t.Attribute = (int)AdminTypeEnum.供应商用户; break; } t.Id = Guid.NewGuid().ToString(); t.Status = (int)StatusEnum.正常; t.Cid = CurrentMaster.Cid; t.OrganizaId = "0";//部门编号 t.IsSystem = false; t.CreaterId = CurrentMaster.Id; t.CreateTime = DateTime.Now; t.HeadImg = HPact; t.IsMain = true; t.CardNum = t.OperateNum; int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } new BllSysMaster().ClearCache(); WriteJsonToPage(json.ToString()); }
/// <summary> /// DisableUse /// </summary> public void DisableUse() { var msg = new ModJsonResult(); string key = Request["id"]; int result = new BllSysMaster().UpdateStatus(0, key); if (result > 0) { msg.success = true; } else { msg.success = false; msg.msg = "操作失败"; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 页面列表 /// </summary> public void SearchAuditData() { var search = base.GetSearch(); //查询自己所属公司 search.AddCondition("Cid='" + CurrentMaster.Cid + "'"); search.AddCondition("Attribute=" + (int)AdminTypeEnum.普通员工); search.AddCondition("Status=-2"); //过滤条件 if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterId='" + CurrentMaster.Id + "'"); } } var jsonResult = new BllSysMaster().SearchData(search); WriteJsonToPage(jsonResult); }
public void GetSysMaster() { string CompanyId = Request["CompanyId"].ToString().Trim(); // string UserId = Request["UserId"]; //一键变更责任人 if (string.IsNullOrEmpty(CompanyId) || CompanyId == "0") { CompanyId = CurrentMaster.Cid; } if (string.IsNullOrEmpty(UserId)) { List <ModSysMaster> list = new BllSysMaster().QueryToAll().Where(p => p.Cid == CompanyId && p.Attribute == (int)AdminTypeEnum.单位用户 && p.Status == (int)StatusEnum.正常).ToList(); WriteJsonToPage(JsonHelper.ToJson(list)); } else { List <ModSysMaster> list = new BllSysMaster().QueryToAll().Where(p => p.Cid == CompanyId && p.Attribute == (int)AdminTypeEnum.单位用户 && p.Status == (int)StatusEnum.正常 && p.Id != UserId).ToList(); WriteJsonToPage(JsonHelper.ToJson(list)); } }
/// <summary> /// 页面列表 /// </summary> public void SearchData() { var search = base.GetSearch(); //查询自己所属公司 search.AddCondition("Cid='" + CurrentMaster.Cid + "'"); search.AddCondition("IsSystem!=" + (int)YesOrNoEnum.是);//是否是系统登录员 search.AddCondition("Attribute=" + CurrentMaster.Attribute); if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterId='" + CurrentMaster.Id + "'"); } } var jsonResult = new BllSysMaster().SearchData(search); WriteJsonToPage(jsonResult); }
/// <summary> /// 删除 /// </summary> public void DeleteData(string id) { var msg = new ModJsonResult(); try { //判断类型是否还在使用 var mode = new BllSysAppointed().Exists(" ResponsibleId='" + id + "'"); if (mode == true) { msg.success = false; msg.msg = "该用户下还存在管理的设备,请先更改设备责任人再删除."; } else { BllSysMaster Master = new BllSysMaster(); 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 = "操作失败"; } } } } catch (Exception ex) { msg.msg = "操作失败:" + ex.Message; } WriteJsonToPage(msg.ToString()); }
/// <summary> /// 页面列表 /// </summary> public void SearchData() { var search = base.GetSearch(); //查询自己所属公司 search.AddCondition("Cid='" + CurrentMaster.Cid + "'"); search.AddCondition("IsSystem!=" + (int)YesOrNoEnum.是);//是否是系统登录员 search.AddCondition("Attribute=" + (int)AdminTypeEnum.系统管理员); search.AddCondition("Status!=" + (int)StatusEnum.除); if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterId='" + CurrentMaster.Id + "'"); } } var jsonResult = new BllSysMaster().SearchData(search); LogInsert(OperationTypeEnum.访问, "人员管理", CurrentMaster.UserName + "页面访问正常."); WriteJsonToPage(jsonResult); }
/// <summary> /// 范围权限控制 /// </summary> public void roleTree() { if (CurrentMaster != null) { string _typeId = Request["TypeID"]; _key = Request["key"]; string output; DataTable mytab; BllSysMaster mybase = new BllSysMaster(); _where += " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; DataSet ds = mybase.GetAuthByPage("'" + _key + "'", _where); if (ds.Tables.Count > 0) { mytab = ds.Tables[0]; GetRoleTreeNode(mytab); } else { WriteJsonToPage(Output); return; } } Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); }
/// <summary> /// 查看他人权限设置 /// </summary> public void GetOtherfunTree() { if (CurrentMaster != null) { string _typeId = Request["TypeID"]; _key = Request["key"]; string output; DataTable mytab = null; BllSysMaster mybase = new BllSysMaster(); //查询角色创建人 BllSysRole role = new BllSysRole(); var roleInfo = role.LoadData(_key); var other = mybase.LoadData(roleInfo.CreaterId); //角色用户 if (other.Attribute != (int)AdminTypeEnum.普通员工) //超级管理员,不用控权 { _where += " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常; mytab = new BllSysFun().GetTreeList(_where).Tables[0]; //获取所有树 } else { string roleIdList = new BllSysMasterRole().GetMasterRole(other.Id); if (!String.IsNullOrEmpty(roleIdList)) { _where += " and TypeID=" + _typeId + "and Status=" + (int)StatusEnum.正常; mytab = mybase.GetAuthByPage(roleIdList, _where).Tables[0]; } else { WriteJsonToPage(Output); return; } } GetTreeNode(mytab);//功能权限 } Output = Output.Replace("check", "checked"); WriteJsonToPage(Output); }
public void SaveData(ModSysCompany mod) { try { ModSysMaster master = new ModSysMaster(); #region ===获取管理员信息 string UserName = Request.Params["UserName"]; string LoginName = Request.Params["LoginName"]; string Pwd = Request.Params["Pwd"]; string UserEmail = Request.Params["UserEmail"]; string UserPhone = Request.Params["UserPhone"]; Pwd = (string.IsNullOrEmpty(Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(Pwd)); #endregion mod.CompLat = (mod.CompLat == null ? "" : mod.CompLat); mod.ComPLon = (mod.ComPLon == null ? "" : mod.ComPLon); int result = 0; if (!string.IsNullOrEmpty(Request["modify"])) //修改 { ModSysCompany model = bll.LoadData(mod.Id); model.Name = mod.Name; //公司名称 model.LegalPerson = mod.LegalPerson; model.LinkUser = mod.LinkUser; //联系人 model.Address = mod.Address; //公司地址 model.Code = mod.Code; model.ReegistMoney = mod.ReegistMoney; //注册资金 model.Phone = mod.Phone; //公司电话 model.Email = mod.Email; //邮箱 model.Introduction = mod.Introduction; //公司介绍 model.CompLat = mod.CompLat; model.ComPLon = mod.ComPLon; model.Nature = mod.Nature; //公司分类 model.Type = mod.Type; //公司性质 model.LegalPerson = mod.LegalPerson; //法人 model.Pact = mod.Pact; //合同 model.LicenseNumber = mod.LicenseNumber; model.Province = mod.Province; model.CityId = mod.CityId; model.AreaId = mod.AreaId; result = bll.Update(model); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } else { BllSysMaster newMaster = new BllSysMaster(); master = newMaster.LoadData(Request.Params["UID"]); master.UserName = UserName; master.LoginName = LoginName; master.Email = UserEmail; master.Phone = UserPhone; master.Id = Request.Params["UID"]; master.Pwd = Pwd; newMaster.Update(master); } } else { mod.Id = Guid.NewGuid().ToString(); master.Pwd = Pwd; master.Id = Guid.NewGuid().ToString(); master.Status = (int)StatusEnum.正常; master.IsMain = true; master.Cid = mod.Id; master.IsSystem = true; master.CreaterId = CurrentMaster.Id; master.UserName = UserName; master.LoginName = LoginName; master.Email = UserEmail; master.Phone = UserPhone; master.OrganizaId = "0"; master.Attribute = (int)AdminTypeEnum.供应商管理员; new BllSysMaster().ClearCache(); result = new BllSysMaster().Insert(master); if (result > 0) { mod.Attribute = (int)CompanyType.供应商; mod.CreateCompanyId = CurrentMaster.Cid; mod.CreateTime = DateTime.Now; mod.CreaterUserId = CurrentMaster.Id; mod.Status = (int)StatusEnum.正常; mod.Path = "1," + CurrentMaster.Company.CreateCompanyId + "," + CurrentMaster.Cid; mod.ProPic = "/UploadFile/CompanyProPic/default_img_company.png"; mod.MasterId = master.Id; result = bll.Insert(mod); if (result <= 0) { new BllSysMaster().Delete(master.Id); } } if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } } } catch (Exception) { json.msg = "保存失败!"; json.success = false; } WriteJsonToPage(json.ToString()); }
public void SaveData(ModSysCompany t) { ModJsonResult json = new ModJsonResult(); ModSysMaster master = new ModSysMaster(); #region ===获取管理员信息 string UserName = Request.Params["UserName"]; string LoginName = Request.Params["LoginName"]; string Pwd = Request.Params["Pwd"]; string UserEmail = Request.Params["UserEmail"]; string UserPhone = Request.Params["UserPhone"]; Pwd = (string.IsNullOrEmpty(Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(Pwd)); #endregion t.LinkUser = (t.LinkUser == null ? "" : t.LinkUser); t.LegalPerson = (t.LegalPerson == null ? "" : t.LegalPerson); t.CompLat = (t.CompLat == null ? "" : t.CompLat); t.ComPLon = (t.ComPLon == null ? "" : t.ComPLon); string x = Request.Params["x"]; string y = Request.Params["y"]; if (!string.IsNullOrEmpty(Request["modify"])) //修改 { ModSysCompany model = bll.LoadData(t.Id); model.Name = t.Name; model.LegalPerson = t.LegalPerson; model.LinkUser = t.LinkUser; model.Address = t.Address; model.CompLat = t.CompLat; model.ComPLon = t.ComPLon; model.Code = t.Code; model.ReegistMoney = t.ReegistMoney; model.Phone = t.Phone; model.Email = t.Email; model.Introduction = t.Introduction; model.LawyerPhone = t.LawyerPhone; model.LawyerName = t.LawyerName; model.CompLat = t.CompLat; model.ComPLon = t.ComPLon; model.Province = t.Province; model.CityId = t.CityId; model.AreaId = t.AreaId; model.Nature = t.Nature; //公司分类 model.Type = t.Type; //公司性质 model.RegisiTime = t.RegisiTime; int result = bll.Update(model); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } else { BllSysMaster newMaster = new BllSysMaster(); master = newMaster.LoadData(Request.Params["UID"]); master.UserName = UserName; master.Pwd = Pwd; master.LoginName = LoginName; master.Email = UserEmail; master.Phone = UserPhone; master.Id = Request.Params["UID"]; newMaster.Update(master); } } else { t.Id = Guid.NewGuid().ToString(); master.Id = Guid.NewGuid().ToString(); master.Status = (int)StatusEnum.正常; master.IsMain = true; master.Cid = t.Id; master.IsSystem = true; master.Pwd = Pwd; master.CreaterId = CurrentMaster.Id; master.UserName = UserName; master.LoginName = LoginName; master.Email = UserEmail; master.Phone = UserPhone; master.OrganizaId = "0"; master.Attribute = (int)AdminTypeEnum.单位管理员; new BllSysMaster().ClearCache(); int result = new BllSysMaster().Insert(master); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } else { t.Status = (int)StatusEnum.正常; t.CreaterUserId = CurrentMaster.Id; t.CreateTime = DateTime.Now; t.Attribute = (int)CompanyType.单位; t.Path = "1," + CurrentMaster.Cid; t.ProPic = "/UploadFile/CompanyProPic/default_img_company.png"; t.MasterId = master.Id; t.CreateCompanyId = "0"; t.RegisiTime = DateTime.Now;//公司注册时间 result = bll.Insert(t); if (result <= 0) { new BllSysMaster().Delete(master.Id); } } } WriteJsonToPage(json.ToString()); }
public void SaveData(ModSysMaster t) { BllSysMaster bll = new BllSysMaster(); ModJsonResult json = new ModJsonResult(); string HPact = Request["HPact"] == null ? "" : Request["HPact"];//用户上传头像 t.Pwd = (string.IsNullOrEmpty(t.Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(t.Pwd.Trim())); t.LoginName = t.LoginName.Trim(); t.UserName = t.UserName.Trim(); if (!string.IsNullOrEmpty(Request["modify"])) //修改 { t.HeadImg = HPact; var model = bll.LoadData(t.Id); model.Pwd = t.Pwd; model.LoginName = t.LoginName; model.UserName = t.UserName; model.HeadImg = HPact; int result = bll.UpdateDate(t); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } else { string OrganizaId = Request["OrganizaId"].ToString();//部门编号 //根据部门编号查询单位信息 var company = new BllSysCompany().LoadData(OrganizaId); if (company.Attribute == (int)CompanyType.单位 || company.Attribute == (int)CompanyType.部门) { t.Attribute = (int)AdminTypeEnum.单位用户;//用户类型 } else if (company.Attribute == (int)CompanyType.供应商) { t.Attribute = (int)AdminTypeEnum.供应商用户; } else if (company.Attribute == (int)CompanyType.维保公司) { t.Attribute = (int)AdminTypeEnum.维保用户; } else if (company.Attribute == (int)CompanyType.消防部门) { t.Attribute = (int)AdminTypeEnum.消防用户; } t.Id = Guid.NewGuid().ToString(); t.Status = (int)StatusEnum.正常; t.Cid = company.CreateCompanyId; t.OrganizaId = OrganizaId;//部门编号 t.IsSystem = false; t.CreaterId = CurrentMaster.Id; t.CreateTime = DateTime.Now; t.HeadImg = HPact; t.IsMain = true; //t.Money = 1000; //DataSet ds = new BllSysHatProvince().GetArea(CurrentMaster.Cid); //if (ds.Tables[0].Rows.Count > 0) //{ // t.Detail = ds.Tables[0].Rows[0]["ProvinceName"].ToString() + " " + ds.Tables[0].Rows[0]["CityName"].ToString() + " " + ds.Tables[0].Rows[0]["AreaName"].ToString(); //} t.CardNum = t.OperateNum; int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } new BllSysMaster().ClearCache(); } WriteJsonToPage(json.ToString()); }
public void SaveRegedit() { ModJsonResult json = new ModJsonResult(); ModSysMaster master = new ModSysMaster(); ModSysCompany t = new ModSysCompany(); #region ===获取管理员信息 string nickName = Request.Params["UserName"]; string LoginName = Request.Params["LoginName"]; string Pwd = Request.Params["pwd"]; master.Pwd = (string.IsNullOrEmpty(Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(Pwd)); #endregion string UserType = Request["UserType"].ToString(); //用户类型 string HidCompanyType = Request["CompanyType"].ToString(); //单位类型 t.Id = Guid.NewGuid().ToString(); master.Id = Guid.NewGuid().ToString(); master.Cid = t.Id; master.IsSystem = true; master.IsMain = true; master.CreaterId = ""; master.UserName = nickName; master.LoginName = LoginName; master.Phone = LoginName; master.Email = ""; master.Phone = LoginName; master.Status = (int)StatusEnum.未激活; new BllSysMaster().ClearCache(); string titleTip = ""; if (int.Parse(UserType) == 1)//普通用户 { switch (int.Parse(HidCompanyType)) { case 1: //社会单位 master.Attribute = (int)AdminTypeEnum.单位用户; titleTip = "单位用户"; break; case 3: //消防单位 master.Attribute = (int)AdminTypeEnum.消防用户; titleTip = "消防用户"; break; case 4: //维保公司 master.Attribute = (int)AdminTypeEnum.维保用户; titleTip = "维保用户"; break; case 5: //器材供应商 master.Attribute = (int)AdminTypeEnum.供应商用户; titleTip = "供应商用户"; break; } string CompanyCode = Request["CompanyCode"].ToString(); //单位编号 string DeptCode = Request["DeptCode"].ToString(); //部门编号 master.OrganizaId = DeptCode; master.Cid = CompanyCode;//公司编号 int result = new BllSysMaster().Insert(master); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } else { //保存用户与单位之间的关系 ModSysFlow SysFlow = new ModSysFlow(); SysFlow.Id = Guid.NewGuid().ToString(); SysFlow.Title = titleTip + ":" + nickName + " 注册申请"; SysFlow.FlowType = 2;//(1:单位管理员注册时的审核 2:普通用户注册审核 3:用户单位变更审核) SysFlow.FlowStatus = 0; SysFlow.Reamrk = ""; SysFlow.ApprovalUser = master.Id; SysFlow.ApprovalTime = DateTime.Now; SysFlow.CompanyId = CompanyCode; SysFlow.MasterId = master.Id; int count = new BllSysFlow().Insert(SysFlow); if (count <= 0) { json.success = false; json.msg = "用户同步流程失败,请稍后再操作!"; new BllSysMaster().Delete(master.Id); } else { json.success = true; } } } else { switch (int.Parse(HidCompanyType)) { case 1: //社会单位 master.Attribute = (int)AdminTypeEnum.单位管理员; t.Attribute = (int)CompanyType.单位; titleTip = "社会单位"; break; case 3: //消防单位 master.Attribute = (int)AdminTypeEnum.消防部门管理员; t.Attribute = (int)CompanyType.消防部门; titleTip = "消防单位"; break; case 4: //维保公司 master.Attribute = (int)AdminTypeEnum.维保公司管理员; t.Attribute = (int)CompanyType.维保公司; titleTip = "维保单位"; break; case 5: //器材供应商 master.Attribute = (int)AdminTypeEnum.供应商管理员; t.Attribute = (int)CompanyType.供应商; titleTip = "供应商"; break; } master.IsMain = true; master.OrganizaId = "0";//部门编号 int result = new BllSysMaster().Insert(master); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } else { string x = Request.Params["Bx"]; string y = Request.Params["By"]; string CompanyName = Request["CompanyName"].ToString(); //用户类型 string Address = Request["Address"].ToString(); //用户类型 string LinkUser = Request["LinkUser"].ToString(); //用户类型 string LinkPhone = Request["LinkPhone"].ToString(); //用户类型 t.Phone = LinkPhone; t.LinkUser = LinkUser; t.Address = Address; t.Name = CompanyName; t.CompLat = x; t.ComPLon = y; t.Status = (int)StatusEnum.未激活; t.CreaterUserId = ""; t.CreateTime = DateTime.Now; t.ProPic = "/UploadFile/CompanyProPic/default_img_company.png"; t.MasterId = master.Id; t.CreateCompanyId = "0"; t.RegisiTime = DateTime.Now;//公司注册时间 result = new BllSysCompany().Insert(t); if (result <= 0) { json.msg = "保存公司失败,请稍后再操作!"; new BllSysMaster().Delete(master.Id); } else { //保存用户与单位之间的关系 ModSysFlow SysFlow = new ModSysFlow(); SysFlow.Id = Guid.NewGuid().ToString(); SysFlow.Title = titleTip + ":" + CompanyName + "注册申请"; SysFlow.FlowType = 1;//(1:单位管理员注册时的审核 2:普通用户注册审核 3:用户单位变更审核) SysFlow.FlowStatus = 0; SysFlow.Reamrk = ""; SysFlow.ApprovalUser = master.Id; SysFlow.ApprovalTime = DateTime.Now; SysFlow.CompanyId = t.Id; SysFlow.MasterId = master.Id; int count = new BllSysFlow().Insert(SysFlow); if (count <= 0) { json.msg = "用户同步流程失败,请稍后再操作!"; json.success = false; new BllSysMaster().Delete(master.Id); new BllSysCompany().Delete(t.Id); } else { json.success = true; } } } } Response.Write(json.ToString()); Response.End(); }
public void SaveData(ModSysMaster t) { BllSysMaster bll = new BllSysMaster(); ModJsonResult json = new ModJsonResult(); string roleId = Request["roleId"] == null ? "" : Request["roleId"]; string roleName = Request["roleName"] == null ? "" : Request["roleName"]; t.RoleName = roleName;//角色名称 t.Pwd = (string.IsNullOrEmpty(t.Pwd) ? DESEncrypt.Encrypt("666666") : DESEncrypt.Encrypt(t.Pwd.Trim())); t.LoginName = t.LoginName.Trim(); t.UserName = t.UserName.Trim(); t.Attribute = (int)AdminTypeEnum.普通员工; //栏目类型 t.IsMain = true; //普通用户 if (!string.IsNullOrEmpty(Request["modify"])) //修改 { int result = bll.UpdateDate(t); if (result <= 0) { json.success = false; json.msg = "修改失败,请稍后再操作!"; } } else { t.Id = Guid.NewGuid().ToString(); t.Status = (int)StatusEnum.正常; t.Cid = CurrentMaster.Cid; t.IsSystem = false; t.CreaterId = CurrentMaster.Id; t.CreateTime = DateTime.Now; if (t.Sex == 0) { t.HeadImg = (t.HeadImg == null ? "/Resource/css/icons/head/GTP_hmale_big.jpg" : ""); } else { t.HeadImg = (t.HeadImg == null ? "/Resource/css/icons/head/GTP_hfemale_big.jpg" : ""); } int result = bll.Insert(t); if (result <= 0) { json.success = false; json.msg = " 保存失败,请稍后再操作!"; } new BllSysMaster().ClearCache(); } #region ==保存角色信息 if (new BllSysMasterRole().DeleteAllByMasterId(t.Id) > 0)//删除管理员原有角色信息 { if (!string.IsNullOrEmpty(roleId)) { string[] _str = roleId.Split(','); for (int i = 0; i < _str.Length; i++) { var model = new ModSysMasterRole() { Id = Guid.NewGuid().ToString(), RoleId = _str[i], MasterId = t.Id }; new BllSysMasterRole().Insert(model); } } } #endregion WriteJsonToPage(json.ToString()); }