private void BindGrid()
    {
        int month = 0, organizecity = 0, staff = 0;

        if (int.TryParse(ddl_AccountMonth.SelectedValue, out month) && int.TryParse(tr_OrganizeCity.SelectValue, out organizecity))
        {
            string condition = "AccountMonth = " + month.ToString() + " AND TrackDate IS NULL";
            int.TryParse(select_Staff.SelectValue, out staff);

            if (staff > 0)
            {
                string            client = string.Empty;
                IList <CM_Client> list   = CM_ClientBLL.GetModelList(" OrganizeCity =" + organizecity + " AND ClientType = 3 AND ActiveFlag = 1 AND ApproveFlag = 1 AND [MCS_SYS].[dbo].[UF_Spilt](ExtPropertys,'|',27) = '1' AND ClientManager = " + staff.ToString());
                if (list != null && list.Count > 0)
                {
                    foreach (CM_Client item in list)
                    {
                        client += item.ID.ToString() + ",";
                    }
                    client = client.Substring(0, client.Length - 1);
                }
                if (!string.IsNullOrEmpty(client))
                {
                    condition += " AND (Staff = " + staff.ToString() + " OR Client in(" + client + "))";
                }
                else
                {
                    condition += " AND Staff = " + staff.ToString();
                }
            }
            if (organizecity > 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 OrganizeCity IN (" + orgcitys + ")";
            }
            if (ddl_IsSubmit.SelectedValue != "0")
            {
                condition += " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',5)='" + ddl_IsSubmit.SelectedItem.Text + "'";
            }

            gv_List.BindGrid(TC_TrackCardBLL.GetModelList(condition));
            cbx_CheckAll.Checked = false;
        }
    }
Esempio n. 2
0
    private void BindGrid()
    {
        int      month = 0, organizecity = 0, staff = 0;
        DateTime trackdate = DateTime.Today;

        if (int.TryParse(tr_OrganizeCity.SelectValue, out organizecity) && DateTime.TryParse(tbx_TrackDate.Text, out trackdate))
        {
            month = AC_AccountMonthBLL.GetMonthByDate(trackdate);

            string condition = "TrackDate = '" + trackdate.ToString("yyyy-MM-dd") + "'";
            int.TryParse(select_Staff.SelectValue, out staff);

            if (staff > 0)
            {
                condition += " AND Staff = " + staff.ToString();
            }
            if (organizecity > 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 OrganizeCity IN (" + orgcitys + ")";
            }

            if (ddl_IsSubmit.SelectedValue != "0")
            {
                condition += " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',5)='" + ddl_IsSubmit.SelectedItem.Text + "'";
            }

            IList <TC_TrackCard> list = TC_TrackCardBLL.GetModelList(condition);
            gv_List.BindGrid <TC_TrackCard>(list);
        }
    }