protected void btnSearchStudentType_Click(object sender, EventArgs e)
    {
        var dsFeesCategory = TMSStudentTypeMaster.FilterStudentTypes(txtStudentTypeSearch.Text);

        grdStudentType.DataSource = dsFeesCategory.Tables[0];
        grdStudentType.DataBind();
    }
Пример #2
0
    public static TMSStudentTypeMaster Get(System.Int32 studentTypeID)
    {
        DataSet              ds;
        Database             db;
        string               sqlCommand;
        DbCommand            dbCommand;
        TMSStudentTypeMaster instance;


        instance = new TMSStudentTypeMaster();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    protected void grdStudentType_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int studentTypeID = Convert.ToInt32(grdStudentType.DataKeys[e.RowIndex].Value.ToString());

        if (studentTypeID != 0)
        {
            TMSStudentTypeMaster objStudentType = TMSStudentTypeMaster.Get(studentTypeID);
            objStudentType.IsDelete = true;
            objStudentType.Update();
        }

        grdStudentType.EditIndex = -1;
        BindStudentTypes();
    }
Пример #4
0
 protected void grdStudentType_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("AddNew"))
     {
         TMSStudentTypeMaster objStudentType = new TMSStudentTypeMaster();
         objStudentType.StudentTypeName = ((TextBox)grdStudentType.FooterRow.FindControl("txtNewStudentTypeName")).Text;
         objStudentType.FeeCategoryID = Convert.ToInt32(((DropDownList)grdStudentType.FooterRow.FindControl("drpNewFeeCategoryName")).SelectedValue);
         objStudentType.CreatedDate = DateTime.Now;
         objStudentType.IsDelete = false;
         objStudentType.Insert();
         grdStudentType.EditIndex = -1;
         BindStudentTypes();
     }
 }
 protected void grdStudentType_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("AddNew"))
     {
         TMSStudentTypeMaster objStudentType = new TMSStudentTypeMaster();
         objStudentType.StudentTypeName = ((TextBox)grdStudentType.FooterRow.FindControl("txtNewStudentTypeName")).Text;
         objStudentType.FeeCategoryID   = Convert.ToInt32(((DropDownList)grdStudentType.FooterRow.FindControl("drpNewFeeCategoryName")).SelectedValue);
         objStudentType.CreatedDate     = DateTime.Now;
         objStudentType.IsDelete        = false;
         objStudentType.Insert();
         grdStudentType.EditIndex = -1;
         BindStudentTypes();
     }
 }
Пример #6
0
    public static TMSStudentTypeMaster[] Search(System.Int32?studentTypeID, System.Int32?feeCategoryID, System.String studentTypeName, System.DateTime?createdDate, System.Boolean?isDelete)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSStudentTypeMaster_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, studentTypeID, feeCategoryID, studentTypeName, createdDate, isDelete);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSStudentTypeMaster.MapFrom(ds));
    }
    protected void grdStudentType_UpdateRow(object sendedr, GridViewUpdateEventArgs e)
    {
        int         studentTypeID = Convert.ToInt32(grdStudentType.DataKeys[e.RowIndex].Value.ToString());
        GridViewRow row           = grdStudentType.Rows[e.RowIndex] as GridViewRow;

        if (studentTypeID != 0)
        {
            TMSStudentTypeMaster objStudentType = TMSStudentTypeMaster.Get(studentTypeID);
            objStudentType.StudentTypeName = (row.FindControl("txtStudentTypeName") as TextBox).Text;
            objStudentType.FeeCategoryID   = Convert.ToInt32((row.FindControl("drpFeeCategoryName") as DropDownList).SelectedValue);
            objStudentType.Update();
        }

        grdStudentType.EditIndex = -1;
        BindStudentTypes();
    }
    private void BindStudentTypes()
    {
        var dsStudentTypes = TMSStudentTypeMaster.GetAllStudentTypes();

        if (dsStudentTypes.Tables[0].Rows.Count < 1)
        {
            DataRow rw = dsStudentTypes.Tables[0].NewRow();
            rw["FeeCategoryName"] = rw["StudentTypeName"] = "";
            rw["FeeCategoryID"]   = rw["StudentTypeID"] = 0;
            dsStudentTypes.Tables[0].Rows.InsertAt(rw, 0);
            grdStudentType.DataSource = dsStudentTypes.Tables[0];
            grdStudentType.DataBind();
            grdStudentType.Rows[0].Visible = false;
        }
        else
        {
            grdStudentType.DataSource = dsStudentTypes.Tables[0];
            grdStudentType.DataBind();
        }
    }
Пример #9
0
    public static TMSStudentTypeMaster[] MapFrom(DataSet ds)
    {
        List <TMSStudentTypeMaster> objects;


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

        // 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_StudentTypeMaster] in DataSet.");
        }

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

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

        // Return collection.
        return(objects.ToArray());
    }
    public static TMSStudentTypeMaster[] MapFrom(DataSet ds)
    {
        List<TMSStudentTypeMaster> objects;

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

        // 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_StudentTypeMaster] in DataSet.");

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

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

        // Return collection.
        return objects.ToArray();
    }
Пример #11
0
 public static void Update(TMSStudentTypeMaster tMSStudentTypeMaster)
 {
     tMSStudentTypeMaster.Update();
 }
 public static void Update(TMSStudentTypeMaster tMSStudentTypeMaster, DbTransaction transaction)
 {
     tMSStudentTypeMaster.Update(transaction);
 }
 public static void Update(TMSStudentTypeMaster tMSStudentTypeMaster)
 {
     tMSStudentTypeMaster.Update();
 }
 public static TMSStudentTypeMaster[] Search(TMSStudentTypeMaster searchObject)
 {
     return Search ( searchObject.StudentTypeID, searchObject.FeeCategoryID, searchObject.StudentTypeName, searchObject.CreatedDate, searchObject.IsDelete);
 }
    public static TMSStudentTypeMaster Get(System.Int32 studentTypeID)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSStudentTypeMaster instance;

        instance = new TMSStudentTypeMaster();

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

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

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
Пример #16
0
 public static TMSStudentTypeMaster[] Search(TMSStudentTypeMaster searchObject)
 {
     return(Search(searchObject.StudentTypeID, searchObject.FeeCategoryID, searchObject.StudentTypeName, searchObject.CreatedDate, searchObject.IsDelete));
 }
Пример #17
0
 public static void Update(TMSStudentTypeMaster tMSStudentTypeMaster, DbTransaction transaction)
 {
     tMSStudentTypeMaster.Update(transaction);
 }