private void BindDropdown()
    {
        IList <AC_AccountMonth> _monthlist = AC_AccountMonthBLL.GetModelList("");

        ddl_AccountMonth.DataSource = _monthlist;
        ddl_AccountMonth.DataBind();

        ddl_AccountMonth2.DataSource = AC_AccountMonthBLL.GetModelList("Year>=" + (DateTime.Now.Year - 1).ToString());
        ddl_AccountMonth2.DataBind();


        int JXCDelayDays = ConfigHelper.GetConfigInt("JXCDelayDays");

        ddl_AccountMonth.SelectedValue = (AC_AccountMonthBLL.GetCurrentMonth() - 1).ToString();

        ddl_AccountMonth2.SelectedValue = "0";


        select_Staff.SelectValue = Session["UserID"].ToString();
        select_Staff.SelectText  = Session["UserRealName"].ToString();

        if ((int)(ViewState["IsOpponent"]) != 2 && (int)(ViewState["IsOpponent"]) != 3)
        {
            ddl_Opponent.SelectedValue = ViewState["IsOpponent"].ToString();
        }

        string condition = " 1=1 ";

        if (!string.IsNullOrEmpty(ConfigHelper.GetConfigString("OrganizePartCity-CityLevel")))
        {
            condition = " Level=" + ConfigHelper.GetConfigString("OrganizePartCity-CityLevel");
        }

        ddl_OrganizeCity.DataSource     = Addr_OrganizeCityBLL.GetModelList(condition);
        ddl_OrganizeCity.DataTextField  = "Name";
        ddl_OrganizeCity.DataValueField = "ID";
        ddl_OrganizeCity.DataBind();
        ddl_OrganizeCity.Items.Insert(0, new ListItem("请选择", "0"));

        ddl_ExcelState.DataSource = DictionaryBLL.GetDicCollections((int)(ViewState["State"]) == 2 ? "SVM_UploadState" : "SVM_DownloadState");
        ddl_ExcelState.DataBind();
        ddl_ExcelState.Items.Insert(0, new ListItem("所有", "0"));

        ddl_ExcelState2.DataSource = ddl_ExcelState.DataSource;
        ddl_ExcelState2.DataBind();
        ddl_ExcelState2.Items.Insert(0, new ListItem("所有", "0"));
        if ((int)(ViewState["State"]) == 1)
        {
            ddl_ExcelState.SelectedValue  = "2";
            ddl_ExcelState2.SelectedValue = "2";
        }


        MCSTabControl1.SelectedIndex = (int)ViewState["State"] - 1;

        ddl_ClientType.SelectedValue = ViewState["ClientType"].ToString();
    }
Esempio n. 2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            HSSFWorkbook book  = new HSSFWorkbook();
            ISheet       sheet = book.CreateSheet("季度费率");

            sheet.SetColumnWidth(0, 12 * 256);
            sheet.SetColumnWidth(2, 20 * 256);
            sheet.SetColumnWidth(3, 12 * 256);
            sheet.SetColumnWidth(4, 20 * 256);
            sheet.SetColumnWidth(5, 16 * 256);
            sheet.SetColumnWidth(6, 12 * 256);
            int  rowcount = 0;
            IRow row      = sheet.CreateRow(rowcount);

            row.CreateCell(0).SetCellValue("营业部");
            row.CreateCell(1).SetCellValue("办事处ID");
            row.CreateCell(2).SetCellValue("办事处");
            row.CreateCell(3).SetCellValue("归属季度ID");
            row.CreateCell(4).SetCellValue("归属季度");
            row.CreateCell(5).SetCellValue("季度预算费率");
            row.CreateCell(6).SetCellValue("季度实际费率");
            row.CreateCell(7).SetCellValue("导入标志");

            IList <Addr_OrganizeCity> _cityList = Addr_OrganizeCityBLL.GetModelList("Level=4 Order By Level3_SuperID");

            foreach (Addr_OrganizeCity city in _cityList)
            {
                row = sheet.CreateRow(++rowcount);
                row.CreateCell(0).SetCellValue(new Addr_OrganizeCityBLL(city.SuperID).Model.Name);
                row.CreateCell(1).SetCellValue(city.ID);
                row.CreateCell(2).SetCellValue(city.Name);
                row.CreateCell(3).SetCellValue(cmb_Quarter.SelectedValue.ToString());
                row.CreateCell(4).SetCellValue(cmb_Quarter.SelectedText);
                row.CreateCell(5).SetCellValue("");
                row.CreateCell(6).SetCellValue("");
                row.CreateCell(7).SetCellValue("");

                worker.ReportProgress(rowcount * 100 / _cityList.Count, rowcount);
            }


            //保存
            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
            {
                book.Write(fs);
            }
            book  = null;
            sheet = null;
        }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            HSSFWorkbook book  = new HSSFWorkbook();
            ISheet       sheet = book.CreateSheet("办事处目标");

            sheet.SetColumnWidth(0, 12 * 256);
            sheet.SetColumnWidth(2, 20 * 256);
            sheet.SetColumnWidth(3, 12 * 256);
            sheet.SetColumnWidth(4, 20 * 256);
            sheet.SetColumnWidth(5, 16 * 256);
            sheet.SetColumnWidth(6, 12 * 256);
            int  rowcount = 0;
            IRow row      = sheet.CreateRow(rowcount);

            row.CreateCell(0).SetCellValue("营业部");
            row.CreateCell(1).SetCellValue("办事处ID");
            row.CreateCell(2).SetCellValue("办事处");
            row.CreateCell(3).SetCellValue("归属月份");
            row.CreateCell(4).SetCellValue("办事处业绩目标额");
            row.CreateCell(5).SetCellValue("导入标志");

            IList <Addr_OrganizeCity> _cityList = Addr_OrganizeCityBLL.GetModelList("Level=4 Order By Level3_SuperID");
            AC_AccountMonthBLL        monthbll  = new AC_AccountMonthBLL(AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddMonths(-1)));

            foreach (Addr_OrganizeCity city in _cityList)
            {
                row = sheet.CreateRow(++rowcount);
                row.CreateCell(0).SetCellValue(new Addr_OrganizeCityBLL(city.SuperID).Model.Name);
                row.CreateCell(1).SetCellValue(city.ID);
                row.CreateCell(2).SetCellValue(city.Name);
                row.CreateCell(3).SetCellValue(monthbll.Model.Name);
                row.CreateCell(4).SetCellValue("");
                row.CreateCell(5).SetCellValue("");

                worker.ReportProgress(rowcount * 100 / _cityList.Count, rowcount);
            }


            //保存
            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
            {
                book.Write(fs);
            }
            book  = null;
            sheet = null;
        }
    private void BindGrid()
    {
        if (ViewState["ClientID"] != null)
        {
            CM_ClientBLL bll = new CM_ClientBLL((int)ViewState["ClientID"]);

            #region 绑定住宿人员
            gv_Staff.ConditionString = "MCS_CM.dbo.CM_StaffInProperty.Client = " + ViewState["ClientID"].ToString() + " AND Org_Staff.Dimission=1";
            gv_Staff.BindGrid();
            #endregion

            #region 绑定兼管片区
            if (bll.Model.OrganizeCity > 1)
            {
                ddl_PropertyInOrganizeCity.Items.Clear();

                int superid = new Addr_OrganizeCityBLL(bll.Model.OrganizeCity).Model.SuperID;
                IList <Addr_OrganizeCity> lists = Addr_OrganizeCityBLL.GetModelList("SuperID = " + superid.ToString() +
                                                                                    " AND ID <> " + bll.Model.OrganizeCity.ToString() +
                                                                                    " AND ID NOT IN (SELECT OrganizeCity FROM MCS_CM.dbo.CM_PropertyInOrganizeCity WHERE Client=" + bll.Model.ID.ToString() + ")");
                if (lists.Count > 0)
                {
                    foreach (Addr_OrganizeCity city in lists)
                    {
                        ddl_PropertyInOrganizeCity.Items.Add(new ListItem("(" + city.Code + ")" + city.Name, city.ID.ToString()));
                    }
                }

                ddl_PropertyInOrganizeCity.Items.Insert(0, new ListItem("请选择...", "0"));

                gv_PropertyInOrganizeCity.BindGrid <Addr_OrganizeCity>(bll.ClientInOrganizeCity_GetOrganizeCitys());
            }
            else
            {
                tr_PropertyInOrganizeCity.Visible = false;
            }
            #endregion

            #region 绑定电话列表
            gv_Telephone.ConditionString = "Client=" + bll.Model.ID.ToString();
            gv_Telephone.BindGrid();
            #endregion

            #region 绑定合同列表
            gv_List_Contract.BindGrid(CM_ContractBLL.GetModelList("Client=" + bll.Model.ID.ToString()));
            #endregion
        }
    }
    private void Init()
    {
        IList <Addr_OrganizeCity> citys = Addr_OrganizeCityBLL.GetModelList
                                              ("Level=2 AND ID NOT IN (SELECT OrganizeCity FROM MCS_FNA.dbo.FNA_BudgetSource WHERE AccountMonth=" +
                                              ddl_AccountMonth.SelectedValue + ") ORDER BY SuperID,Code");

        foreach (Addr_OrganizeCity city in citys)
        {
            FNA_BudgetSourceBLL bll = new FNA_BudgetSourceBLL();
            bll.Model.AccountMonth        = int.Parse(ddl_AccountMonth.SelectedValue);
            bll.Model.OrganizeCity        = city.ID;
            bll.Model.ApproveFlag         = 2;
            bll.Model.InsertStaff         = (int)Session["UserID"];
            bll.Model["DepartmentBudget"] = "0";
            bll.Add();
        }
    }
    private void BindDropDown()
    {
        chk_Citylist.DataSource = Addr_OrganizeCityBLL.GetModelList("Level=" + ConfigHelper.GetConfigString("OrganizePartCity-CityLevel"));
        chk_Citylist.DataBind();

        if ((int)ViewState["Type"] == 2)
        {
            MCSTabControl1.SelectedIndex = 2;
            tb_step1.Visible             = MCSTabControl1.SelectedIndex == 0;
        }
        IList <PDT_Brand> _brandList = PDT_BrandBLL.GetModelList("IsOpponent=1");

        ddl_Brand.DataTextField  = "Name";
        ddl_Brand.DataValueField = "ID";
        ddl_Brand.DataSource     = _brandList;
        ddl_Brand.DataBind();
        ddl_Brand.Items.Insert(0, new ListItem("全部", "0"));
        //CheckOrganizeCity();
        ddl_AccountMonth.DataSource = AC_AccountMonthBLL.GetModelList("");
        ddl_AccountMonth.DataBind();
        ddl_AccountMonth.SelectedValue = (AC_AccountMonthBLL.GetCurrentMonth() - 1).ToString();
    }
    private void BindData(int ID)
    {
        ViewState["ID"] = ID;

        Addr_OrganizeCityBLL _bll = new Addr_OrganizeCityBLL(ID);

        lbl_ID.Text   = _bll.Model.ID.ToString();
        tbx_Name.Text = _bll.Model.Name;
        if (_bll.Model.SuperID != 0)
        {
            tree_SuperID.SelectValue = _bll.Model.SuperID.ToString();
        }
        tbx_Code.Text = _bll.Model.Code;

        if (_bll.Model.Manager != 0)
        {
            select_Manager.SelectValue = _bll.Model.Manager.ToString();
            select_Manager.SelectText  = new Org_StaffBLL(_bll.Model.Manager).Model.RealName;
        }
        else
        {
            select_Manager.SelectValue = "";
            select_Manager.SelectText  = "";
        }

        if (_bll.Model.Level != 0)
        {
            lbl_LevelName.Text = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel")[_bll.Model.Level.ToString()].Name;
        }

        tbx_ManageRegion.Text = _bll.Model["ManageRegion"];

        if (ID == 1)
        {
            btn_Save.Visible   = false;
            btn_Delete.Visible = false;
        }
        else
        {
            btn_Save.Visible   = true;
            btn_Delete.Visible = true;
        }
        bt_AddSub.Visible = true;
        MessageBox.ShowConfirm(btn_Delete, "数据删除将不可恢复,确定删除么?");

        btn_Delete.Visible = Addr_OrganizeCityBLL.GetModelList("SuperID=" + ViewState["ID"].ToString()).Count == 0;
        lbl_AlertInfo.Text = "";


        #region 绑定已关联的行政区县列表
        if (_bll.Model.Level.ToString() == ConfigHelper.GetConfigString("OrganizeCity-CityLevel"))
        {
            tb_OfficialCityInOrganizeCity.Visible = true;
            cb_CheckAll.Checked = false;
            cbl_OfficialList.Items.Clear();
            IList <Addr_OfficialCityInOrganizeCity> lists = Addr_OfficialCityInOrganizeCityBLL.GetModelList("OrganizeCity = " + ID.ToString());
            foreach (Addr_OfficialCityInOrganizeCity e in lists)
            {
                Addr_OfficialCityBLL city = new Addr_OfficialCityBLL(e.OfficialCity);
                string   fullname         = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", city.Model.ID);
                ListItem item             = new ListItem(fullname, e.ID.ToString());

                cbl_OfficialList.Items.Add(item);
            }
            bt_AddOfficialCity.OnClientClick = "PopAddOfficialCity(" + ID.ToString() + ")";
        }
        else
        {
            tb_OfficialCityInOrganizeCity.Visible = false;
        }
        #endregion
    }
    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() + "人,请注意!";
        }
    }
Esempio n. 9
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;
        //}
    }