protected void btnSave_Click(object sender, EventArgs e)
    {
        FNA_StaffBonusBaseBLL bll = new FNA_StaffBonusBaseBLL();

        if (ViewState["ID"] != null)
        {
            bll = new FNA_StaffBonusBaseBLL(int.Parse(ViewState["ID"].ToString()));
        }

        bll.Model.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
        bll.Model.PositionType = ddl_PositionType.SelectedItem.Text;
        bll.Model.BounsBase    = decimal.Parse(txt_BounsBase.Text.Trim());
        if (ViewState["ID"] != null)
        {
            bll.Update();
        }
        else
        {
            if (FNA_StaffBonusBaseBLL.GetModelList("OrganizeCity=" + tr_OrganizeCity.SelectValue + " AND PositionType='" + ddl_PositionType.SelectedItem.Text + "'").Count > 0)
            {
                MessageBox.Show(this, "该片区内已有相关信息");
                return;
            }
            bll.Add();
        }
        BindGrid();
    }
 protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int id = int.Parse(gvList.DataKeys[e.RowIndex]["FNA_StaffBonusBase_ID"].ToString());
     FNA_StaffBonusBaseBLL bll = new FNA_StaffBonusBaseBLL(id);
     bll.Delete();
     BindGrid();
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        FNA_StaffBonusBaseBLL bll = new FNA_StaffBonusBaseBLL();
        if (ViewState["ID"] != null)
        {
            bll = new FNA_StaffBonusBaseBLL(int.Parse(ViewState["ID"].ToString()));
        }

        bll.Model.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
        bll.Model.PositionType = ddl_PositionType.SelectedItem.Text;
        bll.Model.BounsBase = decimal.Parse(txt_BounsBase.Text.Trim());
        if (ViewState["ID"] != null)
        {
            bll.Update();
        }
        else
        {

            if (FNA_StaffBonusBaseBLL.GetModelList("OrganizeCity=" + tr_OrganizeCity.SelectValue + " AND PositionType='" + ddl_PositionType.SelectedItem.Text+"'").Count > 0)
            {
                MessageBox.Show(this,"该片区内已有相关信息");
                return;
            }
            bll.Add();
        }
        BindGrid();
    }
    protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = int.Parse(gvList.DataKeys[e.RowIndex]["FNA_StaffBonusBase_ID"].ToString());
        FNA_StaffBonusBaseBLL bll = new FNA_StaffBonusBaseBLL(id);

        bll.Delete();
        BindGrid();
    }
 protected void gvList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     int id = int.Parse(gvList.DataKeys[e.NewSelectedIndex]["FNA_StaffBonusBase_ID"].ToString());
     FNA_StaffBonusBaseBLL bll = new FNA_StaffBonusBaseBLL(id);
     ddl_PositionType.SelectedItem.Text = bll.Model.PositionType;
     txt_BounsBase.Text = bll.Model.BounsBase.ToString();
     tr_OrganizeCity.SelectValue = bll.Model.OrganizeCity.ToString();
 }
    protected void gvList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int id = int.Parse(gvList.DataKeys[e.NewSelectedIndex]["FNA_StaffBonusBase_ID"].ToString());
        FNA_StaffBonusBaseBLL bll = new FNA_StaffBonusBaseBLL(id);

        ddl_PositionType.SelectedItem.Text = bll.Model.PositionType;
        txt_BounsBase.Text          = bll.Model.BounsBase.ToString();
        tr_OrganizeCity.SelectValue = bll.Model.OrganizeCity.ToString();
    }