/// <summary> /// 获取所在某个部门的职位 /// </summary> /// <param name="iDeptID">部门ID</param> /// <returns></returns> public ViewBase Posts(int iDeptID) { ViewPost vbPost = new ViewPost(); vbPost.BaseCondition = " b.FK_UserID=" + base.ID.ToString() + " AND b.FK_DeptID =" + iDeptID.ToString(); return vbPost; }
/// <summary> /// 获得所有职位 /// </summary> /// <returns></returns> public static ViewBase GetAllPosition() { ViewPost vPost = new ViewPost(true); return vPost; }
/// <summary> /// 获取默认职位ID /// </summary> /// <returns></returns> public static int GetDefaultPost() { ViewPost vbPost = new ViewPost(); vbPost.BaseCondition = "a.Name = '员工'"; return vbPost.Count > 0 ? vbPost.GetItem(0).ID : -1; }
/// <summary> /// 根据职位名称获得大于该职位的职位 /// </summary> /// <param name="sPostName">职位名称</param> /// <returns></returns> public static ViewBase GetPositions(string sPostName) { Position post = Position.GetPosition(sPostName); ViewPost vwPost = new ViewPost(true); vwPost.BaseCondition = post == null ? "1<>1" : "SortNum <=" + post.SortNum.ToString(); return vwPost; }
/// <summary> /// 通过职位名返回职位对象 /// </summary> /// <param name="strPostName">职位名</param> /// <returns></returns> public static Position GetPosition(string strPostName) { ViewPost vwPost = new ViewPost(true); vwPost.BaseCondition = "a.Name='" + strPostName + "'"; return vwPost.Count > 0 ? vwPost.GetItem(0) as Position : null; }
/// <summary> /// 通过职位id返回职位对象 /// </summary> /// <param name="iPostID">职位id</param> /// <returns></returns> public static Position GetPosition(int iPostID) { ViewPost vwPost = new ViewPost(true); vwPost.BaseCondition = "a.ID='" + iPostID + "'"; return vwPost.Count > 0 ? vwPost.GetItem(0) as Position : null; }
/// <summary> /// 绑定职位 /// </summary> /// <param name="selectpPostID"></param> /// <returns></returns> public string BindPost2(int selectpPostID) { ViewBase vbPost = new ViewPost(); vbPost.BaseCondition = "a.ID<>0 "; vbPost.Sort = "a.SortNum DESC"; string html = string.Empty; html = "<option value='-1'>|-选择职位</option>"; int i = 0; foreach (Position dp in vbPost.Ens) { if (dp.ID == selectpPostID) { html += "<option selected valueMax='" + dp.MaxSortNum.ToString() + "' valueMin='" + dp.MinSortNum.ToString() + "' valueMinDefault='"+dp.SortNum.ToString()+"' value='" + dp.ID.ToString() + "'>" + "├" + dp.Name + "</option>"; } else { html += "<option valueMax='" + dp.MaxSortNum.ToString() + "' valueMin='" + dp.MinSortNum.ToString() + "' valueMinDefault='"+dp.SortNum.ToString()+"' value='" + dp.ID.ToString() + "'>" + "├" + dp.Name + "</option>"; } i += 50; } return html; }
/// <summary> /// 绑定职位 /// </summary> /// <param name="deptid"></param> /// <returns></returns> public string BindPosition2(string deptid) { ViewBase vbPost = new ViewPost(); vbPost.BaseCondition = "a.ID<>0 "; vbPost.Sort = "a.SortNum DESC"; string html = string.Empty; foreach (Position dp in vbPost.Ens) { html += "<option value='" + dp.ID.ToString() + "'>" + "├" + dp.Name + "</option>"; } return html; }