예제 #1
0
    private void BindData()
    {
        FNA_ClientPaymentInfo m = new FNA_ClientPaymentInfoBLL((int)ViewState["ID"]).Model;

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

        if (m.ApproveFlag == 1)
        {
            UC_DetailView1.SetControlsEnable(false);
            bt_Save.Visible       = false;
            bt_Approve.Visible    = false;
            UploadFile1.CanDelete = false;
        }
        else
        {
            btn_CanclePass.Visible = false;
        }
        DropDownList ddl_PayType = UC_DetailView1.FindControl("FNA_ClientPaymentInfo_PayType") == null ? null : (DropDownList)UC_DetailView1.FindControl("FNA_ClientPaymentInfo_PayType");

        if (ddl_PayType != null)
        {
            ddl_PayType_SelectedIndexChanged(ddl_PayType, null);
        }
    }
    private void BindGrid()
    {
        UploadFile1.RelateID  = int.Parse(select_Client.SelectValue);
        UploadFile1.BeginTime = DateTime.Parse(this.tbx_begin.Text);
        UploadFile1.EndTime   = DateTime.Parse(this.tbx_end.Text).AddDays(1);

        string extcondition = "";

        if (tbx_FindName.Text != "")
        {
            extcondition = " Name like '%" + tbx_FindName.Text + "%' ";
        }

        if (cb_OnlyPic.Checked)
        {
            if (extcondition != "")
            {
                extcondition += " AND ";
            }
            extcondition += "lower(ExtName) in ('bmp','jpg','gif','png')";
        }
        UploadFile1.ExtCondition = extcondition;

        UploadFile1.BindGrid();
    }
예제 #3
0
    private void BindData()
    {
        JN_Journal m = new JN_JournalBLL((int)ViewState["ID"]).Model;

        pl_detail.BindData(m);

        if (m.InsertStaff != (int)Session["UserID"] || m.ApproveFlag == 1 || (DateTime.Today - m.InsertTime.Date).Days > 7)
        {
            pl_detail.SetControlsEnable(false);
            UploadFile1.CanDelete = false;
            UploadFile1.CanUpload = false;
            bt_OK.Visible         = false;
            bt_Delete.Visible     = false;
        }

        if ((DateTime.Today - m.InsertTime.Date).Days > 0)
        {
            bt_Delete.Visible = false;                                                      //只能删除当日的日志
        }
        #region 展示附件
        UploadFile1.RelateID   = (int)ViewState["ID"];
        UploadFile1.RelateType = 90;
        UploadFile1.BindGrid();
        #endregion

        lb_CommentCounts.Text = JN_JournalCommentBLL.GetModelList("JournalID=" + ViewState["ID"].ToString()).Count.ToString();
    }
예제 #4
0
    public void BindData()
    {
        KB_ArticleBLL bll = new KB_ArticleBLL((int)ViewState["ID"]);

        UploadFile1.BindGrid();

        lt_article_comment.Text = bll.Model.Content.Replace("\r", "<br/>");


        lb_Title.Text      = bll.Model.Title;
        lb_Author.Text     = bll.Model.Author;
        lb_Keyword.Text    = bll.Model.KeyWord;
        lb_ReadCounts.Text = bll.Model.ReadCount.ToString();

        panel1.BindData(bll.Model);

        bt_Edit.Visible = (bll.Model.UploadStaff == (int)Session["UserID"]);

        if (new KB_CatalogBLL(bll.Model.Catalog).Model.CommentFlag == "N")
        {
            tb_Comment.Visible = false;
        }
        else
        {
            ud_grid_comment.ConditionString = " KB_Comment.IsDelete = 'N' and KB_Comment.Article=" + ViewState["ID"].ToString();
            ud_grid_comment.BindGrid();
        }
    }
