public static TMSFeesCategoryMaster Get(System.Int32 feeCategoryID)
    {
        DataSet               ds;
        Database              db;
        string                sqlCommand;
        DbCommand             dbCommand;
        TMSFeesCategoryMaster instance;


        instance = new TMSFeesCategoryMaster();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSFeesCategoryMaster_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, feeCategoryID);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0)
        {
            throw new ApplicationException("Could not get TMSFeesCategoryMaster ID:" + feeCategoryID.ToString() + " from Database.");
        }
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    protected void btnClearSearch_Click(object sender, EventArgs e)
    {
        var dsFeesCategory = TMSFeesCategoryMaster.FilterFeesCategories(txtFeesCategorySearch.Text);

        grdFeesCategory.DataSource = dsFeesCategory.Tables[0];
        grdFeesCategory.DataBind();
    }
    protected DataSet GetFeeCategoryNames()
    {
        var     dsStudentTypes = TMSFeesCategoryMaster.GetAllFeesCategory();
        DataRow rw             = dsStudentTypes.Tables[0].NewRow();

        rw["FeeCategoryID"]   = "0";
        rw["FeeCategoryName"] = "Select";
        dsStudentTypes.Tables[0].Rows.InsertAt(rw, 0);
        return(dsStudentTypes);
    }
 protected void grdFeesCategory_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("AddNew"))
     {
         TMSFeesCategoryMaster objFeesCategory = new TMSFeesCategoryMaster();
         objFeesCategory.FeeCategoryName = ((TextBox)grdFeesCategory.FooterRow.FindControl("txtNewFeeCategoryName")).Text;
         objFeesCategory.CreatedDate = DateTime.Now;
         objFeesCategory.IsDelete = false;
         objFeesCategory.Insert();
         grdFeesCategory.EditIndex = -1;
         BindFeesCategory();
     }
 }
 protected void grdFeesCategory_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("AddNew"))
     {
         TMSFeesCategoryMaster objFeesCategory = new TMSFeesCategoryMaster();
         objFeesCategory.FeeCategoryName = ((TextBox)grdFeesCategory.FooterRow.FindControl("txtNewFeeCategoryName")).Text;
         objFeesCategory.CreatedDate     = DateTime.Now;
         objFeesCategory.IsDelete        = false;
         objFeesCategory.Insert();
         grdFeesCategory.EditIndex = -1;
         BindFeesCategory();
     }
 }
