Esempio n. 1
0
    protected void bt_Export_Click(object sender, EventArgs e)
    {
        string condition = "";

        if (tbx_ContractID.Text.Trim() != "")
        {
            int id = 0;
            if (int.TryParse(tbx_ContractID.Text, out id))
            {
                condition = " AND CM_Contract.ID=" + id;
            }
            else
            {
                MessageBox.Show(this, "协议ID填写有问题!");
                tbx_ContractID.Focus();
            }
        }
        else
        {
            if (select_OrgSupplier.SelectValue != "" && select_OrgSupplier.SelectValue != "0")
            {
                condition = " AND CM_Contract.Client=" + select_OrgSupplier.SelectValue;
            }
        }
        DataTable dt = CM_ContractBLL.GetApproveSummary(int.Parse(tr_OrganizeCity.SelectValue), int.Parse(ddl_State.SelectedValue), (int)Session["UserID"], int.Parse(MCSTabControl1.SelectedTabItem.Value), int.Parse(ddl_PayMode.SelectedValue), condition);;

        //string name = "";
        //if (MCSTabControl1.SelectedIndex == 0)
        //    name = "零售商导购协议导出";
        //else name = "零售商返利协议导出";
        // CreateExcel(dt, "Export-" + name + DateTime.Now.ToString("yyyyMMdd-HHmmss"));
        getExcel(dt);
    }
Esempio n. 2
0
    private void BindGrid()
    {
        if (ddl_State.SelectedValue != "1")
        {
            btn_Approve.Visible   = false;
            btn_UnApprove.Visible = false;
        }
        string condition = "";

        if (tbx_ContractID.Text.Trim() != "")
        {
            int id = 0;
            if (int.TryParse(tbx_ContractID.Text, out id))
            {
                condition = " AND CM_Contract.ID=" + id;
            }
            else
            {
                MessageBox.Show(this, "协议ID填写有问题!");
                tbx_ContractID.Focus();
            }
        }
        else
        {
            if (select_OrgSupplier.SelectValue != "" && select_OrgSupplier.SelectValue != "0")
            {
                condition = " AND CM_Contract.Client=" + select_OrgSupplier.SelectValue;
            }
        }
        gv_List.DataSource = CM_ContractBLL.GetApproveSummary(int.Parse(tr_OrganizeCity.SelectValue), int.Parse(ddl_State.SelectedValue), (int)Session["UserID"], int.Parse(MCSTabControl1.SelectedTabItem.Value), int.Parse(ddl_PayMode.SelectedValue), condition);
        if (ddl_State.SelectedValue != "1")
        {
            gv_List.Columns[1].Visible = false;
        }
        gv_List.BindGrid();
    }