public static TMSSchoolSubCategory Get(System.Int64 sscSubCategoryId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSSchoolSubCategory instance; instance = new TMSSchoolSubCategory(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSSchoolSubCategory_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, sscSubCategoryId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSSchoolSubCategory ID:" + sscSubCategoryId.ToString()+ " from Database."); // Return results. { return(null); } ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
protected void BindDivision() { try { Int64?schooltype = null; if (ddlStandard.SelectedItem.Text == "Select Standard") { schooltype = null; ddlDivision.Items.Clear(); } else { schooltype = Convert.ToInt64(ddlStandard.SelectedValue); } DataTable dtDivision = TMSSchoolSubCategory.GetSearch(null, schooltype, null, null, 1).Tables[0]; if (dtDivision.Rows.Count > 0) { ddlDivision.DataSource = dtDivision; ddlDivision.DataValueField = "SSC_SubCategoryId"; ddlDivision.DataTextField = "SSC_SubCategoryName"; ddlDivision.DataBind(); ddlDivision.Items.Insert(0, new ListItem("Select Division", "-1")); } } catch (Exception ex) { } }
protected void drpSchoolCategoryNew_SelectedIndexChanged(object sender, EventArgs e) { DropDownList drpSchoolCategoryNew = (DropDownList)sender; GridViewRow row = (GridViewRow)drpSchoolCategoryNew.NamingContainer; DropDownList drpNewSchoolSubCategoryName = ((DropDownList)row.FindControl("drpNewSchoolSubCategoryName")); drpNewSchoolSubCategoryName.DataSource = TMSSchoolSubCategory.Search(null, Convert.ToInt64(drpSchoolCategoryNew.SelectedValue), null, null, null); drpNewSchoolSubCategoryName.DataTextField = "SSCSubCategoryName"; drpNewSchoolSubCategoryName.DataValueField = "SSCSubCategoryId"; drpNewSchoolSubCategoryName.DataBind(); drpNewSchoolSubCategoryName.Items.Insert(0, "Select"); }
public static TMSSchoolSubCategory[] Search(System.Int64?sscSubCategoryId, System.Int64?sscCategoryId, System.String sscSubCategoryName, System.DateTime?sscDate, System.Int32?sscStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSSchoolSubCategory_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, sscSubCategoryId, sscCategoryId, sscSubCategoryName, sscDate, sscStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSSchoolSubCategory.MapFrom(ds)); }
public CascadingDropDownNameValue[] BindDivision(string knownCategoryValues, string category) { string[] str = knownCategoryValues.Split(':'); int SchoolID = Convert.ToInt32(str[2].Substring(0, str[2].IndexOf(';'))); DataTable dtClass = new DataTable(); dtClass = TMSSchoolSubCategory.GetSearch(null, SchoolID, null, null, 1).Tables[0]; List <CascadingDropDownNameValue> cascadingValues = new List <CascadingDropDownNameValue>(); for (int i = 0; i < dtClass.Rows.Count; i++) { string ClassId = dtClass.Rows[i]["SSC_SubCategoryId"].ToString(); string ClassName = dtClass.Rows[i]["SSC_SubCategoryName"].ToString(); cascadingValues.Add(new CascadingDropDownNameValue(ClassName, ClassId)); } return(cascadingValues.ToArray()); }
public static TMSSchoolSubCategory[] MapFrom(DataSet ds) { List <TMSSchoolSubCategory> objects; // Initialise Collection. objects = new List <TMSSchoolSubCategory>(); // 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_SchoolSubCategory] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_SchoolSubCategory] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSSchoolSubCategory instance = new TMSSchoolSubCategory(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static void Update(TMSSchoolSubCategory tMSSchoolSubCategory, DbTransaction transaction) { tMSSchoolSubCategory.Update(transaction); }
public static void Update(TMSSchoolSubCategory tMSSchoolSubCategory) { tMSSchoolSubCategory.Update(); }
public static TMSSchoolSubCategory[] Search(TMSSchoolSubCategory searchObject) { return Search ( searchObject.SSCSubCategoryId, searchObject.SSCCategoryId, searchObject.SSCSubCategoryName, searchObject.SSCDate, searchObject.SSCStatus); }
public static TMSSchoolSubCategory[] MapFrom(DataSet ds) { List<TMSSchoolSubCategory> objects; // Initialise Collection. objects = new List<TMSSchoolSubCategory>(); // 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_SchoolSubCategory] in DataSet."); if (ds.Tables[TABLE_NAME].Rows.Count < 1) throw new ApplicationException("Table [dbo].[TMS_SchoolSubCategory] is empty."); // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSSchoolSubCategory instance = new TMSSchoolSubCategory(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return objects.ToArray(); }
public static TMSSchoolSubCategory Get(System.Int64 sscSubCategoryId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSSchoolSubCategory instance; instance = new TMSSchoolSubCategory(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSSchoolSubCategory_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, sscSubCategoryId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSSchoolSubCategory ID:" + sscSubCategoryId.ToString()+ " from Database."); // Return results. return null; ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom( ds.Tables[0].Rows[0] ); return instance; }
public static TMSSchoolSubCategory[] Search(TMSSchoolSubCategory searchObject) { return(Search(searchObject.SSCSubCategoryId, searchObject.SSCCategoryId, searchObject.SSCSubCategoryName, searchObject.SSCDate, searchObject.SSCStatus)); }