protected void Page_Load(object sender, EventArgs e) { CityController oCityController = new CityController(); foreach (City item in oCityController.CityList()) { dllCity.Items.Add(new ListItem { Value = item.Id.ToString(), Text = item.Name }); } Account oAccountProfil = new Account(); if (Session["Account"] != null) { oAccountProfil = (Account)Session["Account"]; txtName.Text = oAccountProfil.Name; txtSurname.Text = oAccountProfil.Surname; txtBirthDay.Text = oAccountProfil.BirthDay; txtPhone.Text = oAccountProfil.Phone; txtEmail.Text = oAccountProfil.Email; txtPassword.Text = oAccountProfil.Password; txtAdress.Text = oAccountProfil.Adress; Session["imgAccount"] = oAccountProfil.ProfilImage; } else { Response.Redirect("~/Default.aspx"); } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); _controller = new CityController(this.listItems); this.DataContext = _controller; }
void CountTraveler(Dictionary<string, int> Counter, CityController City) { if (!Counter.ContainsKey(City.Name)) { Counter[City.Name] = 0; } Counter[City.Name]++; }
protected void Page_Load(object sender, EventArgs e) { CityController oCityController = new CityController(); foreach (City item in oCityController.CityList()) { txtCity.Items.Add(new ListItem { Value = item.Id.ToString(), Text = item.Name }); } }
public void IndexTest1() { // Arrange var mock = new Mock<ControllerContext>(); mock.SetupGet(x => x.HttpContext.User.Identity.Name).Returns("USDA\\Purushottam.Singh"); mock.SetupGet(x => x.HttpContext.Request.IsAuthenticated).Returns(true); CityController controller = new CityController(); controller.ControllerContext = mock.Object; // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void SetDestination(CityController NewDestination) { DestinationCity = NewDestination; if (DestinationCity == null) { Traveling = false; return; } if (Knowledge.DestinationCity == "") { Knowledge.DestinationCity = NewDestination.Name; } TravelDestination = NewDestination.transform.position; Traveling = true; }
public void SetHome(CityController NewHome) { HomeCity = NewHome; Knowledge.OriginCity = NewHome.Name; }
void CountTravelerOut(CityController City) { CountTraveler(TravelersSent, City); }
void CountTravelerIn(CityController City) { CountTraveler(TravelersRecvd, City); }
private void ButtonSacuvajLekara_Click(object sender, RoutedEventArgs e) { Doctor doctor = new Doctor(); doctor.Jmbg = JmbgTb.Text as string; doctor.Name = ImeTb.Text as string; doctor.DateOfBirth = (DateTime)DatumRTb.SelectedDate; doctor.DateOfEmployment = (DateTime)DatumZTb.SelectedDate; doctor.Email = EmailTb.Text as string; doctor.Phone = TelTb.Text as string; doctor.HomeAddress = AdresaTb.Text as string; doctor.Surname = PrezimeTb.Text as string; doctor.Username = KorisnikTb.Text as string; doctor.Password = SifraTb.Text as string; doctor.NumberOfLicence = LicencaTb.Text as string; doctor.Type = (TypeOfDoctor)TipTb.SelectedItem; doctor.Gender = (GenderType)PolCb.SelectedItem; int soba = Convert.ToInt32(SobaTb.Text); int grad = Convert.ToInt32(GradTb.Text); RoomController roomController = new RoomController(); Room room = roomController.ViewRoomByNumber(soba); doctor.DoctorsOffice = room; CityController cityController = new CityController(); City city = cityController.getCityByZipCode(grad); doctor.City = city; Doctor s = new Doctor(); s = (Doctor)uc.ViewProfile(doctor.Jmbg); if (s == null) { uc.Register(doctor); Poruka.Text = "Uspesno ste sacuvali doktora!"; } else { uc.EditProfile(doctor); ExaminationController ec = new ExaminationController(); ec.DeleteDoctorExaminations(doctor.Jmbg); WorkingTimeController wtc = new WorkingTimeController(); WorkingTime novo = new WorkingTime(); novo = wtc.viewWorkingTimeDoctor(doctor.Jmbg); wtc.EditWorkingTime(novo); Poruka.Text = "Uspesno ste izmenili doktora!"; } /* VALIDACIJA * // 1. Resetovati sve validacione poruke * ResetAllErrors(); * * // 2. Izvrsiti validaciju * bool isValid = true; * * if (String.IsNullOrWhiteSpace(ImeTb.Text)) * { * ErrorImeTb.Text = "Morate uneti ime"; * ImeTb.BorderBrush = Brushes.Red; * isValid = false; * } * // * // Ostatak validacije * // * Poruka.Text = "Uspesno ste sacuvali lekara!"; * * * // 3. Reagovati na rezultat validacije * if (isValid) * { * // Dodaj lekara * // SuccessMessageTb.Text = "Uspesno ste dodali lekara."; * // Resetovati sve textboxove, comboboxove, datepickere. * // Za sve TB stavis .Text = "" * // Za DatePicker.SelectedDate stavis DateTime.Now * // Za CB stavis .SelectedItem = ListZaCB[0] * }*/ }
public CityControllerTest() { _seed = Guid.NewGuid().ToString(); _controller = MockController.CreateController <CityController>(_seed, "user"); }