コード例 #1
0
    protected void gvdeduct_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string      id    = e.CommandArgument.ToString();
        string      sql   = "select * from deduct where id=" + id;
        DataTable   dt    = DAL.DBHelper.ExecuteDataTable(sql);
        DeductModel model = new DeductModel();

        if (dt.Rows.Count > 0)
        {
            model.Auditing        = 1;
            model.DeductMoney     = Convert.ToDouble(dt.Rows[0]["DeductMoney"]);
            model.ExpectNum       = CommonDataBLL.getMaxqishu();
            model.ID              = Convert.ToInt32(id);
            model.IsDeduct        = Convert.ToInt32(dt.Rows[0]["IsDeduct"]);
            model.Number          = dt.Rows[0]["Number"].ToString();
            model.OperateIP       = Request.UserHostAddress;
            model.OperateNum      = Session["Company"].ToString();
            model.AuditingTime    = DateTime.Now.ToUniversalTime();
            model.Auditingexctnum = CommonDataBLL.getMaxqishu();
            model.Actype          = Convert.ToInt32(dt.Rows[0]["Actype"]);;
        }
        if (e.CommandName == "ok")
        {
            if (dt.Rows[0]["isaudit"].ToString() == "1")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script >alert('" + GetTran("000849", "不能重复审核") + "')</script>");
                return;
            }
            if (DeductBLL.UpdateInfoTranBD(model))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script >alert('" + GetTran("000858", "审核成功") + "')</script>");
                BtnConfirm_Click(null, null);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script >alert('" + GetTran("006041", "审核失败") + "!')</script>");
            }
        }
        if (e.CommandName == "del")
        {
            if (DAL.DBHelper.ExecuteNonQuery("delete from deduct where id=" + id, CommandType.Text) > 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("000008", "删除成功"));
                BtnConfirm_Click(null, null);
            }
            else
            {
                ScriptHelper.SetAlert(Page, GetTran("000009", "删除失败"));
            }
        }
    }