private void showCOMN_CountryData() { COMN_Country cOMN_Country = new COMN_Country (); cOMN_Country = COMN_CountryManager.GetCOMN_CountryByCountryID(Int32.Parse(Request.QueryString["ID"])); txtCountryName.Text =cOMN_Country.CountryName.ToString(); txtDescription.Text =cOMN_Country.Description.ToString(); }
public static COMN_Country GetCOMN_CountryByCountryID(int CountryID) { COMN_Country cOMN_Country = new COMN_Country(); SqlCOMN_CountryProvider sqlCOMN_CountryProvider = new SqlCOMN_CountryProvider(); cOMN_Country = sqlCOMN_CountryProvider.GetCOMN_CountryByCountryID(CountryID); return cOMN_Country; }
protected void btnUpdate_Click(object sender, EventArgs e) { COMN_Country cOMN_Country = new COMN_Country (); cOMN_Country.CountryID= int.Parse(Request.QueryString["ID"].ToString()); cOMN_Country.CountryName= txtCountryName.Text; cOMN_Country.Description= txtDescription.Text; cOMN_Country.AddedBy= Profile.card_id; cOMN_Country.AddedDate= DateTime.Now; cOMN_Country.UpdatedBy= Profile.card_id; cOMN_Country.UpdateDate = DateTime.Now; bool resutl =COMN_CountryManager.UpdateCOMN_Country(cOMN_Country); Response.Redirect("AdminDisplayCOMN_Country.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { COMN_Country cOMN_Country = new COMN_Country (); // cOMN_Country.CountryID= int.Parse(ddlCountryID.SelectedValue); cOMN_Country.CountryName= txtCountryName.Text; cOMN_Country.Description= txtDescription.Text; cOMN_Country.AddedBy= Profile.card_id; cOMN_Country.AddedDate= DateTime.Now; cOMN_Country.UpdatedBy= Profile.card_id; cOMN_Country.UpdateDate = DateTime.Now; int resutl =COMN_CountryManager.InsertCOMN_Country(cOMN_Country); Response.Redirect("AdminDisplayCOMN_Country.aspx"); }
public COMN_Country GetCOMN_CountryFromReader(IDataReader reader) { try { COMN_Country cOMN_Country = new COMN_Country ( DataAccessObject.IsNULL<int>(reader["CountryID"]), DataAccessObject.IsNULL<string>(reader["CountryName"]), DataAccessObject.IsNULL<string>(reader["Description"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]) ); return cOMN_Country; } catch(Exception ex) { return null; } }
public bool UpdateCOMN_Country(COMN_Country cOMN_Country) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateCOMN_Country", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CountryID", SqlDbType.Int).Value = cOMN_Country.CountryID; cmd.Parameters.Add("@CountryName", SqlDbType.NVarChar).Value = cOMN_Country.CountryName; cmd.Parameters.Add("@Description", SqlDbType.NText).Value = cOMN_Country.Description; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = cOMN_Country.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = cOMN_Country.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public static bool UpdateCOMN_Country(COMN_Country cOMN_Country) { SqlCOMN_CountryProvider sqlCOMN_CountryProvider = new SqlCOMN_CountryProvider(); return sqlCOMN_CountryProvider.UpdateCOMN_Country(cOMN_Country); }
public static int InsertCOMN_Country(COMN_Country cOMN_Country) { SqlCOMN_CountryProvider sqlCOMN_CountryProvider = new SqlCOMN_CountryProvider(); return sqlCOMN_CountryProvider.InsertCOMN_Country(cOMN_Country); }