예제 #5
0
 private void BindGrid()
 {
     if (ViewState["ID"] != null)
     {
         UploadFile1.RelateID = (int)ViewState["ID"];
         UploadFile1.BindGrid();
         UploadFile1.Visible = true;
     }
 }
    /// <summary>
    /// 载入已有的工作项
    /// </summary>
    private void BindData()
    {
        cb_DisplayCheckedOnly.Checked = true;

        JN_WorkingPlanBLL bll = new JN_WorkingPlanBLL((int)ViewState["ID"]);

        tr_OrganizeCity.SelectValue  = bll.Model.OrganizeCity.ToString();
        tbx_begindate.Text           = bll.Model.BeginDate.ToString("yyyy-MM-dd");
        tbx_enddate.Text             = bll.Model.EndDate.ToString("yyyy-MM-dd");
        select_PlanStaff.SelectValue = bll.Model.Staff.ToString();
        select_PlanStaff.SelectText  = new Org_StaffBLL(bll.Model.Staff).Model.RealName;

        pl_detail.BindData(bll.Model);
        InitGridView(bll.Model.BeginDate, bll.Model.EndDate);

        ViewState["WorkingPlanData"] = LoadWorkingPlanDetail((int)ViewState["ID"]);
        ViewState["BeginDate"]       = bll.Model.BeginDate;
        ViewState["EndDate"]         = bll.Model.EndDate;

        BindGrid();

        tbx_begindate.Enabled          = false;
        tbx_enddate.Enabled            = false;
        select_PlanStaff.Enabled       = false;
        tr_OrganizeCity.Enabled        = false;
        cbx_GenarateSynergetic.Visible = false;
        bt_Create.Visible = false;

        tbx_Begin.Text = tbx_begindate.Text;
        tbx_End.Text   = tbx_begindate.Text;

        if (bll.Model.BeginDate < DateTime.Today)
        {
            bt_Delete.Visible = false;
        }

        if (bll.Model.State == 2 || bll.Model.State == 3 || bll.Model.ApproveFlag == 1 || bll.Model.InsertStaff != (int)Session["UserID"])
        {
            //提交待审批、已审批
            tr_adddetail.Visible = false;
            pl_detail.SetControlsEnable(false);
            bt_Save.Visible   = false;
            bt_Delete.Visible = false;
            bt_Submit.Visible = false;

            UploadFile1.CanUpload = false;
            UploadFile1.CanDelete = false;

            gv_List.Columns[0].Visible = false;
            gv_List.SetControlsEnable(false);
        }

        UploadFile1.RelateID = (int)ViewState["ID"];
        UploadFile1.BindGrid();
    }
