Ejemplo n.º 1
0
        public void UpdateWorkingPost(WorkingPostInfo workingPost)
        {
            SqlParameter[] pt = new SqlParameter[] {
                new SqlParameter("@id", SqlDbType.Int),
                new SqlParameter("@postName", SqlDbType.NVarChar),
                new SqlParameter("@parentId", SqlDbType.Int),
                new SqlParameter("@companyId", SqlDbType.Int),
                new SqlParameter("@state", SqlDbType.Int),
                new SqlParameter("@isPost", SqlDbType.Int),
                new SqlParameter("@kpiTempletId", SqlDbType.Int),
                new SqlParameter("@sort", SqlDbType.Int),
                new SqlParameter("@path", SqlDbType.VarChar)
            };

            pt[0].Value = workingPost.ID;
            pt[1].Value = workingPost.PostName;
            pt[2].Value = workingPost.ParentId;
            pt[3].Value = workingPost.CompanyId;
            pt[4].Value = workingPost.State;
            pt[5].Value = workingPost.IsPost;
            pt[6].Value = workingPost.KPITempletId;
            pt[7].Value = workingPost.Sort;
            pt[8].Value = workingPost.Path;

            ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateWorkingPost", pt);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (workPostId > 0)
                {
                    workingPost = WorkingPostBLL.ReadWorkingPost(workPostId);
                    //kpiTemplet = KPITempletBLL.ReadKPITemplet(workingPost.KPITempletId);
                    PostName.Text = workingPost.PostName;

                    _companyId = workingPost.CompanyId;

                    //KPISearchInfo kpiSearch = new KPISearchInfo();
                    //string parentCompanyId = CompanyBLL.ReadParentCompanyId(_companyId);
                    //if (string.IsNullOrEmpty(parentCompanyId))
                    //    kpiSearch.CompanyID = _companyId.ToString();
                    //else
                    //    kpiSearch.CompanyID = _companyId.ToString() + "," + parentCompanyId;
                    //kpiSearch.ParentId = "1,2,3";
                    //List<KPIInfo> kpiList = KPIBLL.SearchKPIList(kpiSearch);
                    //foreach (KPIInfo info in kpiList)
                    //{
                    //    switch (info.ParentId)
                    //    {
                    //        case 1:
                    //            tempList1.Add(info);
                    //            break;
                    //        case 2:
                    //            tempList2.Add(info);
                    //            break;
                    //        case 3:
                    //            tempList3.Add(info);
                    //            break;
                    //    }
                    //}
                }

                Company           = CompanyBLL.ReadCompany(_companyId);
                CompanyName.Value = Company.CompanyName;
                WorkingPostSearchInfo workingPostSearch = new WorkingPostSearchInfo();
                workingPostSearch.CompanyId  = _companyId.ToString();
                workingPostSearch.ParentId   = "0";
                workingPostSearch.IsPost     = 0;
                this.ParentId.DataSource     = WorkingPostBLL.CreateWorkingPostTreeList(_companyId);
                this.ParentId.DataTextField  = "PostName";
                this.ParentId.DataValueField = "Id";
                this.ParentId.DataBind();
                this.ParentId.Items.Insert(0, new ListItem("作为一级部门", "0"));
                if (ParentId.Items.Contains(ParentId.Items.FindByValue(workingPost.ParentId.ToString())))
                {
                    ParentId.Items.FindByValue(workingPost.ParentId.ToString()).Selected = true;
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 从缓存里读取岗位列表
 /// </summary>
 /// <param name="postIDArray"></param>
 /// <returns></returns>
 public static List <WorkingPostInfo> ReadWorkingPost(int[] postIDArray)
 {
     if (postIDArray.Length > 0)
     {
         List <WorkingPostInfo> resultList = new List <WorkingPostInfo>();
         foreach (int postID in postIDArray)
         {
             WorkingPostInfo workingPost = ReadWorkingPost(postID);
             if (workingPost != null)
             {
                 resultList.Add(workingPost);
             }
         }
         return(resultList);
     }
     return(null);
 }
Ejemplo n.º 4
0
 public void PrepareModel(SqlDataReader dr, List <WorkingPostInfo> workingPostList)
 {
     while (dr.Read())
     {
         WorkingPostInfo info = new WorkingPostInfo();
         {
             info.ID           = int.Parse(dr["ID"].ToString());
             info.PostName     = dr["PostName"].ToString();
             info.ParentId     = int.Parse(dr["ParentId"].ToString());
             info.CompanyId    = int.Parse(dr["CompanyId"].ToString());
             info.State        = int.Parse(dr["State"].ToString());
             info.IsPost       = int.Parse(dr["IsPost"].ToString());
             info.KPITempletId = int.Parse(dr["KPITempletId"].ToString());
             info.Sort         = int.Parse(dr["Sort"].ToString());
             info.Path         = dr["Path"].ToString();
         }
         workingPostList.Add(info);
     }
 }
Ejemplo n.º 5
0
        public WorkingPostInfo ReadWorkingPost(int id)
        {
            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar) };
            pt[0].Value = id;
            WorkingPostInfo info = new WorkingPostInfo();

            using (SqlDataReader dr = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadWorkingPost", pt))
            {
                if (dr.Read())
                {
                    info.ID           = int.Parse(dr["ID"].ToString());
                    info.PostName     = dr["PostName"].ToString();
                    info.ParentId     = int.Parse(dr["ParentId"].ToString());
                    info.CompanyId    = int.Parse(dr["CompanyId"].ToString());
                    info.State        = int.Parse(dr["State"].ToString());
                    info.IsPost       = int.Parse(dr["IsPost"].ToString());
                    info.KPITempletId = int.Parse(dr["KPITempletId"].ToString());
                    info.Sort         = int.Parse(dr["Sort"].ToString());
                    info.Path         = dr["Path"].ToString();
                }
            }
            return(info);
        }
Ejemplo n.º 6
0
        public int AddWorkingPost(WorkingPostInfo workingPost)
        {
            SqlParameter[] pt = new SqlParameter[] {
                new SqlParameter("@postName", SqlDbType.NVarChar),
                new SqlParameter("@parentId", SqlDbType.Int),
                new SqlParameter("@companyId", SqlDbType.Int),
                new SqlParameter("@state", SqlDbType.Int),
                new SqlParameter("@isPost", SqlDbType.Int),
                new SqlParameter("@kpiTempletId", SqlDbType.Int),
                new SqlParameter("@sort", SqlDbType.Int),
                new SqlParameter("@path", SqlDbType.VarChar)
            };

            pt[0].Value = workingPost.PostName;
            pt[1].Value = workingPost.ParentId;
            pt[2].Value = workingPost.CompanyId;
            pt[3].Value = workingPost.State;
            pt[4].Value = workingPost.IsPost;
            pt[5].Value = workingPost.KPITempletId;
            pt[6].Value = workingPost.Sort;
            pt[7].Value = workingPost.Path;
            return(Convert.ToInt32(ShopMssqlHelper.ExecuteScalar(ShopMssqlHelper.TablePrefix + "AddWorkingPost", pt)));
        }
Ejemplo n.º 7
0
 public static void UpdateWorkingPost(WorkingPostInfo workingPost)
 {
     dal.UpdateWorkingPost(workingPost);
     CacheHelper.Remove(cacheKey);
 }
Ejemplo n.º 8
0
 public static int AddWorkingPost(WorkingPostInfo workingPost)
 {
     CacheHelper.Remove(cacheKey);
     return(dal.AddWorkingPost(workingPost));
 }
Ejemplo n.º 9
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "岗位列表";
            base.CheckUserPower("ReadWorkingPost,AddWorkingPost,UpdateWorkingPost", PowerCheckType.OR);

            string allCompanyID = CompanyBLL.SystemCompanyId.ToString();

            if (!string.IsNullOrEmpty(base.ParentCompanyID))
            {
                allCompanyID += "," + base.ParentCompanyID;
            }
            //if (!string.IsNullOrEmpty(base.SonCompanyID))
            //    allCompanyID += "," + base.SonCompanyID;

            if (CompanyID < 0)
            {
                CompanyID = base.UserCompanyID;
            }
            if (WorkPostID > 0)
            {
                WorkingPost = WorkingPostBLL.ReadWorkingPost(WorkPostID);
                CompanyID   = WorkingPost.CompanyId;
                KPIContent  = KPITempletBLL.ReadKPITemplet(WorkingPost.KPITempletId).KPIContent;
                if (CompanyID != base.UserCompanyID)
                {
                    string parentCompanyID = CompanyBLL.ReadParentCompanyId(CompanyID);
                    string sonCompanyID    = CompanyBLL.ReadCompanyIdList(CompanyID.ToString());
                    allCompanyID = CompanyBLL.SystemCompanyId.ToString();
                    if (!string.IsNullOrEmpty(parentCompanyID))
                    {
                        allCompanyID += "," + parentCompanyID;
                    }
                    //if (!string.IsNullOrEmpty(sonCompanyID))
                    //    allCompanyID += "," + sonCompanyID;
                }
            }

            WorkingPostSearchInfo workingPostSearch = new WorkingPostSearchInfo();

            workingPostSearch.CompanyId = CompanyID.ToString();
            workingPostSearch.ParentId  = "0";
            workingPostSearch.IsPost    = 0;
            WorkingPostClassList        = WorkingPostBLL.SearchWorkingPostList(workingPostSearch);

            KPISearchInfo kpiSearch = new KPISearchInfo();

            kpiSearch.CompanyID = allCompanyID;
            kpiSearch.ParentId  = "1,2,3";
            List <KPIInfo> kpiList = KPIBLL.SearchKPIList(kpiSearch);

            foreach (KPIInfo info in kpiList)
            {
                switch (info.ParentId)
                {
                case 1:
                    TempList1.Add(info);
                    break;

                case 2:
                    TempList2.Add(info);
                    break;

                case 3:
                    TempList3.Add(info);
                    break;
                }
            }
        }