private void GridViewBand()
    {
        PaymentTypeAdapter da = new PaymentTypeAdapter();
        DataSet            ds = da.getTypes();

        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
Exemple #2
0
    private void ddlReceiptTypeBind()
    {
        PaymentTypeAdapter ra = new PaymentTypeAdapter();
        DataSet            ds = ra.getTypes();

        ddl_receipt_type.DataTextField  = "name";
        ddl_receipt_type.DataValueField = "code";
        ddl_receipt_type.DataSource     = ds;
        ddl_receipt_type.DataBind();
    }
    protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            PaymentTypeAdapter raa  = new PaymentTypeAdapter();
            string             type = e.Row.Cells[3].Text;
            e.Row.Cells[3].Text = raa.getTypeNameByType(type);
            CommonAdapter ca         = new CommonAdapter();
            int           currencyID = Int32.Parse(e.Row.Cells[6].Text);
            e.Row.Cells[6].Text = ca.getCurrencyByID(currencyID);
            //0-未核销,1-部分核销,2-完全核销
            int check_status = Int32.Parse(e.Row.Cells[12].Text);
            switch (check_status)
            {
            case 1:
                e.Row.Cells[12].Text = "部分核销";
                break;

            case 2:
                e.Row.Cells[12].Text = "完全核销";
                break;

            default:
                e.Row.Cells[12].Text = "未核销";
                break;
            }
            string auditstatus = e.Row.Cells[11].Text.ToLower();
            if (auditstatus == "3")
            {
                e.Row.Cells[11].Text = "通过";
                Button btnDelete = e.Row.Cells[0].FindControl("btnDelete") as Button;
                btnDelete.Enabled = false;
            }
            else if (auditstatus == "2")
            {
                e.Row.Cells[11].Text = "不通过";
            }
            else if (auditstatus == "1")
            {
                e.Row.Cells[11].Text = "待审核";
            }
            else
            {
                e.Row.Cells[11].Text = "未提交";
            }
            int CheckerID = Int32.Parse(e.Row.Cells[8].Text);
            e.Row.Cells[8].Text = ca.getEmpNameByID(CheckerID);
        }
    }
    protected void updateUser_Click(object sender, EventArgs e)
    {
        PaymentTypeAdapter da   = new PaymentTypeAdapter();
        T_PaymentType      item = new T_PaymentType();

        item.Code = this.txt_code.Text.Trim();
        item.Name = this.txt_name.Text.Trim();
        if (string.IsNullOrEmpty(item.Code))
        {
            Label1.Text = "部门代码不能为空";
            return;
        }
        if (string.IsNullOrEmpty(item.Name))
        {
            Label1.Text = "部门名称不能为空";
            return;
        }
        if (string.IsNullOrEmpty(HiddenField1.Value))
        {
            //新增
            try
            {
                da.addType(item);
                Label1.Text = "新增成功";
                init();
                GridViewBand();
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
        else
        {
            //更新
            item.Id = Int32.Parse(HiddenField1.Value);
            try
            {
                da.updateType(item);
                Label1.Text = "保存成功";
                init();
                GridViewBand();
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
    }
    protected void benDelete_Click(object sender, EventArgs e)
    {
        Button      btn_del = sender as Button;
        GridViewRow row     = btn_del.Parent.Parent as GridViewRow;
        int         id      = Int32.Parse((row.Cells[0].FindControl("hdfId") as HiddenField).Value);

        try
        {
            PaymentTypeAdapter da = new PaymentTypeAdapter();
            da.DeleteTypeById(id);
            Label1.Text = "保存成功";
            init();
            GridViewBand();
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }