/// <summary> /// 绑定生成一个有树结构的下拉菜单 /// </summary> /// <param name="ParentId">父ID</param> /// <param name="i">用来控制缩入量的值,请输入-1</param> public void DrpDeparmentData(int ParentId, int i) { string strPading = ""; //缩入字符 i++; for (int j = 0; j < i; j++) { strPading += " ";//如果要增加缩入的长度,改成两个全角的空格就可以了 } DepartmentInfoBLL departmentInfoBLL = new DepartmentInfoBLL(); int RecordIsDelete = 0; var list = departmentInfoBLL.GetDepartmentInfolist(ParentId, RecordIsDelete); foreach (var item in list) { ListItem li = new ListItem(); li.Value = item.DepartmentID.ToString(); li.Text = strPading + " " + item.DepartmentName; drpDepartmentInfoID.Items.Add(li); DrpDeparmentData(item.DepartmentID, i); } i--; }
/// <summary> /// 获取角色列表为ZTree /// </summary> static public Object GetDepartmentInfoListForZTree() { #region 开始 string result = string.Empty; try { int channelId = DNTRequest.GetInt("channelId", 7); int ParentId = DNTRequest.GetInt("ParentId", 0); DepartmentInfoBLL op = new DepartmentInfoBLL(); DepartmentInfo model = new DepartmentInfo(); DataSet ds = op.GetList(" RecordIsDelete=0 "); DataTable dt = null; if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } List <Hashtable> list = new List <Hashtable>(); if (dt != null && dt.Rows.Count > 0) { DataRow[] allList = dt.Select(string.Format("ParentId={0}", ParentId), "DepartmentID ASC"); if (allList.Length > 0) { foreach (DataRow dr in allList) { bool isParent = false; DataRow[] allChild = dt.Select(string.Format("ParentId={0}", dr["DepartmentID"]), "DepartmentID ASC"); if (allChild != null && allChild.Length > 0) { isParent = true; } #region inner001 string className = ComPage.SafeToString(dr["DepartmentName"]); Hashtable ht = new Hashtable(); ht.Add("id", dr["DepartmentID"]); ht.Add("name", className); ht.Add("pId", dr["ParentId"]); ht.Add("open", true); if (isParent) { GetDepartmentInfoChild(list, allChild, dt); } list.Add(ht); #endregion } } } result = DNTRequest.GetResultJson(true, "success", list); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, ex.Message, null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); #endregion end 开始 }
/// <summary> /// 操作日志 /// </summary> /// <param name="logContent">日志内容</param> /// <param name="companyId">渠道编号</param> /// <param name="businessType">业务类型1网贷2保险3信用卡</param> /// <param name="relationId">关联编号</param> /// <returns>操作日志添加结果</returns> static public int OperationLogAdd(int relationId, string logContent, int companyId = 1, int businessType = 1) { int result = -1; try { int userId = -1; string realName = string.Empty; int departmentId = -1; string departmentName = string.Empty; LoginUserCookie currentUser = MerchantFrontCookieBLL.GetMerchantFrontUserCookie(); if (currentUser != null) { UsersBLL op = new UsersBLL(); Users model = new Users(); model = op.GetModel(currentUser.LoginUserID); userId = currentUser.LoginUserID; departmentId = model.DepartmentID; if (model != null) { realName = model.UserName; DepartmentInfoBLL opDepartment = new DepartmentInfoBLL(); DepartmentInfo modelDepartmentInfo = new DepartmentInfo(); modelDepartmentInfo = opDepartment.GetModel(departmentId); if (modelDepartmentInfo != null) { departmentName = modelDepartmentInfo.DepartmentName; } } } StackTrace st = new StackTrace(true); MethodBase mb = st.GetFrame(1).GetMethod(); string clsString = mb.DeclaringType.FullName; string mName = mb.Name; OperationLogBLL opOperationLog = new OperationLogBLL(); OperationLog modelOperationLog = new OperationLog(); modelOperationLog.BusinessType = businessType; modelOperationLog.RelationId = relationId; modelOperationLog.LogContent = logContent; modelOperationLog.Ip = System.Web.HttpContext.Current.Request.UserHostAddress; modelOperationLog.UserId = userId; modelOperationLog.RealName = realName; modelOperationLog.CreateDate = DateTime.Now; modelOperationLog.DepartmentId = departmentId; modelOperationLog.DepartmentName = departmentName; modelOperationLog.CreateDate = DateTime.Now; result = opOperationLog.Add(modelOperationLog); } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
public void DeleteDepartment(HttpContext context) { var DepartmentID = context.Request.QueryString["DepartmentID"]; DepartmentInfoBLL bll = new DepartmentInfoBLL(); bool b = false; if (!string.IsNullOrEmpty(DepartmentID)) { b = bll.UpdateDelete(Convert.ToInt32(DepartmentID), ComPage.CurrentUser.UserID); DepartmentUserLogBLL.WriteDepartmentUserLogToDB(DepartmentID.ToInt(), "删除部门", 2, 0, ComPage.CurrentAdmin.UserID); } context.Response.Write(b ? "1" : "0"); }
public void VerifySonDepartment(HttpContext context) { var DepartmentID = context.Request.QueryString["DepartmentID"]; DepartmentInfoBLL bll = new DepartmentInfoBLL(); DataSet ds = new DataSet(); int b = 0; if (!string.IsNullOrEmpty(DepartmentID)) { ds = bll.GetList(" ParentId=" + DepartmentID + " and RecordIsDelete=0"); if (ds.Tables[0].Rows.Count > 0) { b = ds.Tables[0].Rows[0]["DepartmentID"].ToInt(); } } context.Response.Write(b); }
static public Object DepartmentInfoListForSelect() { string result = string.Empty; try { DepartmentInfoBLL op = new DepartmentInfoBLL(); List <DepartmentInfo> list = new List <DepartmentInfo>(); StringBuilder where = new StringBuilder(); where.AppendFormat("RecordIsDelete=0"); list = op.GetModelList(where.ToString()); result = DNTRequest.GetResultJson(true, "success", list); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "获取商家部门异常,请稍后再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
public void GetUsersList(HttpContext context) { UsersBLL usersbll = new UsersBLL(); List <UsersBackups> list = new List <UsersBackups>(); string LoginName = context.Request.QueryString["LoginName"]; string UsersName = context.Request.QueryString["UsersName"]; string Mobiles = context.Request.QueryString["Mobiles"]; string Where = " u.RecordIsDelete=0 "; DepartmentInfo df = new DepartmentInfo(); DepartmentInfoBLL bll = new DepartmentInfoBLL(); df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID); if (ComPage.CurrentAdmin.UserType != 1) { if ((df == null) || (df != null && df.IsReceiveBusiness != false)) { Where += " AND u.UserID IN(select ID from [dbo].[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"; } } if (!string.IsNullOrEmpty(LoginName)) { Where += " AND LoginName like'%" + LoginName + "%' "; } if (!string.IsNullOrEmpty(Mobiles)) { Where += " AND phone like'%" + Mobiles + "%' "; } if (!string.IsNullOrEmpty(UsersName)) { Where += " AND UserName like'%" + UsersName + "%' "; } //if (!string.IsNullOrEmpty(UsersData) && UsersData != "") //{ // Where += " AND (LoginName like'" + UsersData + "%' or phone like'" + UsersData + "%' or UserName like '" + UsersData + "%') "; //} list = usersbll.GetModelListName(Where); var b = SerializerHelper.SerializeObject(new { data = list }); context.Response.Write(b); }
protected void DepartmentInfoInfoSave() { DepartmentInfoBLL DepartmentInfoBLL = new DepartmentInfoBLL(); DepartmentInfoNameChild = this.txtDepartmentNameChild.Value.Trim(); DepartmentInfoName = this.txtDepartmentName.Value.ToString(); string Remark = ""; Remark = this.txtRemark.Value.ToString(); try { ParentID = int.Parse(this.txtDepartmentID.Value); } catch { } if (DepartmentInfoNameChild.Length > 50) { Response.Write(IFrameLayerClosetwo("部门名称输入过长,请重新输入!")); Response.End(); } if (this.txtDepartmentNameChild.Value.ToString() == "") { Response.Write(IFrameLayerClosetwo("请填写部门名称!")); Response.End(); } if (this.txtDepartmentCode.Value.ToString() == "") { Response.Write(IFrameLayerClosetwo("请填写部门编码名称!")); Response.End(); } if ((ParentID == DepartmentID) && ParentID != 0 && DepartmentID != 0) { Response.Write(IFrameLayerClosetwo("父级选择错误,请重新选择!")); Response.End(); } DataSet ds2 = new DataSet(); ds2 = DepartmentInfobll.GetParentNameList("r.DepartmentID=" + ParentID + " and r.RecordIsDelete=0 "); if (ds2.Tables[0].Rows.Count > 0) { if (DepartmentID != 0) { if (ds2.Tables[0].Rows[0]["ParentID"].ToInt() == DepartmentID) { Response.Write(IFrameLayerClosetwo("父级选择错误,请重新选择!")); Response.End(); } } } DataSet ds = new DataSet(); ds = DepartmentInfobll.GetParentNameList("r.DepartmentID<>" + DepartmentID + " and r.DepartmentName='" + DepartmentInfoNameChild + "' and r.RecordIsDelete=0 "); if (ds.Tables[0].Rows.Count > 0) { Response.Write(IFrameLayerClosetwo("部门名称重复,重新填写!")); Response.End(); } ds = DepartmentInfobll.GetParentNameList(" r.DepartmentID<>" + DepartmentID + " and r.DepartmentCode='" + this.txtDepartmentCode.Value.ToString() + "' and r.RecordIsDelete=0 "); if (ds.Tables[0].Rows.Count > 0) { Response.Write(IFrameLayerClosetwo("部门编码重复,重新填写!")); Response.End(); } bool bFlag = false; if (this.btnSave.Text == "修改部门") { DepartmentInfo model = new DepartmentInfo(); model.DepartmentID = Request.QueryString["DepartmentID"].ToString().ToInt(); model.Remark = Remark; model.DepartmentName = DepartmentInfoNameChild; model.ParentID = ParentID; model.DepartmentCode = this.txtDepartmentCode.Value.ToString(); model.RecordIsDelete = false; model.UpdateUser = LoginUserID; model.RecordUpdateTime = DateTime.Now; if (this.RadioYes.Checked == true) { model.IsReceiveBusiness = true; } else { model.IsReceiveBusiness = false; } bFlag = DepartmentInfoBLL.Update(model); DepartmentUserLogBLL.WriteDepartmentUserLogToDB(DepartmentID, "修改部门", 1, 0, LoginUserID); if (bFlag) { Response.Write(IFrameLayerClosetwo("修改部门成功!")); Response.End(); } else { Response.Write(IFrameLayerClosetwo("修改部门失败")); Response.End(); } } else { DepartmentInfo model = new DepartmentInfo(); model.DepartmentID = DepartmentID; model.DepartmentName = DepartmentInfoNameChild; model.ParentID = ParentID; model.Remark = Remark; model.DepartmentCode = this.txtDepartmentCode.Value.ToString(); model.RecordIsDelete = false; model.RecordUpdateTime = DateTime.Now; model.CreatedUser = LoginUserID; model.RecordCreateTime = DateTime.Now; if (this.RadioYes.Checked == true) { model.IsReceiveBusiness = true; } else { model.IsReceiveBusiness = false; } int DepartmentInfoIdNew = 0; DepartmentInfoIdNew = DepartmentInfoBLL.Add(model); DepartmentUserLogBLL.WriteDepartmentUserLogToDB(DepartmentInfoIdNew, "添加部门", 0, 0, LoginUserID); if (DepartmentInfoIdNew > 0) { Response.Write(IFrameLayerClosetwo("添加部门成功!")); Response.End(); } else { Response.Write(IFrameLayerClosetwo("添加部门失败,继续添加!")); Response.End(); } } }
/// <summary> /// 获取用户列表 /// </summary> static public Object GetUsersList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and u.RecordIsDelete=0 "); DepartmentInfo df = new DepartmentInfo(); DepartmentInfoBLL bll = new DepartmentInfoBLL(); df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID); if (ComPage.CurrentAdmin.UserType != 1) { if ((df == null) || (df != null && df.IsReceiveBusiness != false)) { where.Append(" AND u. UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); } } #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string LoginName = DNTRequest.GetString("LoginName"); string UsersName = DNTRequest.GetString("UsersName"); string Mobiles = DNTRequest.GetString("Mobiles"); string DepartmentInfoID = DNTRequest.GetString("DepartmentInfoID"); if (string.IsNullOrEmpty(LoginName)) { LoginName = JsonRequest.GetJsonKeyVal(jsonText, "LoginName"); LoginName = System.Web.HttpContext.Current.Server.UrlDecode(LoginName); } if (string.IsNullOrEmpty(UsersName)) { UsersName = JsonRequest.GetJsonKeyVal(jsonText, "UsersName"); UsersName = System.Web.HttpContext.Current.Server.UrlDecode(UsersName); } if (string.IsNullOrEmpty(Mobiles)) { Mobiles = JsonRequest.GetJsonKeyVal(jsonText, "Mobiles"); Mobiles = System.Web.HttpContext.Current.Server.UrlDecode(Mobiles); } if (string.IsNullOrEmpty(DepartmentInfoID)) { DepartmentInfoID = JsonRequest.GetJsonKeyVal(jsonText, "DepartmentInfoID"); DepartmentInfoID = System.Web.HttpContext.Current.Server.UrlDecode(DepartmentInfoID); } if (!string.IsNullOrEmpty(LoginName)) { where.AppendFormat(" and u.LoginName like'{0}%' ", LoginName); } if (!string.IsNullOrEmpty(UsersName)) { where.AppendFormat(" and u.UserName like'{0}%' ", UsersName); } if (!string.IsNullOrEmpty(Mobiles)) { where.AppendFormat(" and u.Phone like'{0}%' ", Mobiles); } if (!string.IsNullOrEmpty(DepartmentInfoID) && DepartmentInfoID != "undefined" && DepartmentInfoID != "0") { where.AppendFormat(" and u.DepartmentID ={0} ", DepartmentInfoID); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; UsersBLL Usersbll = new UsersBLL(); DataTable dt = Usersbll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
/// <summary> /// 获取部门列表 /// </summary> static public Object GetDepartmentList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and r.RecordIsDelete=0"); #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string val = DNTRequest.GetString("searchValue"); if (string.IsNullOrEmpty(val)) { val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue"); val = System.Web.HttpContext.Current.Server.UrlDecode(val); } if (!string.IsNullOrEmpty(val) && val != "undefined") { where.AppendFormat(" and (r.DepartmentName like '{0}%')", val); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; DepartmentInfoBLL rolebll = new DepartmentInfoBLL(); DataTable dt = rolebll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
/// <summary> /// 获取分利列表 /// </summary> static public Object GetOrderRebateList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and ort.IsDeleted=0 "); DepartmentInfo df = new DepartmentInfo(); DepartmentInfoBLL bll = new DepartmentInfoBLL(); df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID); if (ComPage.CurrentAdmin.UserType != 1) { if ((df == null) || (df != null && df.IsReceiveBusiness != false)) { //where.Append(" AND moa.UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); where.Append(" AND moa.UserID IN(SELECT ID from[BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); } } #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string val = DNTRequest.GetString("searchValue"); if (string.IsNullOrEmpty(val)) { val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue"); val = System.Web.HttpContext.Current.Server.UrlDecode(val); } if (!string.IsNullOrEmpty(val)) { where.AppendFormat(" and (moa.InsureNum like'" + val + "%' or ort.TransNo like'" + val + "%') ", val); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; OrderRebateBLL orderRebatebll = new OrderRebateBLL(); DataTable dt = orderRebatebll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }