public static COMN_City GetCOMN_CountryByCountryID(int CountryID) { COMN_City cOMN_City = new COMN_City(); SqlCOMN_CityProvider sqlCOMN_CityProvider = new SqlCOMN_CityProvider(); cOMN_City = sqlCOMN_CityProvider.GetCOMN_CityByCountryID(CountryID); return cOMN_City; }
private void showCOMN_CityData() { COMN_City cOMN_City = new COMN_City (); cOMN_City = COMN_CityManager.GetCOMN_CityByCityID(Int32.Parse(Request.QueryString["ID"])); txtCityName.Text =cOMN_City.CityName.ToString(); txtDescription.Text =cOMN_City.Description.ToString(); ddlCountryID.SelectedValue =cOMN_City.CountryID.ToString(); }
protected void btnUpdate_Click(object sender, EventArgs e) { COMN_City cOMN_City = new COMN_City (); cOMN_City.CityID= int.Parse(Request.QueryString["ID"].ToString()); cOMN_City.CityName= txtCityName.Text; cOMN_City.Description= txtDescription.Text; cOMN_City.CountryID= int.Parse(ddlCountryID.SelectedValue); cOMN_City.AddedBy= Profile.card_id; cOMN_City.AddedDate= DateTime.Now; cOMN_City.UpdatedBy= Profile.card_id; cOMN_City.UpdateDate = DateTime.Now; bool resutl =COMN_CityManager.UpdateCOMN_City(cOMN_City); Response.Redirect("AdminDisplayCOMN_City.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { COMN_City cOMN_City = new COMN_City (); // cOMN_City.CityID= int.Parse(ddlCityID.SelectedValue); cOMN_City.CityName= txtCityName.Text; cOMN_City.Description= txtDescription.Text; cOMN_City.CountryID= int.Parse(ddlCountryID.SelectedValue); cOMN_City.AddedBy= Profile.card_id; cOMN_City.AddedDate= DateTime.Now; cOMN_City.UpdatedBy= Profile.card_id; cOMN_City.UpdateDate = DateTime.Now; int resutl =COMN_CityManager.InsertCOMN_City(cOMN_City); Response.Redirect("AdminDisplayCOMN_City.aspx"); }
public static int InsertCOMN_City(COMN_City cOMN_City) { SqlCOMN_CityProvider sqlCOMN_CityProvider = new SqlCOMN_CityProvider(); return sqlCOMN_CityProvider.InsertCOMN_City(cOMN_City); }
public static bool UpdateCOMN_City(COMN_City cOMN_City) { SqlCOMN_CityProvider sqlCOMN_CityProvider = new SqlCOMN_CityProvider(); return sqlCOMN_CityProvider.UpdateCOMN_City(cOMN_City); }
public bool UpdateCOMN_City(COMN_City cOMN_City) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateCOMN_City", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CityID", SqlDbType.Int).Value = cOMN_City.CityID; cmd.Parameters.Add("@CityName", SqlDbType.NVarChar).Value = cOMN_City.CityName; cmd.Parameters.Add("@Description", SqlDbType.NText).Value = cOMN_City.Description; cmd.Parameters.Add("@CountryID", SqlDbType.Int).Value = cOMN_City.CountryID; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = cOMN_City.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = cOMN_City.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public COMN_City GetCOMN_CityFromReader(IDataReader reader) { try { COMN_City cOMN_City = new COMN_City ( DataAccessObject.IsNULL<int>(reader["CityID"]), DataAccessObject.IsNULL<string>(reader["CityName"]), DataAccessObject.IsNULL<string>(reader["Description"]), DataAccessObject.IsNULL<int>(reader["CountryID"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]) ); return cOMN_City; } catch(Exception ex) { return null; } }