/// <summary>
 /// 修改国家
 /// </summary>
 /// <param name="countryCode">国家</param>
 public void ModifyCountryCode(CountryCode countryCode)
 {
     if (countryCode == null)
         throw new ArgumentNullException("Country is null");
     IUnitOfWork unitOfWork = _countryCodeRepository.UnitOfWork;
     _countryCodeRepository.Modify(countryCode);
     //complete changes in this unit of work
     unitOfWork.CommitAndRefreshChanges();
 }
Example #2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void gv_Country_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         string CountryCode = e.CommandArgument.ToString();
         country = _countryservice.FindCountriedByCountryCode(CountryCode);
         _countryservice.RemoveCountryCode(country);
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除成功!')</script>");
         //if (listCountry == null)
         //{
         //    listCountry = (IList<CountryCode>)Session["Country"];
         //}
         //listCountry.Remove(country);
         gv_Country.DataSource = _countryservice.FindAllCountries();
         gv_Country.DataBind();
     }
 }
 /// <summary>
 /// 删除国家
 /// </summary>
 /// <param name="countryCode">国家</param>
 public void RemoveCountryCode(CountryCode countryCode)
 {
     if (countryCode == null)
         throw new ArgumentNullException("Country is null");
     IUnitOfWork unitOfWork = _countryCodeRepository.UnitOfWork;
     _countryCodeRepository.Remove(countryCode);
     //complete changes in this unit of work
     unitOfWork.Commit();
 }