예제 #7
0
    public void BindData()
    {
        KB_ArticleBLL bll = new KB_ArticleBLL((int)ViewState["ID"]);

        panel1.BindData(bll.Model);
        this.txt_approve_idea.Text = bll.Model.ApproveStaffIdeas;
        btn_ok.Text         = "修改";
        ckedit_content.Text = bll.Model.Content.Replace("\r", "<br/>");

        if (bll.Model.HasApproved == "Y")
        {
            //btn_ok.Visible = false;
            tr_Approve.Visible = false;
        }

        UploadFile1.BindGrid();
    }
    private void BindGrid()
    {
        UploadFile1.RelateID  = int.Parse(select_Client.SelectValue);
        UploadFile1.BeginTime = DateTime.Parse(this.tbx_begin.Text);
        UploadFile1.EndTime   = DateTime.Parse(this.tbx_end.Text).AddDays(1);
        CM_ClientBLL client = new CM_ClientBLL(UploadFile1.RelateID);

        if (client.Model.ClientType == 2 && client.Model["ContractProve"] != null)
        {
            string Atmts = "";
            foreach (string _c in client.Model["ContractProve"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                Atmts += DictionaryBLL.GetDicCollections("CM-ContractProve")[_c].Name + ",";
            }
            if (Atmts != "")
            {
                lbl_message.Text = "该经销商必须上传以下附件," + Atmts + "并在【名称】中填相应附件名";
            }
        }

        string extcondition = "";

        if (tbx_FindName.Text != "")
        {
            extcondition = " Name like '%" + tbx_FindName.Text + "%' ";
        }

        if (cb_OnlyPic.Checked)
        {
            if (extcondition != "")
            {
                extcondition += " AND ";
            }
            extcondition += "lower(ExtName) in ('bmp','jpg','gif','png')";
        }
        UploadFile1.ExtCondition = extcondition;

        UploadFile1.BindGrid();
    }
예제 #9
0
    private void BindGrid()
    {
        int    approveflag;
        string CanComment;

        #region 显示公告主题内容
        PN_NoticeBLL noticebll = new PN_NoticeBLL(Convert.ToInt32(ViewState["ID"]));
        lbl_Topic.Text   = noticebll.Model.Topic.ToString();
        lbl_content.Text = noticebll.Model.Content.ToString();

        PN_HasReadStaffBLL hasReadStaffbll = new PN_HasReadStaffBLL();
        PN_CommentBLL      commentbll      = new PN_CommentBLL();
        lab_hasRead.Text = hasReadStaffbll.GetReadCountByNotice(Convert.ToInt32(ViewState["ID"])).ToString();
        lab_comment.Text = commentbll.GetCommentCountByNotice(Convert.ToInt32(ViewState["ID"])).ToString();

        insertstaff = int.Parse(noticebll.Model.InsertStaff.ToString());
        lbl_InsertStaffName.Text = new Org_StaffBLL(insertstaff).Model.RealName;
        lbl_InsertTime.Text      = noticebll.Model.InsertTime.ToString();
        approveflag          = noticebll.Model.ApproveFlag;   //是否可以添加评论
        CanComment           = noticebll.Model.CanComment;    //审核标志
        ViewState["Catalog"] = noticebll.Model["Catalog"];
        #endregion

        #region 展示附件
        UploadFile1.RelateID = Convert.ToInt32(ViewState["ID"]);
        UploadFile1.BindGrid();
        #endregion

        #region 初始化时折叠评论内容和评论板
        //UpdatePanel1.Visible = false;
        #endregion

        #region 判断此公告是否可以评论
        if (CanComment == "N")
        {
            btn_LookComment.Visible = false;
        }
        #endregion
    }
예제 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            btnCancel.Attributes.Add("onclick", "javascript:if(confirm('确定要删除吗?')){}else{return false;}");

            ViewState["ID"]         = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);
            ViewState["Enable"]     = false;
            select_promotor.PageUrl = "Search_SelectPromotor.aspx?ExtCondition=PM_Promotor.ID IN (SELECT Promotor FROM MCS_Promotor.dbo.PM_SalaryDetail WHERE SalaryID=" + ViewState["ID"] + ")";
            if ((int)ViewState["ID"] > 0)
            {
                BindData();
                UploadFile1.RelateID = (int)ViewState["ID"];
                UploadFile1.BindGrid();
            }
            else
            {
                Response.Redirect("PM_SalaryList.aspx");
            }
        }
        enableflag = (bool)ViewState["Enable"];
    }
