private void showSTD_CountryData() { STD_Country sTD_Country = new STD_Country (); sTD_Country = STD_CountryManager.GetSTD_CountryByCountryID(Int32.Parse(Request.QueryString["ID"])); txtCountryName.Text =sTD_Country.CountryName.ToString(); txtDescription.Text =sTD_Country.Description.ToString(); }
public static STD_Country GetSTD_CountryByCountryID(int CountryID) { STD_Country sTD_Country = new STD_Country(); SqlSTD_CountryProvider sqlSTD_CountryProvider = new SqlSTD_CountryProvider(); sTD_Country = sqlSTD_CountryProvider.GetSTD_CountryByCountryID(CountryID); return sTD_Country; }
protected void btnUpdate_Click(object sender, EventArgs e) { try { STD_Country sTD_Country = new STD_Country (); sTD_Country.CountryID= int.Parse(Request.QueryString["ID"].ToString()); sTD_Country.CountryName= txtCountryName.Text; sTD_Country.Description= txtDescription.Text; sTD_Country.AddedBy= Profile.card_id; sTD_Country.AddedDate= DateTime.Now; sTD_Country.UpdatedBy= Profile.card_id; sTD_Country.UpdateDate = DateTime.Now; bool resutl =STD_CountryManager.UpdateSTD_Country(sTD_Country); }catch(Exception ex){}Response.Redirect("AdminDisplaySTD_Country.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { try { STD_Country sTD_Country = new STD_Country (); // sTD_Country.CountryID= int.Parse(ddlCountryID.SelectedValue); sTD_Country.CountryName= txtCountryName.Text; sTD_Country.Description= txtDescription.Text; sTD_Country.AddedBy= Profile.card_id; sTD_Country.AddedDate= DateTime.Now; sTD_Country.UpdatedBy= Profile.card_id; sTD_Country.UpdateDate = DateTime.Now; int resutl =STD_CountryManager.InsertSTD_Country(sTD_Country); }catch(Exception ex){}Response.Redirect("AdminDisplaySTD_Country.aspx"); }
public static bool UpdateSTD_Country(STD_Country sTD_Country) { SqlSTD_CountryProvider sqlSTD_CountryProvider = new SqlSTD_CountryProvider(); return sqlSTD_CountryProvider.UpdateSTD_Country(sTD_Country); }
public static int InsertSTD_Country(STD_Country sTD_Country) { SqlSTD_CountryProvider sqlSTD_CountryProvider = new SqlSTD_CountryProvider(); return sqlSTD_CountryProvider.InsertSTD_Country(sTD_Country); }
public bool UpdateSTD_Country(STD_Country sTD_Country) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateSTD_Country", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CountryID", SqlDbType.Int).Value = sTD_Country.CountryID; cmd.Parameters.Add("@CountryName", SqlDbType.NVarChar).Value = sTD_Country.CountryName; cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Country.Description; //cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Country.Description; //cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Country.Description; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_Country.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_Country.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public int InsertSTD_Country(STD_Country sTD_Country) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertSTD_Country", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CountryID", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@CountryName", SqlDbType.NVarChar).Value = sTD_Country.CountryName; cmd.Parameters.Add("@Description", SqlDbType.NText).Value = sTD_Country.Description; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_Country.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_Country.AddedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_Country.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_Country.UpdateDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@CountryID"].Value; } }
public STD_Country GetSTD_CountryFromReader(IDataReader reader) { try { STD_Country sTD_Country = new STD_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 sTD_Country; } catch(Exception ex) { return null; } }