public static int Insert(SchoolCrosswalk o) { SqlParameter[] arrParams = new SqlParameter[19]; arrParams[0] = new SqlParameter("@SchoolID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode())); arrParams[1] = new SqlParameter("@SchTypeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode())); arrParams[2] = new SqlParameter("@DistrictID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode())); arrParams[3] = new SqlParameter("@City", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode())); arrParams[4] = new SqlParameter("@MinGrade", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode())); arrParams[5] = new SqlParameter("@MaxGrade", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode())); arrParams[6] = new SqlParameter("@MinAge", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode())); arrParams[7] = new SqlParameter("@MaxAge", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode())); arrParams[8] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[9] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[10] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[11] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[12] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[13] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[14] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[15] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[16] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[17] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); arrParams[18] = new SqlParameter("@ID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode())); arrParams[18].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Insert", arrParams); o.ID = int.Parse(arrParams[18].Value.ToString()); return(o.ID); }
public static int Delete(SchoolCrosswalk o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@ID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Delete", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return(iReturn); }
public static int Update(SchoolCrosswalk o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[19]; arrParams[0] = new SqlParameter("@ID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode())); arrParams[1] = new SqlParameter("@SchoolID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode())); arrParams[2] = new SqlParameter("@SchTypeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode())); arrParams[3] = new SqlParameter("@DistrictID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode())); arrParams[4] = new SqlParameter("@City", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode())); arrParams[5] = new SqlParameter("@MinGrade", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode())); arrParams[6] = new SqlParameter("@MaxGrade", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode())); arrParams[7] = new SqlParameter("@MinAge", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode())); arrParams[9] = new SqlParameter("@MaxAge", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode())); arrParams[10] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[11] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[12] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[13] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[14] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[15] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[16] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[17] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[18] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[19] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Update", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return(iReturn); }
public static int Update(SchoolCrosswalk o) { int iReturn = -1; //assume the worst var arrParams = new List <SqlParameter>(); arrParams.Add(new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode()))); arrParams.Add(new SqlParameter("@SchoolID", GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode()))); arrParams.Add(new SqlParameter("@SchTypeID", GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode()))); arrParams.Add(new SqlParameter("@DistrictID", GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode()))); arrParams.Add(new SqlParameter("@City", GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode()))); arrParams.Add(new SqlParameter("@MinGrade", GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode()))); arrParams.Add(new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode()))); arrParams.Add(new SqlParameter("@MinAge", GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode()))); arrParams.Add(new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode()))); arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()))); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Update", arrParams.ToArray()); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return(iReturn); }
public bool Fetch(int ID) { // declare reader SqlDataReader dr; SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@ID", ID); dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_GetByID", arrParams); if (dr.Read()) { // declare return value SchoolCrosswalk result = new SchoolCrosswalk(); //DateTime _datetime; int _int; //decimal _decimal; if (int.TryParse(dr["ID"].ToString(), out _int)) this.ID = _int; if (int.TryParse(dr["SchoolID"].ToString(), out _int)) this.SchoolID = _int; if (int.TryParse(dr["SchTypeID"].ToString(), out _int)) this.SchTypeID = _int; if (int.TryParse(dr["DistrictID"].ToString(), out _int)) this.DistrictID = _int; this.City = dr["City"].ToString(); if (int.TryParse(dr["MinGrade"].ToString(), out _int)) this.MinGrade = _int; if (int.TryParse(dr["MaxGrade"].ToString(), out _int)) this.MaxGrade = _int; if (int.TryParse(dr["MinAge"].ToString(), out _int)) this.MinAge = _int; if (int.TryParse(dr["MaxAge"].ToString(), out _int)) this.MaxAge = _int; if (int.TryParse(dr["TenID"].ToString(), out _int)) this.TenID = _int; if (int.TryParse(dr["FldInt1"].ToString(), out _int)) this.FldInt1 = _int; if (int.TryParse(dr["FldInt2"].ToString(), out _int)) this.FldInt2 = _int; if (int.TryParse(dr["FldInt3"].ToString(), out _int)) this.FldInt3 = _int; this.FldBit1 = bool.Parse(dr["FldBit1"].ToString()); this.FldBit2 = bool.Parse(dr["FldBit2"].ToString()); this.FldBit3 = bool.Parse(dr["FldBit3"].ToString()); this.FldText1 = dr["FldText1"].ToString(); this.FldText2 = dr["FldText2"].ToString(); this.FldText3 = dr["FldText3"].ToString(); dr.Close(); return true; } dr.Close(); return false; }
public static int Update(SchoolCrosswalk o) { int iReturn = -1; //assume the worst var arrParams = new List<SqlParameter>(); arrParams.Add(new SqlParameter("@ID", GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode()))); arrParams.Add(new SqlParameter("@SchoolID", GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode()))); arrParams.Add(new SqlParameter("@SchTypeID", GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode()))); arrParams.Add(new SqlParameter("@DistrictID", GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode()))); arrParams.Add(new SqlParameter("@City", GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode()))); arrParams.Add(new SqlParameter("@MinGrade", GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode()))); arrParams.Add(new SqlParameter("@MaxGrade", GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode()))); arrParams.Add(new SqlParameter("@MinAge", GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode()))); arrParams.Add(new SqlParameter("@MaxAge", GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode()))); arrParams.Add(new SqlParameter("@TenID", GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldInt1", GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldInt2", GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldInt3", GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldBit1", GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldBit2", GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldBit3", GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldText1", GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldText2", GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode()))); arrParams.Add(new SqlParameter("@FldText3", GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode()))); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Update", arrParams.ToArray()); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return iReturn; }
public static int Insert(SchoolCrosswalk o) { SqlParameter[] arrParams = new SqlParameter[19]; arrParams[0] = new SqlParameter("@SchoolID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.SchoolID, o.SchoolID.GetTypeCode())); arrParams[1] = new SqlParameter("@SchTypeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.SchTypeID, o.SchTypeID.GetTypeCode())); arrParams[2] = new SqlParameter("@DistrictID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.DistrictID, o.DistrictID.GetTypeCode())); arrParams[3] = new SqlParameter("@City", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.City, o.City.GetTypeCode())); arrParams[4] = new SqlParameter("@MinGrade", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MinGrade, o.MinGrade.GetTypeCode())); arrParams[5] = new SqlParameter("@MaxGrade", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MaxGrade, o.MaxGrade.GetTypeCode())); arrParams[6] = new SqlParameter("@MinAge", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MinAge, o.MinAge.GetTypeCode())); arrParams[7] = new SqlParameter("@MaxAge", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MaxAge, o.MaxAge.GetTypeCode())); arrParams[8] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[9] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[10] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[11] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[12] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[13] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[14] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[15] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[16] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[17] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); arrParams[18] = new SqlParameter("@ID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode())); arrParams[18].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Insert", arrParams); o.ID = int.Parse(arrParams[18].Value.ToString()); return o.ID; }
public static int Delete(SchoolCrosswalk o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@ID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.ID, o.ID.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_Delete", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return iReturn; }
public bool Fetch(int ID) { // declare reader SqlDataReader dr; SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@ID", ID); dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "app_SchoolCrosswalk_GetByID", arrParams); if (dr.Read()) { // declare return value SchoolCrosswalk result = new SchoolCrosswalk(); //DateTime _datetime; int _int; //decimal _decimal; if (int.TryParse(dr["ID"].ToString(), out _int)) { this.ID = _int; } if (int.TryParse(dr["SchoolID"].ToString(), out _int)) { this.SchoolID = _int; } if (int.TryParse(dr["SchTypeID"].ToString(), out _int)) { this.SchTypeID = _int; } if (int.TryParse(dr["DistrictID"].ToString(), out _int)) { this.DistrictID = _int; } this.City = dr["City"].ToString(); if (int.TryParse(dr["MinGrade"].ToString(), out _int)) { this.MinGrade = _int; } if (int.TryParse(dr["MaxGrade"].ToString(), out _int)) { this.MaxGrade = _int; } if (int.TryParse(dr["MinAge"].ToString(), out _int)) { this.MinAge = _int; } if (int.TryParse(dr["MaxAge"].ToString(), out _int)) { this.MaxAge = _int; } if (int.TryParse(dr["TenID"].ToString(), out _int)) { this.TenID = _int; } if (int.TryParse(dr["FldInt1"].ToString(), out _int)) { this.FldInt1 = _int; } if (int.TryParse(dr["FldInt2"].ToString(), out _int)) { this.FldInt2 = _int; } if (int.TryParse(dr["FldInt3"].ToString(), out _int)) { this.FldInt3 = _int; } this.FldBit1 = bool.Parse(dr["FldBit1"].ToString()); this.FldBit2 = bool.Parse(dr["FldBit2"].ToString()); this.FldBit3 = bool.Parse(dr["FldBit3"].ToString()); this.FldText1 = dr["FldText1"].ToString(); this.FldText2 = dr["FldText2"].ToString(); this.FldText3 = dr["FldText3"].ToString(); dr.Close(); return(true); } dr.Close(); return(false); }
//protected void LoadData() //{ // var ds = SchoolCrosswalk.GetAll(); // rptrCW.DataSource = ds; // rptrCW.DataBind(); //} protected bool SaveData(bool autoSaveMessage = false) { //var rptr = rptrCW; var rptr = gv; int i = 0; bool errors = false; foreach (GridViewRow item in rptr.Rows) { i++; try { var ID = int.Parse(((Label)item.FindControl("ID")).Text); //var SchoolID = int.Parse(((DropDownList)item.FindControl("SchoolID")).SelectedValue); var SchoolID = int.Parse(((TextBox)item.FindControl("SchoolID")).Text); var SchTypeID = int.Parse(((DropDownList)item.FindControl("SchTypeID")).SelectedValue); var DistrictID = int.Parse(((DropDownList)item.FindControl("DistrictID")).SelectedValue); var City = ((TextBox)item.FindControl("City")).Text; var MinGrade = ((TextBox)item.FindControl("MinGrade")).Text.SafeToInt(); var MaxGrade = ((TextBox)item.FindControl("MaxGrade")).Text.SafeToInt(); var MinAge = ((TextBox)item.FindControl("MinAge")).Text.SafeToInt(); var MaxAge = ((TextBox)item.FindControl("MaxAge")).Text.SafeToInt(); var obj = new SchoolCrosswalk(); if (ID != 0) obj.Fetch(ID); obj.SchoolID = SchoolID; obj.SchTypeID = SchTypeID; obj.DistrictID = DistrictID; obj.City = City; obj.MinGrade = MinGrade; obj.MaxGrade = MaxGrade; obj.MinAge = MinAge; obj.MaxAge = MaxAge; if (ID != 0) { obj.Update(); } else { obj.Insert(); } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; masterPage.PageError = String.Format("On Row {1}: " + SRPResources.ApplicationError1, ex.Message, i); errors = true; } } if (!errors && !autoSaveMessage) { var masterPage = (IControlRoomMaster)Master; masterPage.PageMessage = SRPResources.SaveAllOK; } if (!errors && autoSaveMessage) { var masterPage = (IControlRoomMaster)Master; masterPage.PageMessage = "Changes on this page have been auto-saved."; } return (!errors); }