private void BindData()
 {
     Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]);
     panel1.BindData(bll.Model);
      if (bll.Model.OrganizeCity > 1)
      {
          gv_StaffInOrganizeCity.BindGrid<Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys());
      }
      else
      {
          tr_StaffInOrganizeCity.Visible = false;
      }
     gv_List.DataSource = bll.GetUserList();
     gv_List.DataBind();
 }
    private void BindData()
    {
        Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]);

        panel1.BindData(bll.Model);
        if (bll.Model.OrganizeCity > 1)
        {
            gv_StaffInOrganizeCity.BindGrid <Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys());
        }
        else
        {
            tr_StaffInOrganizeCity.Visible = false;
        }
        gv_List.DataSource = bll.GetUserList();
        gv_List.DataBind();
    }
    private void BindData()
    {
        Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]);
        panel1.BindData(bll.Model);
        Header.Attributes["WebPageSubCode"] = "Modify";
        gv_List.DataSource = bll.GetUserList();
        gv_List.DataBind();

        UploadFile1.RelateID = (int)ViewState["ID"];
        UploadFile1.BindGrid();

        Org_Staff m = bll.Model;
        if (m.ApproveFlag == 1)
        {
            if (m.Dimission == 1)
            {
                bt_AddApply.Visible = false;
            }
            bt_Approve.Visible = false;
            TextBox tbx_BeginWorkTime = (TextBox)panel1.FindControl("Org_Staff_BeginWorkTime");
            // if (tbx_BeginWorkTime != null) tbx_BeginWorkTime.Enabled = false;//03-17暂停使用,便于维护资料
            if (m.Dimission == 2)
            {
                TextBox tbx_EndWorkTime = (TextBox)panel1.FindControl("Org_Staff_EndWorkTime");
                if (tbx_EndWorkTime != null) tbx_EndWorkTime.Enabled = false;
            }
        }

        if (m["State"] == "2")
        {
            //审批中
            bt_AddApply.Visible = false;
            bt_OK.Visible = false;
            bt_CreateUser.Visible = false;
            bt_TaskDetail.Visible = true;
            bt_RevocationApply.Visible = false;
        }

        if (bll.Model.OrganizeCity > 1)
        {
            #region 绑定兼管片区
            IList<Addr_OrganizeCity> staffincity = bll.StaffInOrganizeCity_GetOrganizeCitys();

            Addr_OrganizeCity currentcity = new Addr_OrganizeCityBLL(bll.Model.OrganizeCity).Model;
            if (currentcity != null)
            {
                Addr_OrganizeCity parent = new Addr_OrganizeCityBLL(currentcity.SuperID).Model;
                if (parent != null)
                {
                    IList<Addr_OrganizeCity> lists = Addr_OrganizeCityBLL.GetModelList("SuperID = " + parent.ID.ToString() + " AND ID <> " + bll.Model.OrganizeCity.ToString());
                    if (lists.Count > 0)
                    {
                        foreach (Addr_OrganizeCity city in lists)
                        {
                            if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                                ddl_StaffInOrganizeCity.Items.Add(new ListItem(parent.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                        }
                    }
                    Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]);
                    Org_Position position = new Org_PositionBLL(staff.Model.Position).Model;
                    if (currentcity.Level > 1 && position != null &&( position.IsHeadOffice == "Y" || position.Remark == "OfficeHR"))
                    {
                        int grandpacityid = new Addr_OrganizeCityBLL(currentcity.SuperID).Model.SuperID;
                        string condition = "SuperID = " + grandpacityid.ToString() + " AND ID <> " + currentcity.SuperID.ToString();
                        if (currentcity.Level < ConfigHelper.GetConfigInt("OrganizeCity-CityLevel"))
                        {
                            condition = "SuperID != " +parent.ID.ToString() + " AND Level=" + (currentcity.Level-1).ToString() + " AND ID <> " + currentcity.SuperID.ToString();
                        }
                        IList<Addr_OrganizeCity> bobos = Addr_OrganizeCityBLL.GetModelList(condition);
                        foreach (Addr_OrganizeCity bobo in bobos)
                        {
                            IList<Addr_OrganizeCity> tangxongs = Addr_OrganizeCityBLL.GetModelList("SuperID = " + bobo.ID.ToString());
                            foreach (Addr_OrganizeCity city in tangxongs)
                            {
                                if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                                    ddl_StaffInOrganizeCity.Items.Add(new ListItem(bobo.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                            }
                        }
                    }
                }

                ddl_StaffInOrganizeCity.Items.Insert(0, new ListItem("请选择...", "0"));
            }
            if (ddl_StaffInOrganizeCity.Items.Count == 0) bt_Add_StaffInOrganizeCity.Enabled = false;
            #endregion

            gv_StaffInOrganizeCity.BindGrid<Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys());
        }
        else
        {
            tr_StaffInOrganizeCity.Visible = false;
        }

        bt_OK.Text = "保 存";
        bt_OK.ForeColor = System.Drawing.Color.Red;

        //if (new Org_StaffBLL((int)Session["UserID"]).Model.ID != 1)
        //{
        //    ((MCSTreeControl)panel1.FindControl("Org_Staff_Position")).Enabled = false;
        //}

        int budget = Org_StaffNumberLimitBLL.CheckOverBudget(m.OrganizeCity, m.Position);
        if (budget == 0)
            lb_OverBudgetInfo.Text = "当前城市该职位人员数量已等于预定的预算人数,请注意!";
        else if (budget < 0)
            lb_OverBudgetInfo.Text = "当前城市该职位人员数量已超过预定的预算人数 " + (0 - budget).ToString() + "人,请注意!";
    }
    private void BindData()
    {
        Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]);

        panel1.BindData(bll.Model);
        Header.Attributes["WebPageSubCode"] = "Modify";
        gv_List.DataSource = bll.GetUserList();
        gv_List.DataBind();

        UploadFile1.RelateID = (int)ViewState["ID"];
        UploadFile1.BindGrid();

        Org_Staff m = bll.Model;

        if (m.ApproveFlag == 1)
        {
            if (m.Dimission == 1)
            {
                bt_AddApply.Visible = false;
            }
            bt_Approve.Visible = false;
            TextBox tbx_BeginWorkTime = (TextBox)panel1.FindControl("Org_Staff_BeginWorkTime");
            // if (tbx_BeginWorkTime != null) tbx_BeginWorkTime.Enabled = false;//03-17暂停使用,便于维护资料
            if (m.Dimission == 2)
            {
                TextBox tbx_EndWorkTime = (TextBox)panel1.FindControl("Org_Staff_EndWorkTime");
                if (tbx_EndWorkTime != null)
                {
                    tbx_EndWorkTime.Enabled = false;
                }
            }
        }

        if (m["State"] == "2")
        {
            //审批中
            bt_AddApply.Visible        = false;
            bt_OK.Visible              = false;
            bt_CreateUser.Visible      = false;
            bt_TaskDetail.Visible      = true;
            bt_RevocationApply.Visible = false;
        }

        if (bll.Model.OrganizeCity > 1)
        {
            #region 绑定兼管片区
            IList <Addr_OrganizeCity> staffincity = bll.StaffInOrganizeCity_GetOrganizeCitys();

            Addr_OrganizeCity currentcity = new Addr_OrganizeCityBLL(bll.Model.OrganizeCity).Model;
            if (currentcity != null)
            {
                Addr_OrganizeCity parent = new Addr_OrganizeCityBLL(currentcity.SuperID).Model;
                if (parent != null)
                {
                    IList <Addr_OrganizeCity> lists = Addr_OrganizeCityBLL.GetModelList("SuperID = " + parent.ID.ToString() + " AND ID <> " + bll.Model.OrganizeCity.ToString());
                    if (lists.Count > 0)
                    {
                        foreach (Addr_OrganizeCity city in lists)
                        {
                            if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                            {
                                ddl_StaffInOrganizeCity.Items.Add(new ListItem(parent.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                            }
                        }
                    }
                    Org_StaffBLL staff    = new Org_StaffBLL((int)Session["UserID"]);
                    Org_Position position = new Org_PositionBLL(staff.Model.Position).Model;
                    if (currentcity.Level > 1 && position != null && (position.IsHeadOffice == "Y" || position.Remark == "OfficeHR"))
                    {
                        int    grandpacityid = new Addr_OrganizeCityBLL(currentcity.SuperID).Model.SuperID;
                        string condition     = "SuperID = " + grandpacityid.ToString() + " AND ID <> " + currentcity.SuperID.ToString();
                        if (currentcity.Level < ConfigHelper.GetConfigInt("OrganizeCity-CityLevel"))
                        {
                            condition = "SuperID != " + parent.ID.ToString() + " AND Level=" + (currentcity.Level - 1).ToString() + " AND ID <> " + currentcity.SuperID.ToString();
                        }
                        IList <Addr_OrganizeCity> bobos = Addr_OrganizeCityBLL.GetModelList(condition);
                        foreach (Addr_OrganizeCity bobo in bobos)
                        {
                            IList <Addr_OrganizeCity> tangxongs = Addr_OrganizeCityBLL.GetModelList("SuperID = " + bobo.ID.ToString());
                            foreach (Addr_OrganizeCity city in tangxongs)
                            {
                                if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                                {
                                    ddl_StaffInOrganizeCity.Items.Add(new ListItem(bobo.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                                }
                            }
                        }
                    }
                }

                ddl_StaffInOrganizeCity.Items.Insert(0, new ListItem("请选择...", "0"));
            }
            if (ddl_StaffInOrganizeCity.Items.Count == 0)
            {
                bt_Add_StaffInOrganizeCity.Enabled = false;
            }
            #endregion

            gv_StaffInOrganizeCity.BindGrid <Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys());
        }
        else
        {
            tr_StaffInOrganizeCity.Visible = false;
        }

        bt_OK.Text      = "保 存";
        bt_OK.ForeColor = System.Drawing.Color.Red;

        //if (new Org_StaffBLL((int)Session["UserID"]).Model.ID != 1)
        //{
        //    ((MCSTreeControl)panel1.FindControl("Org_Staff_Position")).Enabled = false;
        //}

        int budget = Org_StaffNumberLimitBLL.CheckOverBudget(m.OrganizeCity, m.Position);
        if (budget == 0)
        {
            lb_OverBudgetInfo.Text = "当前城市该职位人员数量已等于预定的预算人数,请注意!";
        }
        else if (budget < 0)
        {
            lb_OverBudgetInfo.Text = "当前城市该职位人员数量已超过预定的预算人数 " + (0 - budget).ToString() + "人,请注意!";
        }
    }
Example #5
0
    private void BindData()
    {
        Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]);

        if (bll.Model == null)
        {
            return;
        }

        panel1.BindData(bll.Model);

        gv_List.DataSource = bll.GetUserList();
        gv_List.DataBind();

        UploadFile1.RelateID = (int)ViewState["ID"];
        UploadFile1.BindGrid();

        Org_Staff m = bll.Model;

        if (m.ApproveFlag == 1)
        {
            if (m.Dimission == 1)
            {
                bt_AddApply.Visible = false;
            }
            bt_Approve.Visible = false;
            Header.Attributes["WebPageSubCode"] = "Modify";
            TextBox tbx_BeginWorkTime = (TextBox)panel1.FindControl("Org_Staff_BeginWorkTime");
            // if (tbx_BeginWorkTime != null) tbx_BeginWorkTime.Enabled = false;//03-17暂停使用,便于维护资料
            if (m.Dimission == 2)
            {
                TextBox tbx_EndWorkTime = (TextBox)panel1.FindControl("Org_Staff_EndWorkTime");
                if (tbx_EndWorkTime != null)
                {
                    tbx_EndWorkTime.Enabled = false;
                }
            }
        }

        if (m["State"] == "2")
        {
            //审批中
            bt_AddApply.Visible   = false;
            bt_OK.Visible         = false;
            bt_CreateUser.Visible = false;
            bt_TaskDetail.Visible = true;
        }

        if (bll.Model.OrganizeCity > 1)
        {
            #region 绑定兼管片区
            IList <Addr_OrganizeCity> staffincity = bll.StaffInOrganizeCity_GetOrganizeCitys();

            Addr_OrganizeCity currentcity = new Addr_OrganizeCityBLL(bll.Model.OrganizeCity).Model;
            if (currentcity != null)
            {
                Addr_OrganizeCity parent = new Addr_OrganizeCityBLL(currentcity.SuperID).Model;
                if (parent != null)
                {
                    IList <Addr_OrganizeCity> lists = Addr_OrganizeCityBLL.GetModelList("SuperID = " + parent.ID.ToString() + " AND ID <> " + bll.Model.OrganizeCity.ToString());
                    if (lists.Count > 0)
                    {
                        foreach (Addr_OrganizeCity city in lists)
                        {
                            if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                            {
                                ddl_StaffInOrganizeCity.Items.Add(new ListItem(parent.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                            }
                        }
                    }

                    if (currentcity.Level > 1)
                    {
                        int grandpacityid = new Addr_OrganizeCityBLL(currentcity.SuperID).Model.SuperID;
                        IList <Addr_OrganizeCity> bobos = Addr_OrganizeCityBLL.GetModelList("SuperID = " + grandpacityid.ToString() + " AND ID <> " + currentcity.SuperID.ToString());
                        foreach (Addr_OrganizeCity bobo in bobos)
                        {
                            IList <Addr_OrganizeCity> tangxongs = Addr_OrganizeCityBLL.GetModelList("SuperID = " + bobo.ID.ToString());
                            foreach (Addr_OrganizeCity city in tangxongs)
                            {
                                if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                                {
                                    ddl_StaffInOrganizeCity.Items.Add(new ListItem(bobo.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                                }
                            }
                        }
                    }
                }

                ddl_StaffInOrganizeCity.Items.Insert(0, new ListItem("请选择...", "0"));
            }
            if (ddl_StaffInOrganizeCity.Items.Count == 0)
            {
                bt_Add_StaffInOrganizeCity.Enabled = false;
            }
            #endregion

            gv_StaffInOrganizeCity.BindGrid <Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys());
        }
        else
        {
            tr_StaffInOrganizeCity.Visible = false;
        }

        bt_OK.Text      = "保 存";
        bt_OK.ForeColor = System.Drawing.Color.Red;

        //if (new Org_StaffBLL((int)Session["UserID"]).Model.ID != 1)
        //{
        //    ((MCSTreeControl)panel1.FindControl("Org_Staff_Position")).Enabled = false;
        //}
    }
    private void BindData()
    {
        Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]);
        if (bll.Model == null) return;

        panel1.BindData(bll.Model);

        gv_List.DataSource = bll.GetUserList();
        gv_List.DataBind();

        UploadFile1.RelateID = (int)ViewState["ID"];
        UploadFile1.BindGrid();

        Org_Staff m = bll.Model;
        if (m.ApproveFlag == 1)
        {
            if (m.Dimission == 1)
            {
                bt_AddApply.Visible = false;
            }
            bt_Approve.Visible = false;
            Header.Attributes["WebPageSubCode"] = "Modify";
            TextBox tbx_BeginWorkTime = (TextBox)panel1.FindControl("Org_Staff_BeginWorkTime");
            // if (tbx_BeginWorkTime != null) tbx_BeginWorkTime.Enabled = false;//03-17暂停使用,便于维护资料
            if (m.Dimission == 2)
            {
                TextBox tbx_EndWorkTime = (TextBox)panel1.FindControl("Org_Staff_EndWorkTime");
                if (tbx_EndWorkTime != null) tbx_EndWorkTime.Enabled = false;
            }
        }

        if (m["State"] == "2")
        {
            //审批中
            bt_AddApply.Visible = false;
            bt_OK.Visible = false;
            bt_CreateUser.Visible = false;
            bt_TaskDetail.Visible = true;
        }

        if (bll.Model.OrganizeCity > 1)
        {
            #region 绑定兼管片区
            IList<Addr_OrganizeCity> staffincity = bll.StaffInOrganizeCity_GetOrganizeCitys();

            Addr_OrganizeCity currentcity = new Addr_OrganizeCityBLL(bll.Model.OrganizeCity).Model;
            if (currentcity != null)
            {
                Addr_OrganizeCity parent = new Addr_OrganizeCityBLL(currentcity.SuperID).Model;
                if (parent != null)
                {
                    IList<Addr_OrganizeCity> lists = Addr_OrganizeCityBLL.GetModelList("SuperID = " + parent.ID.ToString() + " AND ID <> " + bll.Model.OrganizeCity.ToString());
                    if (lists.Count > 0)
                    {
                        foreach (Addr_OrganizeCity city in lists)
                        {
                            if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                                ddl_StaffInOrganizeCity.Items.Add(new ListItem(parent.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                        }
                    }

                    if (currentcity.Level > 1)
                    {
                        int grandpacityid = new Addr_OrganizeCityBLL(currentcity.SuperID).Model.SuperID;
                        IList<Addr_OrganizeCity> bobos = Addr_OrganizeCityBLL.GetModelList("SuperID = " + grandpacityid.ToString() + " AND ID <> " + currentcity.SuperID.ToString());
                        foreach (Addr_OrganizeCity bobo in bobos)
                        {
                            IList<Addr_OrganizeCity> tangxongs = Addr_OrganizeCityBLL.GetModelList("SuperID = " + bobo.ID.ToString());
                            foreach (Addr_OrganizeCity city in tangxongs)
                            {
                                if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null)
                                    ddl_StaffInOrganizeCity.Items.Add(new ListItem(bobo.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString()));
                            }
                        }
                    }
                }

                ddl_StaffInOrganizeCity.Items.Insert(0, new ListItem("请选择...", "0"));
            }
            if (ddl_StaffInOrganizeCity.Items.Count == 0) bt_Add_StaffInOrganizeCity.Enabled = false;
            #endregion

            gv_StaffInOrganizeCity.BindGrid<Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys());
        }
        else
        {
            tr_StaffInOrganizeCity.Visible = false;
        }

        bt_OK.Text = "保 存";
        bt_OK.ForeColor = System.Drawing.Color.Red;

        //if (new Org_StaffBLL((int)Session["UserID"]).Model.ID != 1)
        //{
        //    ((MCSTreeControl)panel1.FindControl("Org_Staff_Position")).Enabled = false;
        //}
    }