public KontaktBiznisModel KontaktPoId(int id) { Kontakt kontakt = _unitOfWork.Kontakti.PretragaPoId(id); KontaktBiznisModel kontaktBM = Maper.Map <KontaktBiznisModel>(kontakt); return(kontaktBM); }
public Decor() { this.target = null; this.facade = null; this.handle = null; this.enable = true; }
public KorisnikBiznisModel KorisnikPoEmailu(string email) { List <Korisnik> sviKorisnici = _unitOfWork.Korisnici.Svi().ToList(); Korisnik korisnik = sviKorisnici.Find(kor => kor.Email.Equals(email)); return(Maper.Map <KorisnikBiznisModel>(korisnik)); }
public Coord Correct(Maper drv, Coord crd) { return(new Coord( crd.Lng > this.min.Lng ? crd.Lng <this.max.Lng?crd.Lng : this.max.Lng : this.min.Lng, crd.Lat> this.max.Lat ? crd.Lat < this.min.Lat ? crd.Lat : this.min.Lat : this.max.Lat )); }
public ActionResult Kreiraj(KontaktPrezentacioniModel kontaktPM) { if (ModelState.IsValid) { string emailKorisnika = System.Web.HttpContext.Current.User.Identity.Name; int idTrenutnogKorisnika = _biznis.KorisniciServis.KorisnikPoEmailu(emailKorisnika).Id; KontaktBiznisModel kontaktDataModel = Maper.Map <KontaktBiznisModel>(kontaktPM); kontaktDataModel.Korisnik_id = idTrenutnogKorisnika; if (kontaktPM.NazivMesta != null) { kontaktDataModel.Mesto_id = Int32.Parse(kontaktPM.NazivMesta); } bool rezultat = _biznis.KontaktiServis.KreirajKontakt(kontaktDataModel); if (rezultat == true) { return(RedirectToAction("Pocetna", "Kontakti")); } ViewData["Greska"] = "Nije uspelo kreiranje novog kontakta"; } return(View(kontaktPM)); }
public JsonResult ListarDiagnosticosCAP() { Maper map = new Maper(); var lista = map.ListarDiagnosticos(); return(Json(lista, JsonRequestBehavior.AllowGet)); }
public Layer() { this.alpha = 100; this.index = null; this.group = null; this.title = null; this.target = null; this.facade = null; this.enable = true; }
/// <summary> /// 构造函数 /// </summary> public Event(Maper audience) { this.priority = 0; this.foremost = 0; this.priority = 0; this.complete = true; this.audience = audience; this.observer = new List <Action <Msger> >(); this.schedule = new Queue <Motion <Msger> >(); }
public ActionResult NajcescePretrazivani() { string emailKorisnika = System.Web.HttpContext.Current.User.Identity.Name; int idTrenutnogKorisnika = _biznis.KorisniciServis.KorisnikPoEmailu(emailKorisnika).Id; List <KontaktBiznisModel> listaBM = _biznis.KontaktiServis.NajcescePregledaniKontakti(idTrenutnogKorisnika); List <KontaktPrezentacioniModel> listaKontakataPM = Maper.Map <List <KontaktPrezentacioniModel> >(listaBM); return(View(listaKontakataPM)); }
/// <summary> /// 提示渲染函数 /// </summary> /// <param name="drv"></param> public sealed override void Render(Maper drv) { if (!MatchUtils.IsEmpty(this.Target = drv) && this.Target.Enable) { this.Index = MatchUtils.IsEmpty(this.Index) ? (this.Index = StampUtils.GetTimeStamp()) : this.Index; if (drv.Symbol.Tips.ContainsKey(this.Index)) { Tips tips = drv.Symbol.Tips[this.Index]; if (this.Equals(tips)) { this.Redraw(); } else { { tips.Remove(); } this.Render(drv); } } else { // 监听广播 this.Observe(drv.Listen.DragEvent, this.Redraw); this.Observe(drv.Listen.ZoomEvent, this.Redraw); this.Observe(drv.Listen.SwapEvent, this.Redraw); // 绘制图形 drv.Symbol.Tips.Add(this.Index, this); try { this.Redraw(); } catch { drv.Symbol.Tips.Remove(this.Index); } finally { if (!drv.Symbol.Tips.ContainsKey(this.Index)) { // 移除监听 this.Obscure(drv.Listen.DragEvent, this.Redraw); this.Obscure(drv.Listen.ZoomEvent, this.Redraw); this.Obscure(drv.Listen.SwapEvent, this.Redraw); { this.Facade = null; this.handle = null; this.Target = null; } } } } } }
public SubTaskDto GetSubTask(int taskId, int subTaskId) { SubTask subTask = _subTaskRepository.GetAll().FirstOrDefault(s => s.Id == subTaskId && s.ToDoId == taskId); if (subTask == null) { throw new ToDoException($"Subtask with Id:{subTaskId} deos not exist"); } return(Maper.MapSubTaskDto(subTask)); }
/// <summary> /// 渲染对象 /// </summary> /// <param name="drv"></param> public sealed override void Render(Maper drv) { if (!MatchUtils.IsEmpty(this.Target = drv) && this.Target.Enable) { this.Index = MatchUtils.IsEmpty(this.Index) ? (this.Index = StampUtils.GetTimeStamp()) : this.Index; if (drv.Symbol.Draw.ContainsKey(this.Index)) { Geom geom = drv.Symbol.Draw[this.Index]; if (this.Equals(geom)) { this.Redraw(); } else { { geom.Remove(); } this.Render(drv); } } else { if (!MatchUtils.IsEmpty(this.Facade = drv.Vessel.Draw)) { // 监听广播 this.Observe(drv.Listen.ZoomEvent, this.Redraw); this.Observe(drv.Listen.SwapEvent, this.Redraw); // 绘制图形 try { (drv.Symbol.Draw[this.Index] = this).Redraw(); } catch { drv.Symbol.Draw.Remove(this.Index); } finally { if (!drv.Symbol.Draw.ContainsKey(this.Index)) { // 移除监听 this.Obscure(drv.Listen.ZoomEvent, this.Redraw); this.Obscure(drv.Listen.SwapEvent, this.Redraw); { this.Facade = null; this.Target = null; } } } } } } }
public List <KontaktBiznisModel> Pretraga(int korisnikId, string stringPretrage) { IEnumerable <Kontakt> listaKontakataPoKorisniku = _unitOfWork.Kontakti.Svi().Where(kontakt => kontakt.Korisnik_id.Equals(korisnikId)); IEnumerable <Kontakt> FiltriranaLista = new List <Kontakt>(); IEnumerable <Kontakt> ListaZaInkrement = new List <Kontakt>(); if (stringPretrage == "") { stringPretrage = " "; } if (Char.IsLetter(stringPretrage[0])) { //pretraga kontakata za prikaz FiltriranaLista = listaKontakataPoKorisniku.Where(kontakt => kontakt.Ime.ToLower().Contains(stringPretrage.ToLower())); //pretraga kontakata za inkrement najcesce pregledanih ListaZaInkrement = FiltriranaLista.Where(kontakt => kontakt.Ime.Equals(stringPretrage, StringComparison.OrdinalIgnoreCase)); if (!String.IsNullOrWhiteSpace(stringPretrage)) { bool rez = InkrementBrojaPregleda(ListaZaInkrement); } } else if (stringPretrage[0] == '+' || Char.IsDigit(stringPretrage[0])) { FiltriranaLista = listaKontakataPoKorisniku.Where(kontakt => kontakt.Broj.ToLower().StartsWith(stringPretrage.ToLower())); ListaZaInkrement = FiltriranaLista.Where(kontakt => kontakt.Broj.Equals(stringPretrage, StringComparison.OrdinalIgnoreCase)); if (!String.IsNullOrWhiteSpace(stringPretrage)) { bool rez = InkrementBrojaPregleda(ListaZaInkrement); } } List <KontaktBiznisModel> listaBiznisModelaKontakataPoKorisniku = Maper.Map <List <KontaktBiznisModel> >(FiltriranaLista); foreach (var kontakt in listaBiznisModelaKontakataPoKorisniku) { if (kontakt.Mesto_id != null) { string nazivMestakontakta = _unitOfWork.Mesta.PretragaPoId(kontakt.Mesto_id ?? 1).NazivMesta; kontakt.NazivMesta = nazivMestakontakta; } else { kontakt.NazivMesta = "Neodredjeno"; } } return(listaBiznisModelaKontakataPoKorisniku.OrderBy(on => on.Ime).ToList()); }
/// <summary> /// 销毁观察者 /// </summary> public void Dispose() { this.observer.Clear(); this.schedule.Clear(); { this.priority = 0; this.foremost = 0; this.observer = null; this.schedule = null; this.audience = null; this.complete = true; } }
public void UpdateSubTas(SubTaskDto subTaskDto) { ToDo toDo = _toDoRepository.GetAll().FirstOrDefault(t => t.Id == subTaskDto.ToDoId); if (toDo == null) { throw new ToDoException($"Task with Id:{subTaskDto.ToDoId} does not exist!"); } SubTask subTask = Maper.MapSubTask(subTaskDto); _subTaskRepository.Update(subTask); }
public void Modify(Client model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } Client modelInDb = GetById(model.Id); Maper.Map(model, modelInDb); SaveChanges(); }
private void btnRegister_Click(object sender, EventArgs e) { UserRegistrationInfo userInfo = Maper.MapingRegistrationModel(textBoxLogin.Text, textBoxPass.Text, textBoxConfPass.Text); if (_regController.Registrate(userInfo)) { //TODO Add message routing MessageBox.Show("Successfully completed."); } else { MessageBox.Show("Invalid registration!!!"); } }
public ActionResult Pocetna() { string emailKorisnika = System.Web.HttpContext.Current.User.Identity.Name; int idTrenutnogKorisnika = _biznis.KorisniciServis.KorisnikPoEmailu(emailKorisnika).Id; Session["UlogovanKorisnik"] = emailKorisnika; List <KontaktBiznisModel> kontaktiBiznisModel = _biznis.KontaktiServis.SviKontatiKorisnika(idTrenutnogKorisnika); List <KontaktPrezentacioniModel> kontaktiPrezentacioniModel = Maper.Map <List <KontaktPrezentacioniModel> >(kontaktiBiznisModel); return(View(kontaktiPrezentacioniModel)); }
public bool KreirajKontakt(KontaktBiznisModel kontaktBM) { Kontakt kontakt = Maper.Map <Kontakt>(kontaktBM); try { _unitOfWork.Kontakti.Dodaj(kontakt); _unitOfWork.KomitujIzmene(); return(true); } catch (Exception) { return(false); } }
private void btnBuy_Click(object sender, EventArgs e) { var car = (CarListViewModel)dgvCars.CurrentRow.DataBoundItem; car.IsDeleted = true; if (_carController.Update(Maper.MapingCarViewModel(car))) { MessageBox.Show("Successfully completed."); } else { MessageBox.Show("Is not completed please repeat."); } Search(); }
private void btnLogin_Click(object sender, EventArgs e) { UserLoginInfo userLoginInfo = Maper.MapingLoginModel(txtLogin.Text, txtPass.Text); if (_loginController.IsValidLogin(userLoginInfo)) { User user = _loginController.GetUserRole(userLoginInfo); user.ShowUserInterface(); } else { //TODO Add message routing MessageBox.Show("Invalid Login or Password!!!"); } }
private void btnRegister_Click(object sender, EventArgs e) { UserRegistrationInfo userRegistrationInfo = Maper.MapingRegistrationInfo(txtLogin.Text, txtPass.Text, txtConfPass.Text); if (_registrationController.Registrate(userRegistrationInfo)) { MessageBox.Show("Successfully completed."); Close(); } else { MessageBox.Show("Invalid registration!!!"); } }
/// <summary> /// 控件渲染函数 /// </summary> /// <param name="drv">地图对象</param> public sealed override void Render(Maper drv) { if (!MatchUtils.IsEmpty(this.Target = drv) && drv.Enable) { Scale scale = null; { if (!MatchUtils.IsEmpty(scale = drv.Widget.Scale)) { if (!this.Equals(scale)) { { scale.Remove(); } this.Render(drv); } } else { // 监听广播 this.Observe(drv.Listen.ZoomEvent, this.Redraw, 0); this.Observe(drv.Listen.SwapEvent, this.Redraw, 0); // 加载控件 try { (drv.Widget.Scale = this).Redraw(); } catch { drv.Widget.Scale = null; } finally { if (MatchUtils.IsEmpty(drv.Widget.Scale)) { // 移除监听 this.Obscure(drv.Listen.ZoomEvent, this.Redraw); this.Obscure(drv.Listen.SwapEvent, this.Redraw); { this.Facade = null; this.Handle = null; this.Target = null; } } } } } } }
private void btnSave_Click(object sender, EventArgs e) { CarInfo carInfo = Maper.MapingCarModel (comboBoxModel.Text, Int32.Parse(txtPrice.Text), pictureBoxColor.BackColor.Name); bool isValid = _carController.AddCar(carInfo); if (isValid) { DialogResult = DialogResult.OK; MessageBox.Show("Car Successfuly added!!"); } else { MessageBox.Show("Invalid model name!!"); } }
public ActionResult CrearDiagnosticoCAP(string Codigo, string Nombre, string Destacado) { Maper map = new Maper(); try { map.GuardarDiagnostico(Codigo, Nombre, Destacado); return(View()); } catch (Exception) { return(View("ErrorCrearDiagnosticoView")); throw; } }
public void AddSubTask(SubTaskDto subTaskDto) { ToDo toDo = _toDoRepository.GetAll().FirstOrDefault(t => t.Id == subTaskDto.ToDoId); if (toDo == null) { throw new ToDoException($"Task with Id:{subTaskDto.ToDoId} does not exist!"); } if (string.IsNullOrWhiteSpace(subTaskDto.SubTaskName) || subTaskDto.IsCompleted == null) { throw new ToDoException($"Both SubTaskName and IsCompleted are required!"); } SubTask subTask = Maper.MapSubTask(subTaskDto); _subTaskRepository.Insert(subTask); }
public void AddTask(ToDoDto toDoDto) { User user = _userRepository.GetAll().FirstOrDefault(u => u.Id == toDoDto.UserId); if (user == null) { throw new ToDoException($"User with Id:{toDoDto.UserId} does not exist!"); } if (string.IsNullOrWhiteSpace(toDoDto.TaskName) || toDoDto.IsCompleted == null) { throw new ToDoException($"Both TaskName and IsCompleted are required!"); } ToDo toDo = Maper.MapToDo(toDoDto); _toDoRepository.Insert(toDo); }
public ActionResult GetPretraga(int strana, int brKontakataPoStrani, string stringPretrage) { string emailKorisnika = System.Web.HttpContext.Current.User.Identity.Name; if (!String.IsNullOrWhiteSpace(emailKorisnika)) { int idTrenutnogKorisnika = _biznis.KorisniciServis.KorisnikPoEmailu(emailKorisnika).Id; List <KontaktPrezentacioniModel> kontaktiPrezentacioniModel; kontaktiPrezentacioniModel = Maper.Map <List <KontaktPrezentacioniModel> >(_biznis.KontaktiServis.Pretraga(idTrenutnogKorisnika, stringPretrage)); PaginacijaBiznisModel <KontaktPrezentacioniModel> vracanje = _biznis.KontaktiServis.KontaktiPoStrani(kontaktiPrezentacioniModel, strana, brKontakataPoStrani); return(Json(vracanje, JsonRequestBehavior.AllowGet)); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Morate biti ulogovani u aplikaciju 'Imenik'")); }
/// <summary> /// 控件渲染函数 /// </summary> /// <param name="drv">地图对象</param> public sealed override void Render(Maper drv) { if (!MatchUtils.IsEmpty(this.Target = drv) && drv.Enable) { About about = null; { if (!MatchUtils.IsEmpty(about = drv.Widget.About)) { if (!this.Equals(about)) { { about.Remove(); } this.Render(drv); } } else { // 加载控件 try { (drv.Widget.About = this).Redraw(); } catch { drv.Widget.About = null; } finally { if (MatchUtils.IsEmpty(drv.Widget.About)) { { this.Facade = null; this.Handle = null; this.Target = null; } } } } } } }
/// <summary> /// 图层是否适配 /// </summary> /// <param name="drv">匹配地图</param> /// <returns>匹配层级</returns> public sealed override int Fusion(Maper drv) { if (!MatchUtils.IsEmpty(drv) && !MatchUtils.IsEmpty(drv.Netmap) && !MatchUtils.IsEmpty(this.Factor)) { double scale = drv.Netmap.Deg2sc() * 10; if (scale > 0) { double stand; // 计算容差 for (int i = 0, l = this.Factor.Length; i < l; i++) { if ((stand = Math.Round(scale / this.Deg2sc(this.Factor[i])) / 10) >= 1.0 && stand <= 1.1) { return(i); } } } } return(-1); }