Exemple #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();
    }