예제 #11
0
    private void BindData()
    {
        JN_Journal m = new JN_JournalBLL((int)ViewState["ID"]).Model;

        Org_StaffBLL staff = new Org_StaffBLL(m.Staff, true);

        select_Staff.SelectValue = m.Staff.ToString();
        select_Staff.SelectText  = staff.Model.RealName;
        select_Staff.Enabled     = false;
        Org_PositionBLL position = new Org_PositionBLL(staff.Model.Position);

        lbl_Position.Text = position.Model.Name;

        ddl_JournalType.SelectedValue = m.JournalType.ToString();
        ddl_JournalType_SelectedIndexChanged(null, null);
        ddl_JournalType.Enabled = false;

        tbx_begindate.Text = m.BeginTime.ToString("yyyy-MM-dd");
        tbx_enddate.Text   = m.EndTime.ToString("yyyy-MM-dd");
        try
        {
            ddl_BeginHour.SelectedValue   = m.BeginTime.Hour.ToString("d2");
            ddl_BeginMinute.SelectedValue = m.BeginTime.Minute.ToString("d2");
            ddl_EndHour.SelectedValue     = m.EndTime.Hour.ToString("d2");
            ddl_EndMinute.SelectedValue   = m.EndTime.Minute.ToString("d2");
        }
        catch { }

        ddl_WorkingClassify.SelectedValue = m.WorkingClassify.ToString();
        ddl_WorkingClassify_SelectedIndexChanged(null, null);
        ddl_WorkingClassify.Enabled = false;

        pl_detail.BindData(m);

        rbl_HasSynergeticStaff_SelectedIndexChanged(null, null);

        select_RelateClient_SelectChange(null, null);
        if (ddl_RelateLinkMan.Items.FindByValue(m.RelateLinkMan.ToString()) != null)
        {
            ddl_RelateLinkMan.SelectedValue = m.RelateLinkMan.ToString();
        }

        if (m.WorkingClassify == 1 && m.RelateLinkMan > 0)
        {
            //客户拜访
            bt_AddNewClient.OnClientClick = "javascript:OpenClientInput(" + m.ID.ToString() + "," + m.RelateLinkMan + ",0)";
            bt_AddNewClient.Enabled       = true;
        }
        else if (m.WorkingClassify == 3 && !string.IsNullOrEmpty(m["RelateActivity"]))
        {
            //活动举办
            bt_AddNewClient.OnClientClick = "javascript:OpenClientInput(" + m.ID.ToString() + ",0," + m["RelateActivity"] + ")";
            bt_AddNewClient.Enabled       = true;
        }
        else
        {
            bt_AddNewClient.Enabled = false;
        }
        #region 显示日志填报时的IP地址
        TextBox tbx_IPAddress = (TextBox)pl_detail.FindControl("JN_Journal_IPAddress");
        if (m["IPAddress"] != "" && m["IPLocation"] == "")
        {
            TextBox tbx_IPLocation = (TextBox)pl_detail.FindControl("JN_Journal_IPLocation");
            userAddress = Const_IPLocationBLL.FindByIP(Request.UserHostAddress);
            if (tbx_IPLocation != null)
            {
                tbx_IPLocation.Text = userAddress != null ? userAddress.Location : "";
            }
        }
        #endregion

        Label lbl_InsertStaff = (Label)pl_detail.FindControl("JN_Journal_InsertStaff");

        if (lbl_InsertStaff != null)
        {
            Org_StaffBLL    _staff    = new Org_StaffBLL(m.InsertStaff, true);
            Org_PositionBLL _position = new Org_PositionBLL(_staff.Model.Position);
            lbl_InsertStaff.Text = lbl_InsertStaff.Text + "(职位:" + _position.Model.Name + ")";
        }

        if (m.InsertStaff != (int)Session["UserID"] || m.ApproveFlag == 1 || (DateTime.Today - m.InsertTime.Date).Days > 7)
        {
            ddl_JournalType.Enabled     = false;
            tbx_begindate.Enabled       = false;
            ddl_WorkingClassify.Enabled = false;
            ddl_BeginHour.Enabled       = false;
            ddl_BeginMinute.Enabled     = false;
            ddl_EndHour.Enabled         = false;
            ddl_EndMinute.Enabled       = false;

            pl_detail.SetControlsEnable(false);
            TextBox tbx_remark = pl_detail.FindControl("JN_Journal_Remark") != null ?
                                 (TextBox)pl_detail.FindControl("JN_Journal_Remark") : null;
            if (tbx_remark != null)
            {
                tbx_remark.Enabled  = true;
                tbx_remark.ReadOnly = true;
            }
            UploadFile1.CanDelete = false;
            UploadFile1.CanUpload = false;
            bt_OK.Visible         = false;
            bt_Delete.Visible     = false;
        }

        if ((DateTime.Today - m.InsertTime.Date).Days > 0)
        {
            bt_Delete.Visible = false;                                                      //只能删除当日填写的日志
        }
        #region 展示附件
        UploadFile1.RelateID   = (int)ViewState["ID"];
        UploadFile1.RelateType = 90;
        UploadFile1.BindGrid();
        #endregion

        int commentcounts = JN_JournalCommentBLL.GetModelList("JournalID=" + ViewState["ID"].ToString()).Count;
        lb_CommentCounts.Text = commentcounts.ToString();
        if (commentcounts > 0)
        {
            table_comment.Visible = true;
            BindGridList();
            btn_LookComment.Visible = false;
        }
    }
