public void checkDelTour() { countries contr = new countries(); countries.dataCountries.Rows.Add("1", "Америка"); Countries_Col obj = new Countries_Col(); hotels hot = new hotels(); hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000"); HotelFactory hotelfac = new HotelFactory(); tours formTour = new tours(); tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль"); tours.dataTours.Rows.Add("2", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль"); tours.dataTours.Rows.Add("3", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль"); FoodCol food = new FoodCol(); TransportCol tr = new TransportCol(); TourTypeCol tourtype = new TourTypeCol(); TourFactory factTour = new TourFactory(); int a = TourFactory.count(); TourFactory.DeleteTour(1); Assert.AreEqual(a - 1, TourFactory.count()); }
public static List <countries> List() { List <countries> countriesList = new List <countries>(); SqlConnection connection = plansoni_webstoreData.GetConnection(); String selectProcedure = "[users_countriesSelect]"; SqlCommand selectCommand = new SqlCommand(selectProcedure, connection); try { connection.Open(); SqlDataReader reader = selectCommand.ExecuteReader(); countries countries = new countries(); while (reader.Read()) { countries = new countries(); countries.id = System.Convert.ToInt32(reader["id"]); countries.Name = Convert.ToString(reader["Name"]); countriesList.Add(countries); } reader.Close(); } catch (SqlException) { return(countriesList); } finally { connection.Close(); } return(countriesList); }
public static bool Delete(countries countries) { SqlConnection connection = plansoni_webstoreData.GetConnection(); string deleteProcedure = "[countriesDelete]"; SqlCommand deleteCommand = new SqlCommand(deleteProcedure, connection); deleteCommand.CommandType = CommandType.StoredProcedure; deleteCommand.Parameters.AddWithValue("@Oldid", countries.id); deleteCommand.Parameters.AddWithValue("@OldName", countries.Name); deleteCommand.Parameters.AddWithValue("@OldIsActive", countries.IsActive); deleteCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int); deleteCommand.Parameters["@ReturnValue"].Direction = ParameterDirection.Output; try { connection.Open(); deleteCommand.ExecuteNonQuery(); int count = System.Convert.ToInt32(deleteCommand.Parameters["@ReturnValue"].Value); if (count > 0) { return(true); } else { return(false); } } catch (SqlException) { return(false); } finally { connection.Close(); } }
public string DeleteCountries(int id) { string rpta; countries countrie = new countries(); try { using (var ctx = new transshipEntities()) { countrie = ctx.countries.FirstOrDefault(x => x.CountryID == id); if (countrie != null) { ctx.Entry(countrie).State = EntityState.Deleted; ctx.SaveChanges(); rpta = "ok"; } else { rpta = "fail"; } } } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } return(rpta); }
public long AddNewCountry(CountryInformation countryInformation) { var returnValue = (long)0; var stopwatch = new Stopwatch(); stopwatch.Start(); try { var newCountry = new countries { ISO2 = countryInformation.ISO2, CountryName = countryInformation.Name, LongCountryName = countryInformation.LongCountryName, ISO3 = countryInformation.ISO3, NumCode = countryInformation.NumCode, UNMemberState = countryInformation.UNMemberState, CallingCode = countryInformation.CallingCode, CCTLD = countryInformation.CCTLD }; _transshipEntities.countries.Add(newCountry); _transshipEntities.SaveChanges(); returnValue = newCountry.CountryID; } catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); } finally { stopwatch.Stop(); } return(returnValue); }
public ActionResult Add(countries cs) { if (cs.countryName != null) { var newcs = new countries(); newcs.countryName = cs.countryName; db.countries.Add(newcs); db.SaveChanges(); } return(RedirectToAction("Index", "Country")); }
public HttpResponseMessage Put(countries model) { try { BOCountries countrie = new BOCountries(); countries coun; coun = countrie.UpdateCountris(model); return(Request.CreateResponse(HttpStatusCode.OK, coun)); } catch (Exception e) { ErrorMessage mensaje = new ErrorMessage("2.1", "Exception to update countrie - " + e.GetBaseException().Message, e.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, mensaje)); } }
public void checkAddOrder() { string[] order = new string[7]; order[0] = "225"; order[1] = "Petr"; order[2] = "Vasya"; order[3] = "12 may 2013"; order[4] = "tour"; clients formCL = new clients(); clients.dataClients.Rows.Add("1", "Pet", "*****@*****.**", "88-88", "12 may 1990", "true", "VIP"); ClientTypeCol col = new ClientTypeCol(); ClientFactory factCl = new ClientFactory(); managers formMan = new managers(); managers.dataManagers.Rows.Add("1", "Petya", "8888", "Менеджер", "petya"); ManagerTypeCol coll = new ManagerTypeCol(); ManagerFactory factMan = new ManagerFactory(); orders formOrd = new orders(); orders.dataOrders.Rows.Add("Pet", "Petya", "12 may 2015", "1", "tour1"); orders.dataOrders.Rows.Add("Pet", "Petya", "13 may 2014", "2", "tou2"); orders.dataOrders.Rows.Add("Pet", "Petya", "14 may 2014", "3", "tou3"); countries contr = new countries(); countries.dataCountries.Rows.Add("1", "Россия"); Countries_Col obj = new Countries_Col(); hotels hot = new hotels(); hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000"); HotelFactory hotelfac = new HotelFactory(); FoodCol food = new FoodCol(); TransportCol tr = new TransportCol(); TourTypeCol tourtype = new TourTypeCol(); tours formTour = new tours(); tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "true", "hotel", "Автобус", "BB", "12000", "Рубль"); TourFactory factTour = new TourFactory(); OrderFactory fact = new OrderFactory(); int a = OrderFactory.count(); OrderFactory.AddOrder(order); Assert.AreEqual(a + 1, OrderFactory.count()); }
public countries SaveCountries(countries model) { var contrie = new countries(); try { using (var ctx = new transshipEntities()) { contrie = ctx.countries.Add(model); ctx.SaveChanges(); return(contrie); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public ActionResult Edit(countries country) { var bs = db.countries.FirstOrDefault(x => x.countryId == country.countryId); if (bs != null) { bs.countryName = country.countryName; db.SaveChanges(); return(RedirectToAction("Index", "Country")); } else { ViewBag.Warning = "Düzenleme gerçekleştirilemedi."; return(View()); } }
public countries UpdateCountries(countries model) { countries countrie = new countries(); countrie = model; try { using (var ctx = new transshipEntities()) { ctx.Entry(countrie).State = EntityState.Modified; ctx.SaveChanges(); return(countrie); } }catch (Exception e) { LogBook.TextLog.Info(string.Format("{0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : string.Empty)); throw e; } }
public countries getCountryOfCountryCode(string _countryCode) { DataTable dT = dll.getCountryOfCountryCode(_countryCode); if (dT.Rows.Count > 0) { return(new countries { countryCode = dT.Rows[0]["country_code"].ToString(), countryName = dT.Rows[0]["country_name"].ToString(), currencyCode = dT.Rows[0]["currency_code"].ToString(), penaltyMoneyAmount = Convert.ToDecimal(dT.Rows[0]["penaltymoney_amount"]) }); } else { countries country = new countries(); country = null; return(country); } }
public ActionResult DeleteConfirmed( Int32?id ) { countries countries = new countries(); countries.id = System.Convert.ToInt32(id); countries = countriesData.Select_Record(countries); bool bSucess = false; bSucess = countriesData.Delete(countries); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Delete"); } return(null); }
public ActionResult Create([Bind(Include = "id" + "," + "Name" + "," + "IsActive" )] countries countries) { if (ModelState.IsValid) { bool bSucess = false; bSucess = countriesData.Add(countries); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Insert"); } } return(View(countries)); }
protected void btn_Calculate_Click(object sender, EventArgs e) // Page Üzerindeki Calculate buttonunun Click eveti. { DateTime _dtCheckOutDate, _dtReturnedDate; // sayfa üzerinde girilen teslim ve iade tarihini tutacak olan değişken string _countryCode; // sayfa üzerinde seçilen ülkenin kodunu tutacak olan değişken try { ReadItemBindValues(out _dtCheckOutDate, out _dtReturnedDate, out _countryCode); // sayfadan girilen değerler okunup değişkenlere aktarıldı if (_dtReturnedDate > _dtCheckOutDate) // iade tarihi alış tarihinden büyük mü? { countries country = bll.getCountryOfCountryCode(_countryCode); // Seçilen ülkenin Bilgilerini getir. DayOfWeek[] offDays = bll.getCountryOffDays(_countryCode); // Seçilen ülkenin offdys bilgilerini getir. DateTime[] holidays = bll.getCountryHolidays(_countryCode); // Seçilen ülkenin holidays bilgilerini getir. int businessDaysCount = 0, penaltyDaysCount = 0; // business days ve penalty days değerlerini tutacak olan veriable for (DateTime i = _dtCheckOutDate; i <= _dtReturnedDate; i = i.AddDays(1)) // alış tarihinden iade tarihine kadar dongü oluşturuldu. { if (!IsOffDay(i.DayOfWeek, offDays) & !IsHoliday(i, holidays)) // doögüdeği şuanki tarih offdays veya golidays günlerinden birtanesimi kontrol et. { businessDaysCount++; // businessDaysCount değişkenini bir arttır. if (businessDaysCount > 10) // businessDaysCount 10'dan büyük ise { penaltyDaysCount++; // penaltyDaysCount değişkenini bir arttır. } } } BindSession(businessDaysCount, penaltyDaysCount, country.currencyCode, country.penaltyMoneyAmount); // Sessionu doldur ver Result sayfasını aç. } else { showAlert(); } } catch (Exception) { showAlert(); } }
public void checkAddTour() { string[] tour = new string[10]; tour[0] = "2"; tour[1] = "tour1"; tour[2] = "VIP туры"; tour[3] = "true"; tour[4] = "hotel"; tour[5] = "Авиа"; tour[6] = "HB"; tour[7] = "35500"; tour[8] = "Доллар"; tour[9] = "Америка"; countries contr = new countries(); countries.dataCountries.Rows.Add("1", "Америка"); Countries_Col obj = new Countries_Col(); hotels hot = new hotels(); hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000"); HotelFactory hotelfac = new HotelFactory(); tours formTour = new tours(); tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль"); FoodCol food = new FoodCol(); TransportCol tr = new TransportCol(); TourTypeCol tourtype = new TourTypeCol(); TourFactory factTour = new TourFactory(); int a = TourFactory.count(); TourFactory.Add_Tour(tour); Assert.AreEqual(a + 1, TourFactory.count()); }
// GET: /countries/Delete/<id> public ActionResult Delete( Int32?id ) { if ( id == null ) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } countries countries = new countries(); countries.id = System.Convert.ToInt32(id); countries = countriesData.Select_Record(countries); if (countries == null) { return(HttpNotFound()); } return(View(countries)); }
public ActionResult Edit(countries countries) { countries ocountries = new countries(); ocountries.id = System.Convert.ToInt32(countries.id); ocountries = countriesData.Select_Record(countries); if (ModelState.IsValid) { bool bSucess = false; bSucess = countriesData.Update(ocountries, countries); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Update"); } } return(View(countries)); }
public static countries Select_Record(countries countriesPara) { countries countries = new countries(); SqlConnection connection = plansoni_webstoreData.GetConnection(); string selectProcedure = "[countriesSelect]"; SqlCommand selectCommand = new SqlCommand(selectProcedure, connection); selectCommand.CommandType = CommandType.StoredProcedure; selectCommand.Parameters.AddWithValue("@id", countriesPara.id); try { connection.Open(); SqlDataReader reader = selectCommand.ExecuteReader(CommandBehavior.SingleRow); if (reader.Read()) { countries.id = System.Convert.ToInt32(reader["id"]); countries.Name = System.Convert.ToString(reader["Name"]); countries.IsActive = System.Convert.ToBoolean(reader["IsActive"]); } else { countries = null; } reader.Close(); } catch (SqlException) { return(countries); } finally { connection.Close(); } return(countries); }
public countries SaveCountris(countries countries) { return(country.SaveCountries(countries)); }
public countries UpdateCountris(countries countries) { return(country.UpdateCountries(countries)); }