예제 #6
0
    protected void  BindFeeCategoryNames()
    {
        var     dsFeesCategory = TMSFeesCategoryMaster.GetAllFeesCategory();
        DataRow rw             = dsFeesCategory.Tables[0].NewRow();

        rw["FeeCategoryID"]   = "0";
        rw["FeeCategoryName"] = "Select";
        dsFeesCategory.Tables[0].Rows.InsertAt(rw, 0);
        drpFeesCategory.DataSource     = dsFeesCategory.Tables[0];
        drpFeesCategory.DataTextField  = "FeeCategoryName";
        drpFeesCategory.DataValueField = "FeeCategoryID";
        drpFeesCategory.DataBind();
    }
    protected void grdFeesCategory_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int feesCategoryID = Convert.ToInt32(grdFeesCategory.DataKeys[e.RowIndex].Value.ToString());

        if (feesCategoryID != 0)
        {
            TMSFeesCategoryMaster objFeesCategory = TMSFeesCategoryMaster.Get(feesCategoryID);
            objFeesCategory.IsDelete = true;
            objFeesCategory.Update();
        }

        grdFeesCategory.EditIndex = -1;
        BindFeesCategory();
    }
    protected void grdFeesCategory_UpdateRow(object sendedr, GridViewUpdateEventArgs e)
    {
        int         feesCategoryID = Convert.ToInt32(grdFeesCategory.DataKeys[e.RowIndex].Value.ToString());
        GridViewRow row            = grdFeesCategory.Rows[e.RowIndex] as GridViewRow;

        if (feesCategoryID != 0)
        {
            TMSFeesCategoryMaster objFeesCategory = TMSFeesCategoryMaster.Get(feesCategoryID);
            objFeesCategory.FeeCategoryName = (row.FindControl("txtFeeCategoryName") as TextBox).Text;
            objFeesCategory.Update();
        }

        grdFeesCategory.EditIndex = -1;
        BindFeesCategory();
    }
    public static TMSFeesCategoryMaster[] Search(System.Int32?feeCategoryID, System.String feeCategoryName, System.DateTime?createdDate, System.Boolean?isDelete)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSFeesCategoryMaster_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, feeCategoryID, feeCategoryName, createdDate, isDelete);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSFeesCategoryMaster.MapFrom(ds));
    }
    private void BindFeesCategory()
    {
        var dsFeesCategory = TMSFeesCategoryMaster.GetAllFeesCategory();

        if (dsFeesCategory.Tables[0].Rows.Count < 1)
        {
            DataRow rw = dsFeesCategory.Tables[0].NewRow();
            rw["FeeCategoryName"] = "";
            rw["FeeCategoryID"]   = 0;
            dsFeesCategory.Tables[0].Rows.InsertAt(rw, 0);
            grdFeesCategory.DataSource = dsFeesCategory.Tables[0];
            grdFeesCategory.DataBind();
            grdFeesCategory.Rows[0].Visible = false;
        }
        else
        {
            grdFeesCategory.DataSource = dsFeesCategory.Tables[0];
            grdFeesCategory.DataBind();
        }
    }
    public static TMSFeesCategoryMaster[] MapFrom(DataSet ds)
    {
        List <TMSFeesCategoryMaster> objects;


        // Initialise Collection.
        objects = new List <TMSFeesCategoryMaster>();

        // Validation.
        if (ds == null)
        {
            throw new ApplicationException("Cannot map to dataset null.");
        }
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        {
            return(objects.ToArray());
        }

        if (ds.Tables[TABLE_NAME] == null)
        {
            throw new ApplicationException("Cannot find table [dbo].[TMS_FeesCategoryMaster] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[TMS_FeesCategoryMaster] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSFeesCategoryMaster instance = new TMSFeesCategoryMaster();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
 public static void Update(TMSFeesCategoryMaster tMSFeesCategoryMaster)
 {
     tMSFeesCategoryMaster.Update();
 }
 public static void Update(TMSFeesCategoryMaster tMSFeesCategoryMaster, DbTransaction transaction)
 {
     tMSFeesCategoryMaster.Update(transaction);
 }
 public static void Update(TMSFeesCategoryMaster tMSFeesCategoryMaster)
 {
     tMSFeesCategoryMaster.Update();
 }
 public static TMSFeesCategoryMaster[] Search(TMSFeesCategoryMaster searchObject)
 {
     return(Search(searchObject.FeeCategoryID, searchObject.FeeCategoryName, searchObject.CreatedDate, searchObject.IsDelete));
 }
    public static TMSFeesCategoryMaster Get(System.Int32 feeCategoryID)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSFeesCategoryMaster instance;

        instance = new TMSFeesCategoryMaster();

        db = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSFeesCategoryMaster_SELECT";
        dbCommand = db.GetStoredProcCommand(sqlCommand, feeCategoryID);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) throw new ApplicationException("Could not get TMSFeesCategoryMaster ID:" + feeCategoryID.ToString()+ " from Database.");
        // Return results.
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
    public static TMSFeesCategoryMaster[] MapFrom(DataSet ds)
    {
        List<TMSFeesCategoryMaster> objects;

        // Initialise Collection.
        objects = new List<TMSFeesCategoryMaster>();

        // Validation.
        if (ds == null)
        throw new ApplicationException("Cannot map to dataset null.");
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        return objects.ToArray();

        if (ds.Tables[TABLE_NAME] == null)
        throw new ApplicationException("Cannot find table [dbo].[TMS_FeesCategoryMaster] in DataSet.");

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        throw new ApplicationException("Table [dbo].[TMS_FeesCategoryMaster] is empty.");

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSFeesCategoryMaster instance = new TMSFeesCategoryMaster();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return objects.ToArray();
    }
 public static TMSFeesCategoryMaster[] Search(TMSFeesCategoryMaster searchObject)
 {
     return Search ( searchObject.FeeCategoryID, searchObject.FeeCategoryName, searchObject.CreatedDate, searchObject.IsDelete);
 }
 public static void Update(TMSFeesCategoryMaster tMSFeesCategoryMaster, DbTransaction transaction)
 {
     tMSFeesCategoryMaster.Update(transaction);
 }