예제 #12
0
    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() + "人,请注意!";
        }
    }
예제 #13
0
    private void BindData()
    {
        PN_NoticeBLL bll = new PN_NoticeBLL((int)ViewState["ID"]);

        UC_Notice.BindData(bll.Model);
        if (bll.Model["Catalog"] != "")
        {
            ViewState["Catalog"] = int.Parse(bll.Model["Catalog"]);
        }

        if (bll.Model.ApproveFlag == 1)
        {
            bt_Approve.Visible = false;
            bt_OK.Visible      = false;

            bt_Clear1.Visible  = false;
            bt_Detele1.Visible = false;
            bt_Insert1.Visible = false;
            bt_Clear2.Visible  = false;
            bt_Detele2.Visible = false;
            bt_Insert2.Visible = false;

            bt_PreView.Visible    = false;
            UploadFile1.CanDelete = false;
            UploadFile1.CanUpload = false;
        }

        tab_PNToPosition.Visible     = bll.Model.ToAllStaff == "N";
        tab_PNToOrganizeCity.Visible = bll.Model.ToAllOrganizeCity == "N";

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

        #region 显示所属职位,片区
        if (tab_PNToPosition.Visible)
        {
            List <int> List = new List <int>();
            List = PN_ToPositionBLL.GetPositionByNoticeID((int)ViewState["ID"]);
            lb_PositionChild.Items.Clear();
            if (List != null)
            {
                foreach (int id in List)
                {
                    Org_PositionBLL positionbll = new Org_PositionBLL(id);
                    lb_PositionChild.Items.Add(new ListItem(positionbll.Model.Name, id.ToString()));
                }
            }
        }

        if (tab_PNToOrganizeCity.Visible)
        {
            List <int> List = new List <int>();
            List = PN_ToOrganizeCityBLL.GetOrganizeCityByNoticeID((int)ViewState["ID"]);
            lb_CityChild.Items.Clear();
            if (List != null)
            {
                foreach (int id in List)
                {
                    Addr_OrganizeCityBLL organizeCitybll = new Addr_OrganizeCityBLL(id);
                    lb_CityChild.Items.Add(new ListItem(organizeCitybll.Model.Name, id.ToString()));
                }
            }
        }
        #endregion

        ckedit_content.Text = bll.Model.Content;
    }
