예제 #1
0
    protected void select_Client_SelectChange(object sender, MCSControls.MCSWebControls.SelectChangeEventArgs e)
    {
        bt_Generate.Enabled = true;
        int organizecity = 0;
        int client       = 0;
        int month        = 0;

        int.TryParse(tr_OrganizeCity.SelectValue, out organizecity);
        int.TryParse(select_Client.SelectValue, out client);
        int.TryParse(ddl_Month.SelectedValue, out month);
        DataTable promotors = PM_PromotorBLL.GetByDIClient(organizecity, client, month);



        if (promotors.Select("ErrType=2").Count() > 0)
        {
            promotors.DefaultView.RowFilter = "ErrType=2";
            gv_List.DataSource = promotors.DefaultView.ToTable();
            gv_List.DataBind();
            gv_Table.Visible    = true;
            bt_Generate.Enabled = false;
            MessageBox.Show(this, "对不起,有部分导购员的薪酬定义没有正确维护,请正确设定薪酬定义信息后,再生成工资!");
        }



        if (promotors.Select("ErrType=3").Count() > 0)
        {
            promotors.DefaultView.RowFilter = "ErrType=3";
            gv_List.DataSource = promotors.DefaultView.ToTable();
            gv_List.DataBind();
            gv_Table.Visible    = true;
            bt_Generate.Enabled = false;
            MessageBox.Show(this, "对不起,片区内有导购专兼职转换流程未完成,需审批完成后才可生成工资(生成工资前请到奖惩设定与调整项中刷新提成)!");
        }

        if (promotors.Select("ErrType=1").Count() > 0)
        {
            promotors.DefaultView.RowFilter = "ErrType=1";
            gv_List.DataSource = promotors.DefaultView.ToTable();
            gv_List.DataBind();
            gv_Table.Visible = true;
            MessageBox.Show(this, "以下导购员所在门店已生成返利费用或有生效返利协议,不能生成工资,请确认是否排除这些导购?");
        }
    }
    private void BindGrid()
    {
        string promotors = "";
        AC_AccountMonth month = new AC_AccountMonthBLL(int.Parse(ddl_AccountMonth.SelectedValue)).Model;
        int monthdays = month.EndDate.Subtract(month.BeginDate).Days + 1;
        lbl_message.Text = "注意:所选会计月天数为:" + monthdays.ToString() + "天,实际工作天数不能大于会计月天数";
        ViewState["monthdays"] = monthdays;
        string condition = "PM_SalaryDataObject.AccountMonth=" + ddl_AccountMonth.SelectedValue;
        if (tr_OrganizeCity.SelectValue != "1")
        {
            Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue));
            string orgcitys = orgcity.GetAllChildNodeIDs();
            if (orgcitys != "") orgcitys += ",";
            orgcitys += tr_OrganizeCity.SelectValue;
            condition += " AND  MCS_Promotor.dbo.PM_Promotor.OrganizeCity in(" + orgcitys + ") ";
        }
        if (select_promotor.SelectValue != "")
        {
            condition += " AND  MCS_Promotor.dbo.PM_Promotor.ID=" + select_promotor.SelectValue;
        }
        if (ddl_ApproveFlag.SelectedValue != "0")
        {
            condition += " AND  PM_SalaryDataObject.ApproveFlag=" + ddl_ApproveFlag.SelectedValue;
        }
        if (select_Client.SelectValue != "")
        {
            DataTable tb_promotor = PM_PromotorBLL.GetByDIClient(int.Parse(tr_OrganizeCity.SelectValue), int.Parse(select_Client.SelectValue), month.ID);
            foreach (DataRow row in tb_promotor.Rows)
            {
                promotors += row["Promotor"].ToString() + ",";
            }
            if (promotors != "")
                promotors = " AND PM_SalaryDataObject.Promotor IN (" + promotors.Substring(0, promotors.Length - 1) + ")";
            else
                promotors = " AND 1 = 2";

        }
        gv_List.ConditionString = condition + promotors;
        gv_List.BindGrid();
        chkHeader.Checked = false;
    }