/// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        LTallyNoPassReasonData model = new LTallyNoPassReasonData();
        LTallyNoPassReasonBB tallyNoPassReasonBB = new LTallyNoPassReasonBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = tallyNoPassReasonBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = tallyNoPassReasonBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                model.updtDt = DateTime.Now.ToString();
                model.updtEmpId = this.currentUser.empId;
                tallyNoPassReasonBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            tallyNoPassReasonBB.Dispose();
        }

        Response.Redirect("LTallyNoPassReasonList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false);
    }
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        LTallyNoPassReasonBB tallyNoPassReasonBB = new LTallyNoPassReasonBB();

        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");

                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int id = int.Parse(chkId.ValidationGroup);
                    LTallyNoPassReasonData tallyNoPassResaonModel = new LTallyNoPassReasonData();

                    tallyNoPassResaonModel = tallyNoPassReasonBB.GetModel(id);

                    tallyNoPassResaonModel.isDel = true;

                    tallyNoPassReasonBB.ModifyRecord(tallyNoPassResaonModel);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            tallyNoPassReasonBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        LTallyNoPassReasonBB tallyNoPassReasonBB = new LTallyNoPassReasonBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = this.StrWhere;

            ds = tallyNoPassReasonBB.GetList(strWhere);
            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            tallyNoPassReasonBB.Dispose();
        }
    }
    /// <summary>
    /// 展示数据
    /// </summary>
    /// <param name="id">记录Id</param>
    private void ShowInfo(int id)
    {
        LTallyNoPassReasonBB tallyNoPassReasonBB = new LTallyNoPassReasonBB();
        LTallyNoPassReasonData model = new LTallyNoPassReasonData();
        try
        {
            model = tallyNoPassReasonBB.GetModel(id);

            this.tbNoPassReasonNm.Text = model.noPassReasonNm;
        }
        finally
        {
            tallyNoPassReasonBB.Dispose();
        }
    }
Beispiel #5
0
    public DataTable GetTallyNoPassReason()
    {
        LTallyNoPassReasonBB tallyNoPassReasonBB = new LTallyNoPassReasonBB();

        try
        {
            DataTable dt = new DataTable();

            dt = tallyNoPassReasonBB.GetList("isDel=0").Tables[0];
            return dt;
        }
        finally
        {
            tallyNoPassReasonBB.Dispose();
        }
    }