protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_ClientPaymentForcastBLL bll;
        if ((int)ViewState["ID"] == 0)
            bll = new FNA_ClientPaymentForcastBLL();
        else
            bll = new FNA_ClientPaymentForcastBLL((int)ViewState["ID"]);

        UC_DetailView1.GetData(bll.Model);

        if (bll.Model.Client == 0)
        {
            MessageBox.Show(this, "对不起,请选择回款的经销商!");
            return;
        }
        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.InsertStaff = (int)Session["UserID"];
            bll.Model.ApproveFlag = 2;
            bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (sender != null)
            Response.Redirect("ClientPaymentForcastList.aspx?ClientID=" + bll.Model.Client.ToString());
    }
    private void ApproveData(int id, int approveflag)
    {
        FNA_ClientPaymentForcastBLL bll = new FNA_ClientPaymentForcastBLL(id);

        bll.Model.ApproveFlag = approveflag;
        bll.Update();
        Response.Redirect("ClientPaymentForcastList.aspx?ClientID=" + bll.Model.Client.ToString());
    }
    protected void btn_Init_Click(object sender, EventArgs e)
    {
        int client = 0;

        if (select_Client.SelectValue != "")
        {
            client = int.Parse(select_Client.SelectValue);
        }

        FNA_ClientPaymentForcastBLL.Init(int.Parse(tr_OrganizeCity.SelectValue), client);
        BindGrid();
    }
 protected void btn_Save_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in gv_List.Rows)
     {
         int CurrentJobID = (int)gv_List.DataKeys[row.RowIndex]["FNA_ClientPaymentForcast_ID"];
         if (CurrentJobID > 0)
         {
             FNA_ClientPaymentForcastBLL bll = new FNA_ClientPaymentForcastBLL(CurrentJobID);
             bll.Model.PayDate     = Convert.ToDateTime(((TextBox)row.FindControl("tbx_PayDate")).Text);
             bll.Model.PayAmount   = Convert.ToDecimal(((TextBox)row.FindControl("tbx_PayAmount")).Text);
             bll.Model.UpdateStaff = (int)Session["UserID"];
             bll.Model.UpdateTime  = DateTime.Now;
             bll.Update();
         }
     }
     BindGrid();
 }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in gv_List.Rows)
        {
            int CurrentJobID = (int)gv_List.DataKeys[row.RowIndex]["FNA_ClientPaymentForcast_ID"];
            if (CurrentJobID > 0)
            {
                FNA_ClientPaymentForcastBLL bll = new FNA_ClientPaymentForcastBLL(CurrentJobID);
                bll.Model.PayDate=Convert.ToDateTime(((TextBox)row.FindControl("tbx_PayDate")).Text);
                bll.Model.PayAmount = Convert.ToDecimal(((TextBox)row.FindControl("tbx_PayAmount")).Text);
                bll.Model.UpdateStaff = (int)Session["UserID"];
                bll.Model.UpdateTime = DateTime.Now;
                bll.Update();
            }

        }
        BindGrid();
    }
 protected void btn_delete_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in gv_List.Rows)
     {
         CheckBox cb_check = (CheckBox)row.FindControl("cb_Check");
         if (cb_check.Checked)
         {
             int CurrentJobID = (int)gv_List.DataKeys[row.RowIndex]["FNA_ClientPaymentForcast_ID"];
             FNA_ClientPaymentForcastBLL bll;
             if (CurrentJobID > 0)
             {
                 bll = new FNA_ClientPaymentForcastBLL(CurrentJobID);
                 bll.Delete();
             }
         }
     }
     BindGrid();
 }
 protected void btn_delete_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in gv_List.Rows)
     {
         CheckBox cb_check = (CheckBox)row.FindControl("cb_Check");
         if (cb_check.Checked)
         {
             int CurrentJobID = (int)gv_List.DataKeys[row.RowIndex]["FNA_ClientPaymentForcast_ID"];
             FNA_ClientPaymentForcastBLL bll;
             if (CurrentJobID > 0)
             {
                 bll = new FNA_ClientPaymentForcastBLL(CurrentJobID);
                 bll.Delete();
             }
         }
     }
     BindGrid();
 }
 private void ApproveData(int approveflag)
 {
     foreach (GridViewRow row in gv_List.Rows)
     {
         CheckBox cb_check = (CheckBox)row.FindControl("cb_Check");
         if (cb_check.Checked)
         {
             int CurrentJobID = (int)gv_List.DataKeys[row.RowIndex]["FNA_ClientPaymentForcast_ID"];
             FNA_ClientPaymentForcastBLL bll;
             if (CurrentJobID > 0)
             {
                 bll = new FNA_ClientPaymentForcastBLL(CurrentJobID);
                 bll.Model.ApproveFlag = approveflag;
                 bll.Update();
             }
         }
     }
 }
    private void BindData()
    {
        FNA_ClientPaymentForcast m = new FNA_ClientPaymentForcastBLL((int)ViewState["ID"]).Model;

        UC_DetailView1.BindData(m);

        if (m.ApproveFlag == 1)
        {
            UC_DetailView1.SetControlsEnable(false);
            bt_Save.Visible    = false;
            bt_Approve.Visible = false;
        }
        else
        {
            UC_DetailView1.SetControlsEnable(true);
            bt_Save.Visible           = true;
            bt_Approve.Visible        = true;
            btn_CancleApprove.Visible = false;
        }
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_ClientPaymentForcastBLL bll;

        if ((int)ViewState["ID"] == 0)
        {
            bll = new FNA_ClientPaymentForcastBLL();
        }
        else
        {
            bll = new FNA_ClientPaymentForcastBLL((int)ViewState["ID"]);
        }

        UC_DetailView1.GetData(bll.Model);

        if (bll.Model.Client == 0)
        {
            MessageBox.Show(this, "对不起,请选择回款的经销商!");
            return;
        }
        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.InsertStaff = (int)Session["UserID"];
            bll.Model.ApproveFlag = 2;
            bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (sender != null)
        {
            Response.Redirect("ClientPaymentForcastList.aspx?ClientID=" + bll.Model.Client.ToString());
        }
    }
 private void ApproveData(int approveflag)
 {
     foreach (GridViewRow row in gv_List.Rows)
     {
         CheckBox cb_check = (CheckBox)row.FindControl("cb_Check");
         if (cb_check.Checked)
         {
             int CurrentJobID = (int)gv_List.DataKeys[row.RowIndex]["FNA_ClientPaymentForcast_ID"];
             FNA_ClientPaymentForcastBLL bll;
             if (CurrentJobID > 0)
             {
                 bll = new FNA_ClientPaymentForcastBLL(CurrentJobID);
                 bll.Model.ApproveFlag = approveflag;
                 bll.Update();
             }
         }
     }
 }
 private void ApproveData(int id,int approveflag)
 {
     FNA_ClientPaymentForcastBLL bll = new FNA_ClientPaymentForcastBLL(id);
     bll.Model.ApproveFlag = approveflag;
     bll.Update();
     Response.Redirect("ClientPaymentForcastList.aspx?ClientID=" + bll.Model.Client.ToString());
 }
    private void BindData()
    {
        FNA_ClientPaymentForcast m = new FNA_ClientPaymentForcastBLL((int)ViewState["ID"]).Model;

        UC_DetailView1.BindData(m);

        if (m.ApproveFlag == 1)
        {
            UC_DetailView1.SetControlsEnable(false);
            bt_Save.Visible = false;
            bt_Approve.Visible = false;
        }
        else
        {
            UC_DetailView1.SetControlsEnable(true);
            bt_Save.Visible = true;
            bt_Approve.Visible = true;
            btn_CancleApprove.Visible = false;
        }
    }