예제 #14
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;
        //}
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        #region 获取界面控件
        tr_OfficialCity = UC_DetailView1.FindControl("PM_Promotor_OfficialCity") == null ? null : (MCSTreeControl)UC_DetailView1.FindControl("PM_Promotor_OfficialCity");
        tr_OrganizeCity = UC_DetailView1.FindControl("PM_Promotor_OrganizeCity") == null ? null : (MCSTreeControl)UC_DetailView1.FindControl("PM_Promotor_OrganizeCity");
        txt_IDCode      = UC_DetailView1.FindControl("PM_Promotor_IDCode") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_IDCode");
        txt_Name        = UC_DetailView1.FindControl("PM_Promotor_Name") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_Name");
        txt_AccountName = UC_DetailView1.FindControl("PM_Promotor_AccountName") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_AccountName");
        ddl_BankType    = UC_DetailView1.FindControl("PM_Promotor_BankType") == null ? null : (DropDownList)UC_DetailView1.FindControl("PM_Promotor_BankType");
        txt_BankName    = UC_DetailView1.FindControl("PM_Promotor_BankName") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_BankName");
        ddl_Classify    = UC_DetailView1.FindControl("PM_Promotor_Classfiy") == null ? null : (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Classfiy");
        if (ddl_BankType != null)
        {
            ddl_BankType.AutoPostBack          = true;
            ddl_BankType.SelectedIndexChanged += new EventHandler(ddl_BankType_SelectedIndexChanged);
        }
        if (ddl_Classify != null)
        {
            ddl_Classify.AutoPostBack          = true;
            ddl_Classify.SelectedIndexChanged += new EventHandler(ddl_Classify_SelectedIndexChanged);
        }
        if (tr_OrganizeCity != null)
        {
            tr_OrganizeCity.AutoPostBack = true;
            tr_OrganizeCity.Selected    += new SelectedEventHandler(tr_OrganizeCity_Selected);
        }
        if (txt_IDCode != null)
        {
            txt_IDCode.AutoPostBack = true;
            txt_IDCode.TextChanged += new EventHandler(txt_IDCode_TextChanged);
        }
        if (txt_Name != null)
        {
            txt_Name.AutoPostBack = true;
            txt_Name.TextChanged += new EventHandler(txt_Name_TextChanged);
        }
        #endregion

        if (!Page.IsPostBack)
        {
            ViewState["PromotorID"] = Request.QueryString["PromotorID"] == null ? 0 : int.Parse(Request.QueryString["PromotorID"]);

            if ((int)ViewState["PromotorID"] > 0)
            {
                BindDropDown();
                BindData();

                UploadFile1.RelateID = (int)ViewState["PromotorID"];
                UploadFile1.BindGrid();
            }
            else
            {
                Org_Staff s = new Org_StaffBLL((int)Session["UserID"]).Model;
                if (s != null)
                {
                    if (tr_OfficialCity != null)
                    {
                        tr_OfficialCity.SelectValue = s.OfficialCity.ToString();
                    }
                    if (tr_OrganizeCity != null)
                    {
                        tr_OrganizeCity.SelectValue = s.OrganizeCity.ToString();
                    }
                }

                DropDownList ddl_SalaryFlag = (DropDownList)UC_DetailView1.FindControl("PM_Promotor_SalaryFlag");
                if (ddl_SalaryFlag != null)
                {
                    ddl_SalaryFlag.SelectedValue = "1";
                }

                DropDownList ddl_Dimission = (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Dimission");
                if (ddl_Dimission != null)
                {
                    ddl_Dimission.Enabled       = false;
                    ddl_Dimission.SelectedValue = "1";
                }
                TextBox tbx_EndWorkDate = (TextBox)UC_DetailView1.FindControl("PM_Promotor_EndWorkDate");
                if (tbx_EndWorkDate != null)
                {
                    tbx_EndWorkDate.Enabled = false;
                }

                tbl_Promotor.Visible       = false;
                UploadFile1.Visible        = false;
                gv_list.Visible            = false;
                bt_AddApply.Visible        = false;
                bt_Approve.Visible         = false;
                bt_RevocationApply.Visible = false;
            }

            //根据管理片区,获取可用的薪酬级别
            tr_OrganizeCity_Selected(null, null);
        }

        #region 给账号/开户行文本框添加事件
        //TextBox tbx_BankName = (TextBox)UC_DetailView1.FindControl("PM_Promotor_BankName");
        //tbx_BankName.AutoPostBack = true;
        //tbx_BankName.TextChanged += new EventHandler(tbx_Bank_TextChanged);
        TextBox tbx_BankAccountNo = (TextBox)UC_DetailView1.FindControl("PM_Promotor_AccountCode");
        tbx_BankAccountNo.AutoPostBack = true;
        tbx_BankAccountNo.TextChanged += new EventHandler(tbx_Bank_TextChanged);
        #endregion

        if ((int)ViewState["PromotorID"] == 0)
        {
            MCSTabControl1.Items[1].Visible = false;
        }
        string script = "function PopPMClassify_Approve(id){\r\n";
        script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/PM/PMClassify_Approve.aspx?PromotorID=' + id ") +
                  ", window, 'dialogWidth:930px;DialogHeight=600px;status:yes;resizable=yes');}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopPMClassify_Approve", script, true);
    }