public override void ShowEntity() { currentOrganizeEntity = organizeService.GetEntity(base.UserInfo, this.EntityId); if (currentOrganizeEntity == null || currentOrganizeEntity.FullName.Trim().Length <= 0) { return; } if (!string.IsNullOrEmpty(currentOrganizeEntity.ParentId)) { txtParentId.Text = organizeService.GetEntity(base.UserInfo, currentOrganizeEntity.ParentId.ToString()).FullName; txtParentId.SelectedValue = currentOrganizeEntity.ParentId; } txtFullName.Text = currentOrganizeEntity.FullName; txtShortName.Text = currentOrganizeEntity.ShortName; txtCode.Text = currentOrganizeEntity.Code; cboCategory.SelectedValue = currentOrganizeEntity.Category; txtManager.Text = currentOrganizeEntity.Manager; txtAssistantManager.Text = currentOrganizeEntity.AssistantManager; txtOuterPhone.Text = currentOrganizeEntity.OuterPhone; txtInnerPhone.Text = currentOrganizeEntity.InnerPhone; txtFax.Text = currentOrganizeEntity.Fax; txtPostalcode.Text = currentOrganizeEntity.Postalcode; txtWeb.Text = currentOrganizeEntity.Web; txtAddress.Text = currentOrganizeEntity.Address; chkEnabled.Checked = BusinessLogic.ConvertIntToBoolean(currentOrganizeEntity.Enabled); chkIsInnerOrganize.Checked = BusinessLogic.ConvertIntToBoolean(currentOrganizeEntity.IsInnerOrganize); txtDescription.Text = currentOrganizeEntity.Description; }
/// <summary> /// 号码智能自动补全 /// </summary> /// <param name="telphone"></param> /// <param name="organizeId"></param> /// <param name="city"></param> /// <returns></returns> public IEnumerable <TelphonePuEntity> GetList(string telphone, string organizeId, string city) { if (string.IsNullOrEmpty(organizeId)) { return(null); } var organizeData = orgService.GetEntity(organizeId); if (!string.IsNullOrEmpty(organizeData.OrganizeId)) { //号码条件 string telSql = ""; if (!string.IsNullOrEmpty(telphone)) { telSql = " and Telphone like '%" + telphone + "%' "; } //城市条件 string citySql = ""; if (!string.IsNullOrEmpty(city) && city != "全国") { citySql = " and city like '" + city.Substring(0, 2) + "%'"; } //1.本机构 2.代售直属上级 3.顶级机构 string orgSql = "and OrganizeId IN('" + organizeId + "','" + organizeData.ParentId + "','" + organizeData.TopOrganizeId + "')"; //输入号码,显示前20个号码 string strSql = @" SELECT TOP 20 * FROM ( SELECT Telphone,City,Grade,ExistMark,price,EnabledMark FROM TelphoneLiang WHERE SellMark<>1 AND DeleteMark<>1 and EnabledMark <> 1 " + orgSql + citySql + telSql + @" UNION ALL SELECT Telphone,City,Grade,ExistMark,price,EnabledMark FROM TelphonePu WHERE SellMark<>1 AND DeleteMark<>1 and EnabledMark <> 1 " + citySql + telSql + " )t ORDER BY price desc"; return(this.BaseRepository().FindList(strSql.ToString())); } else { return(null); } }
/// <summary> /// 机构实体 /// </summary> /// <param name="keyValue">主键值</param> /// <returns></returns> public OrganizeEntity GetEntity(string keyValue) { return(service.GetEntity(keyValue)); }
/// <summary> /// 获取分类列表 /// </summary> /// <param name="organizeId">靓号公司</param> /// <param name="Grade">查询参数</param> /// <param name="city"></param> /// <param name="ExistMark"></param> /// <returns>返回列表</returns> public IEnumerable <TelphoneLiangEntity> GetGrade(string organizeId, string Grade, string city, int?ExistMark) { if (string.IsNullOrEmpty(organizeId)) { return(null); } var organizeData = orgService.GetEntity(organizeId); if (!string.IsNullOrEmpty(organizeData.OrganizeId)) { string orgSql = ""; //分类条件 string gradeSql = ""; if (!Grade.IsEmpty()) { gradeSql += " and Grade = '" + Grade + "'"; } //状态条件 string existSql = ""; if (!ExistMark.IsEmpty()) { existSql += " and ExistMark = " + ExistMark; } //城市条件 string citySql = ""; if (!string.IsNullOrEmpty(city)) { if (city.Contains("0000")) { citySql += " and cityid like '" + city.Substring(0, 2) + "%'"; } else if (city != "0") { citySql += " and cityid = '" + city + "'"; } } //1.本机构 2.代售直属上级 3.顶级机构 //orgSql = "and OrganizeId IN('" + organizeId + "','" + organizeData.ParentId + "','" + organizeData.TopOrganizeId + "')"; //判断vip到期情况 //1.本机构 if (vipService.GetVipByOrganizeId(organizeId)) { organizeId = "'" + organizeId + "',"; } else { organizeId = ""; } //2.代售直属上级 string pid = ""; if (!string.IsNullOrEmpty(organizeData.ParentId) && organizeData.ParentId != organizeData.OrganizeId) { if (vipService.GetVipByOrganizeId(organizeData.ParentId)) { pid = "'" + organizeData.ParentId + "',"; } } // 3.顶级机构 string top = ""; if (!string.IsNullOrEmpty(organizeData.TopOrganizeId) && organizeData.TopOrganizeId != organizeData.OrganizeId && organizeData.TopOrganizeId != organizeData.ParentId) { if (vipService.GetVipByOrganizeId(organizeData.TopOrganizeId)) { top = "'" + organizeData.TopOrganizeId + "',"; } } string inOrg = organizeId + pid + top; //如果机构全部过期,返回空 if (string.IsNullOrEmpty(inOrg)) { return(null); } orgSql = " and OrganizeId IN(" + inOrg + ")"; orgSql = orgSql.Replace(",)", ")"); orgSql = GetOrgSql(organizeData.OrganizeId, organizeData.ParentId, organizeData.TopOrganizeId); if (string.IsNullOrEmpty(orgSql)) { return(null); } //4.如果代售机构vip服务没有到期 string otherOrgSql = @" UNION all SELECT Telphone,City,Operator,Price,Grade,CASE ExistMark WHEN '2' THEN '秒杀' WHEN '1' THEN '现卡' ELSE '预售' END Description,Package,EnabledMark FROM TelphoneLiangOther WHERE EnabledMark = 1 " + orgSql.Replace("OrganizeId", "CreateOrganizeId") + gradeSql + existSql + citySql; string strSql = @" SELECT * FROM ( SELECT Telphone,City,Operator,Price,Grade,CASE ExistMark WHEN '2' THEN '秒杀' WHEN '1' THEN '现卡' ELSE '预售' END Description,Package,EnabledMark FROM TelphoneLiang WHERE SellMark<>1 AND DeleteMark<>1 and EnabledMark <> 1 " + orgSql + gradeSql + existSql + citySql + otherOrgSql + " )t ORDER BY EnabledMark, right(Telphone,1),Description,price desc"; return(this.BaseRepository().FindList(strSql.ToString())); } else { return(null); } }
/// <summary> ///获取记录数据 /// </summary> /// <returns></returns> public IEnumerable <SevenSPictureEntity> getList(DateTime?planeStart, DateTime?planeEnd, string state, string evaluationState, string space, Pagination pagination, bool ispage, string deptId, bool isFile) { var db = new RepositoryFactory().BaseRepository(); var queryex = LinqExtensions.True <SevenSPictureEntity>(); if (!string.IsNullOrEmpty(deptId) && deptId != "0") { var one = Oservice.GetEntity(deptId); if (one == null) { var entity = service.GetSubDepartments(deptId, "省级,厂级,部门,班组"); var listDept = new List <string>(); foreach (var item in entity) { listDept.Add(item.DepartmentId); } queryex = queryex.And(x => listDept.Contains(x.deptid)); } } if (planeStart != null) { queryex = queryex.And(x => x.planeStartDate >= planeStart); } if (planeEnd != null) { queryex = queryex.And(x => x.planeEndDate <= planeEnd); } if (state != "全部") { if (state == "未提交") { queryex = queryex.And(x => x.state == "未提交"); } else if (string.IsNullOrEmpty(state)) { queryex = queryex.And(x => x.state == "已提交"); } else { queryex = queryex.And(x => x.state == "已提交"); } } if (!string.IsNullOrEmpty(evaluationState)) { if (evaluationState == "未评价") { queryex = queryex.And(x => string.IsNullOrEmpty(x.evaluation)); } else { queryex = queryex.And(x => !string.IsNullOrEmpty(x.evaluation)); } } var query = db.IQueryable(queryex); pagination.records = query.Count(); if (query.Count() > 0) { if (ispage) { query = query.OrderByDescending(x => x.CreateDate).Skip(pagination.rows * (pagination.page - 1)).Take(pagination.rows); } else { query = query.OrderByDescending(x => x.CreateDate); } } //if (isFile) //{ // foreach (var item in query) // { // var ex = LinqExtensions.True<FileInfoEntity>(); // ex = ex.And(t => t.RecId == item.Id); // if (!string.IsNullOrEmpty(space) && space != "全部") // { // ex = ex.And(t => t.FileExtensions == space); // item.Files = db.IQueryable(ex).ToList(); // } // else // { // item.Files = db.IQueryable(ex).ToList(); // } // } //} return(query); }