コード例 #1
0
    protected void FillCreditGrid()
    {
        UserView userview = UserView.GetInstance();
        int      staffID  = Convert.ToInt32(Session["StaffID"]);

        DataTable tbl = CreditDB.GetDataTable_ByEntityID(224413, "1,2");

        tbl.Columns.Add("can_delete", typeof(Boolean));
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            tbl.Rows[i]["can_delete"] =
                (Convert.ToInt32(tbl.Rows[i]["credit_credit_type_id"]) == 1 || Convert.ToInt32(tbl.Rows[i]["credit_credit_type_id"]) == 2) &&
                tbl.Rows[i]["credit_deleted_by"] == DBNull.Value &&
                (!userview.IsProviderView || staffID == Convert.ToInt32(tbl.Rows[i]["credit_added_by"]));
        }

        GrdCredit.DataSource = tbl;
        GrdCredit.DataBind();
    }
コード例 #2
0
    protected void FillCreditGrid(Credit credit)
    {
        DataTable tbl = CreditHistoryDB.GetDataTable_ByCreditID(credit.CreditID);

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            if (Convert.ToInt32(tbl.Rows[i]["credit_history_credit_type_id"]) == 2 || Convert.ToInt32(tbl.Rows[i]["credit_history_credit_type_id"]) == 4)
            {
                tbl.Rows[i]["credit_history_amount"]             = (-1 * Convert.ToInt32(tbl.Rows[i]["credit_history_amount"])).ToString();
                tbl.Rows[i]["credit_history_pre_deleted_amount"] = (-1 * Convert.ToInt32(tbl.Rows[i]["credit_history_pre_deleted_amount"])).ToString();
            }
        }

        if (credit.CreditType.ID == 1 && tbl.Rows.Count > 0)
        {
            show_hide_history_link.Visible = true;

            GrdCredit.DataSource = tbl;
            GrdCredit.DataBind();
        }
    }