/// <summary> /// 初始化 /// </summary> private void DataInit(string doType) { EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); //如果部门Id不为空则获取子集部门 int departId = Utils.GetInt(Utils.GetQueryStringValue("id")); //如果不是删除操作则获取部门 if (doType != "delete") { depStrHTML = GetSonDeparts(departId); if (depStrHTML == "") { depStrHTML = "<tr id='noDepart'><td>对不起,暂无部门信息!</td></tr>"; } //如果部门id不是0则是ajax请求获取子部门操作 if (departId != 0) { Response.Clear(); Response.Write(depStrHTML); Response.End(); return; } } else { //删除部门 this.AJAX(); } }
/// <summary> /// ajax操作 /// </summary> private void AJAX() { string msg = string.Empty; string id = Utils.GetQueryStringValue("id"); EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); int result = BLL.Delete(Utils.GetInt(id), this.SiteUserInfo.CompanyId); switch (result) { case 1: msg = "该部门已有用户,不能删除!"; break; case 2: msg = "该部门已有下级部门,不能删除!"; break; case 3: msg = "删除成功!"; break; case 4: msg = "删除失败!"; break; } Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result.ToString(), msg)); Response.End(); }
protected IList <EyouSoft.Model.ComStructure.MComDepartment> getAllInfo() { EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); IList <EyouSoft.Model.ComStructure.MComDepartment> list = BLL.GetList(this.SiteUserInfo.CompanyId); return(list); }
/// <summary> /// 初始化团号规则 /// </summary> protected void PageInit() { EyouSoft.Model.ComStructure.MComSetting model = new EyouSoft.BLL.ComStructure.BComSetting().GetModel(SiteUserInfo.CompanyId); IList <EyouSoft.Model.ComStructure.MTourNoOptionCode> TourCodeItemList = new EyouSoft.BLL.ComStructure.BTourNoOptionCode().GetModel(SiteUserInfo.CompanyId); IList <EyouSoft.Model.ComStructure.MComDepartment> ComDepartmentList = new EyouSoft.BLL.ComStructure.BComDepartment().GetList(SiteUserInfo.CompanyId); if (!string.IsNullOrEmpty(model.TourNoSetting)) { string[] str = new string[model.TourNoSetting.Length - 1]; for (int i = 0; i < model.TourNoSetting.Length - 1; i++) { str[i] = model.TourNoSetting.Substring(i, 1); } repItemList.DataSource = str; repItemList.DataBind(); } else { repItemList.DataSource = new string[] { "0" }; repItemList.DataBind(); } repDepartList.DataSource = ComDepartmentList; repDepartList.DataBind(); repTourTypeList.DataSource = EyouSoft.Common.EnumObj.GetList(typeof(EyouSoft.Model.EnumType.TourStructure.TourType)); repTourTypeList.DataBind(); System.Text.StringBuilder Depart = new System.Text.StringBuilder("["); System.Text.StringBuilder TourType = new System.Text.StringBuilder("["); System.Text.StringBuilder LDateFormat = new System.Text.StringBuilder("["); foreach (var item in TourCodeItemList) { if (item.ItemType == EyouSoft.Model.EnumType.ComStructure.OptionItemType.公司简称) { txtCompanyCode.Text = item.Code; } if (item.ItemType == EyouSoft.Model.EnumType.ComStructure.OptionItemType.部门简称) { Depart.AppendFormat("{0}\"ID\":\"{1}\",\"Value\":\"{2}\"{3},", "{", item.ItemId, item.Code, "}"); } if (item.ItemType == EyouSoft.Model.EnumType.ComStructure.OptionItemType.团队类型) { TourType.AppendFormat("{0}\"ID\":\"{1}\",\"Value\":\"{2}\"{3},", "{", item.ItemId, item.Code, "}"); } if (item.ItemType == EyouSoft.Model.EnumType.ComStructure.OptionItemType.出团日期) { LDateFormat.AppendFormat("{0}\"ID\":\"{1}\",\"Value\":\"{2}\"{3},", "{", item.ItemId, item.Code, "}"); } } Depart.Replace(",", "", Depart.Length - 1, 1); TourType.Replace(",", "", TourType.Length - 1, 1); LDateFormat.Replace(",", "", LDateFormat.Length - 1, 1); Depart.Append("]"); TourType.Append("]"); LDateFormat.Append("]"); DepartValueList = Depart.ToString(); TourTypeValueList = TourType.ToString(); LDateFormatList = LDateFormat.ToString(); }
/// <summary> /// 获得所有部门 /// </summary> /// <param name="o"></param> /// <returns></returns> protected string GetAllDepart(object o) { StringBuilder sb = new StringBuilder(); EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); IList <MComDepartment> lst = BLL.GetList(this.SiteUserInfo.CompanyId); if (lst != null && lst.Count > 0) { GetSecondDepart(lst, (int)o, sb); } return(sb.ToString()); }
protected void PageInit() { //部门编号 int?DepartId = Utils.GetIntNull(Utils.GetQueryStringValue("departId")); //操作员 string Operator = Utils.GetQueryStringValue("operator"); //操作开始时间 string BeginDate = Utils.GetQueryStringValue("txtBeginDate"); //操作结束时间 string EndDate = Utils.GetQueryStringValue("txtEndDate"); //当前页 pageIndex = UtilsCommons.GetPadingIndex(); IList <EyouSoft.Model.ComStructure.MComDepartment> list1 = new EyouSoft.BLL.ComStructure.BComDepartment().GetList(SiteUserInfo.CompanyId); this.ddlDepart.DataTextField = "DepartName"; this.ddlDepart.DataValueField = "DepartId"; this.ddlDepart.DataSource = list1; this.ddlDepart.DataBind(); this.ddlDepart.Items.Insert(0, new ListItem("请选择", "0")); IList <EyouSoft.Model.SysStructure.MSysLogHandleInfo> list = null; EyouSoft.Model.SysStructure.MSysLogHandleSearch search = new EyouSoft.Model.SysStructure.MSysLogHandleSearch(); search.DeptId = DepartId == 0 ? null : DepartId; search.Operator = Operator; if (BeginDate != "") { search.SDate = Utils.GetDateTime(BeginDate); } if (EndDate != "") { search.EDate = Utils.GetDateTime(EndDate); } list = new EyouSoft.BLL.SysStructure.BSysLogHandle().GetLogs(SiteUserInfo.CompanyId, pageSize, pageIndex, ref recordCount, search); this.ddlDepart.SelectedValue = DepartId.ToString(); this.txtOperator.Value = Operator; this.txtBeginDate.Value = BeginDate; this.txtEndDate.Value = EndDate; if (list != null && list.Count > 0) { this.repList.DataSource = list; this.repList.DataBind(); BindPage(); } else { this.repList.EmptyText = "<tr><td colspan=\"6\" align=\"center\">未找到相关记录!</td></tr>"; } }
/// <summary> /// 初始化 /// </summary> private void DataInit() { #region 分页参数 int pageSize = 20; int pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1); int recordCount = 0; #endregion txt_SellsSelect.SetTitle = "选择 销售员"; txt_SellsSelect.SellsName = Utils.GetQueryStringValue(txt_SellsSelect.SellsNameClient); txt_SellsSelect.SellsID = Utils.GetQueryStringValue(txt_SellsSelect.SellsIDClient); MWarningBase model = new MWarningBase(); model.SellerId = Utils.GetQueryStringValue(txt_SellsSelect.SellsIDClient); model.SellerName = Utils.GetQueryStringValue(txt_SellsSelect.SellsNameClient); model.SignArrear = (EqualSign?)Utils.GetEnumValueNull(typeof(EqualSign), Utils.GetQueryStringValue(CaiWuShaiXuan1.ClientUniqueIDOperator)); model.Arrear = Utils.GetDecimalNull(Utils.GetQueryStringValue(CaiWuShaiXuan1.ClientUniqueIDOperatorNumber)); model.SignTransfinite = (EqualSign?)Utils.GetEnumValueNull(typeof(EqualSign), Utils.GetQueryStringValue(CaiWuShaiXuan2.ClientUniqueIDOperator)); model.Transfinite = Utils.GetDecimalNull(Utils.GetQueryStringValue(CaiWuShaiXuan2.ClientUniqueIDOperatorNumber)); //部门 int department = Utils.GetIntSign(Utils.GetQueryStringValue("sel_department"), -1); if (department >= 0) { model.DeptId = department; } IList <MComDepartment> lst = new EyouSoft.BLL.ComStructure.BComDepartment().GetList(CurrentUserCompanyID); StringBuilder sb = new StringBuilder(); foreach (MComDepartment item in lst) { sb.Append("<option " + ((item.DepartId == model.DeptId) ? "selected=selected" : "") + " value=" + item.DepartId + ">-" + item.DepartName + "-</option>"); } DepartmentOptionStr = sb.ToString(); IList <MSalesmanWarning> ls = new BFinance().GetSalesmanWarningLst( pageSize, pageIndex, ref recordCount, CurrentUserCompanyID, model); if (ls != null && ls.Count > 0) { pan_Msg.Visible = false; rpt_list.DataSource = ls; rpt_list.DataBind(); //绑定分页 BindPage(pageSize, pageIndex, recordCount); } }
/// <summary> /// 初始化 /// </summary> private void DataInit() { EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); IList <MComDepartment> lst = BLL.GetList(this.SiteUserInfo.CompanyId); if (null != lst && lst.Count > 0) { this.RepList.DataSource = lst.Where(i => (i.PrevDepartId == 0)).ToList(); this.RepList.DataBind(); } else { this.RepList.Controls.Add(new Label() { Text = "<li style='text-align:center;'>对不起,没有相关数据!</li>" }); } }
/// <summary> /// 获得部门Options /// </summary> /// <param name="selectIndex">设置选择项</param> /// <returns></returns> public static string GetDepartLineForSelect(int selectIndex, string companyID) { StringBuilder sb = new StringBuilder(); IList <EyouSoft.Model.ComStructure.MComDepartment> list = new EyouSoft.BLL.ComStructure.BComDepartment().GetList(companyID); sb.Append("<option value=\"0\">-请选择-</option>"); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].DepartId != selectIndex) { sb.Append("<option value=\"" + list[i].DepartId + "\">" + list[i].DepartName + "</option>"); } else { sb.Append("<option value=\"" + list[i].DepartId + "\" selected=\"selected\">" + list[i].DepartName + "</option>"); } } } return(sb.ToString()); }
protected string GetDepart(object o, int flag) { int deptId = (int)o; EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); IList <MComDepartment> lst = BLL.GetList(deptId.ToString(), this.SiteUserInfo.CompanyId); StringBuilder sb = new StringBuilder(); if (lst != null && lst.Count > 0) { sb.AppendFormat("<ul class=\"ulborder\" style=\"width: 100%;float: left\">"); for (int i = 0; i < lst.Count; i++) { sb.AppendFormat("<li style=\"width: 23%;display:block;float:left; text-align: left; line-height: 20px;\">"); sb.AppendFormat("<input id=\"select_{1}{2}\" type=\"checkbox\" value=\"{0}\" data-pid='{3}' name=\"Operator3\" /><input id=\"select_{1}{2}\" type=\"radio\" value=\"{0}\" name=\"Operator3\" data-pid='{3}' />", lst[i].DepartId, i, flag, lst[i].PrevDepartId); sb.AppendFormat("<label for=\"select_{1}{2}\">{0}</label>", lst[i].DepartName, i, flag); sb.AppendFormat("</li>"); } sb.AppendFormat("</ul>"); } return(sb.ToString()); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { EyouSoft.BLL.GovStructure.BNotice BLL = new EyouSoft.BLL.GovStructure.BNotice(); EyouSoft.Model.GovStructure.MGovNotice Model = BLL.GetGovNoticeModel(id); if (null != Model) { //浏览人数加1 int views = 0; Int32.TryParse(Model.Views.ToString(), out views); Model.Views = views + 1; BLL.UpdateGovNotice(Model); //插入浏览人相关信息 MGovNoticeBrowse viewModel = new MGovNoticeBrowse(); viewModel.IssueTime = DateTime.Now; viewModel.NoticeId = id; viewModel.OperatorId = this.SiteUserInfo.UserId; viewModel.Operator = this.SiteUserInfo.Name; BLL.AddGovNoticeBrowse(viewModel); //通知公告标题标题 this.lbTitle.Text = Model.Title; StringBuilder strSec = new StringBuilder(); if (null != Model.MGovNoticeReceiverList && Model.MGovNoticeReceiverList.Count > 0) { EyouSoft.BLL.ComStructure.BComDepartment secBLL = new EyouSoft.BLL.ComStructure.BComDepartment(); EyouSoft.Model.ComStructure.MComDepartment secModel; foreach (MGovNoticeReceiver m in Model.MGovNoticeReceiverList) { if (m.ItemType == EyouSoft.Model.EnumType.GovStructure.ItemType.指定部门) { if (!string.IsNullOrEmpty(m.ItemId)) { int[] intArry = Utils.GetIntArray(m.ItemId, ","); for (int j = 0; j < intArry.Length; j++) { secModel = secBLL.GetModel(intArry[j], this.SiteUserInfo.CompanyId); if (null != secModel) { strSec.Append(secModel.DepartName + ","); } } } } else { strSec.Append(m.ItemType.ToString() + ","); } } } //发布对象 this.lbObj.Text = strSec.Length > 0 ? strSec.ToString().Substring(0, strSec.Length - 1) : ""; //内容 this.lbContent.Text = Model.Content; IList <EyouSoft.Model.ComStructure.MComAttach> lstFiles = Model.ComAttachList; StringBuilder strFile = new StringBuilder(); if (null != lstFiles && lstFiles.Count > 0) { for (int i = 0; i < lstFiles.Count; i++) { strFile.AppendFormat("<span class='upload_filename'><a href='/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}&name={1}' target='_blank'>{1}</a></span>", lstFiles[i].FilePath, lstFiles[i].Name); } this.lbFile.Text = strFile.ToString(); } else { this.lbFile.Text = "无"; } //是否提醒 this.LbAwake.Text = Model.IsRemind == true ? "是" : "否"; //是否发送短信 //this.LbSendmsg.Text = Model.IsMsg == true ? "是" : "否"; //短信内容 //this.LbMsgcontent.Text = Model.MsgContent; this.lbTime.Text = string.Format("{0:yyyy-MM-dd HH:mm}", Model.IssueTime); this.lbSender.Text = Model.Operator; } }
/// <summary> ///获取下级部门 /// </summary> protected string GetSonDeparts(int departId) { int step = Utils.GetInt(Utils.GetQueryStringValue("step"), 0);//获取当前级数 step = step + 1; int padd = step * 20;//获取缩进 EyouSoft.BLL.ComStructure.BComDepartment BLL = new EyouSoft.BLL.ComStructure.BComDepartment(); IList <EyouSoft.Model.ComStructure.MComDepartment> list = null; IList <EyouSoft.Model.ComStructure.MComDepartment> lstPart = this.getAllInfo(); if (departId != 0) { if (null != lstPart && lstPart.Count > 0) { list = this.getAllInfo().Where(i => (i.PrevDepartId == departId)).ToList(); } } else { if (null != lstPart && lstPart.Count > 0) { list = this.getAllInfo().Where(i => (i.PrevDepartId == 0)).ToList(); } } StringBuilder depBuilder = new StringBuilder(); if (list != null && list.Count > 0) { foreach (MComDepartment d in list) { bool b = BLL.IsExistSubDept(d.DepartId); depBuilder.AppendFormat("<tr id=\"tr_{0}\" sid=\"{0}\" parentId=\"{1}\">", d.DepartId, d.PrevDepartId); depBuilder.AppendFormat("<td height='28' align='left' valign='center' class='step_{0}' style='padding-left:{1}px;'>", step, padd); depBuilder.AppendFormat("<img src='/images/organization_0{0}.gif' width='9' height='9' {1}/>", b ? 5 : 7, b ? "onclick=\"return DM.getSonD2(this);\"" : ""); depBuilder.AppendFormat("<a href='javascript:void(0);' step='{0}' {1} id=\"son{2}\" class='fontSize_{0}' >", step, b ? "onclick=\"return DM.getSonD(this,'" + d.DepartId + "');\"" : "", d.DepartId); depBuilder.AppendFormat("<strong id=\"strong{2}\" style=\"{0}\">{1}</strong></a>", "color:#000000;", d.DepartName, d.DepartId); depBuilder.AppendFormat("<span style='float:right;font-size: 12px;'>"); if (d.PrevDepartId == 0) { if (IsBuMenGuanLi) { depBuilder.AppendFormat("<a href='javascript:void(0);' onclick=\"return DM.addD('{0}',this);\">[添加下级部门]</a>", d.DepartId); } if (IsFenGongSi) { depBuilder.AppendFormat("<a href=\"javascript:void(0);\" onclick=\"return DM.updateD('{0}',this);\">[编辑]</a>", d.DepartId); depBuilder.AppendFormat("<a href=\"javascript:void(0);\" onclick=\"return DM.delD('{0}',this,{1});\">[删除]</a></span>", d.DepartId, d.PrevDepartId); } } else { if (IsBuMenGuanLi) { depBuilder.AppendFormat("<a href='javascript:void(0);' onclick=\"return DM.addD('{0}',this);\">[添加下级部门]</a>", d.DepartId); depBuilder.AppendFormat("<a href=\"javascript:void(0);\" onclick=\"return DM.updateD('{0}',this);\">[编辑]</a>", d.DepartId); depBuilder.AppendFormat("<a href=\"javascript:void(0);\" onclick=\"return DM.delD('{0}',this,{1});\">[删除]</a></span>", d.DepartId, d.PrevDepartId); } } depBuilder.AppendFormat("</td></tr>"); if (departId == 0) { padd = 20; } } } return(depBuilder.ToString()); }