コード例 #1
0
        public KontaktBiznisModel KontaktPoId(int id)
        {
            Kontakt            kontakt   = _unitOfWork.Kontakti.PretragaPoId(id);
            KontaktBiznisModel kontaktBM = Maper.Map <KontaktBiznisModel>(kontakt);

            return(kontaktBM);
        }
コード例 #2
0
 public Decor()
 {
     this.target = null;
     this.facade = null;
     this.handle = null;
     this.enable = true;
 }
コード例 #3
0
        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));
        }
コード例 #4
0
 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
                ));
 }
コード例 #5
0
        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));
        }
コード例 #6
0
        public JsonResult ListarDiagnosticosCAP()
        {
            Maper map   = new Maper();
            var   lista = map.ListarDiagnosticos();

            return(Json(lista, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
ファイル: Layer.cs プロジェクト: Chandler0591/wMaper
 public Layer()
 {
     this.alpha  = 100;
     this.index  = null;
     this.group  = null;
     this.title  = null;
     this.target = null;
     this.facade = null;
     this.enable = true;
 }
コード例 #8
0
 /// <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> >();
 }
コード例 #9
0
        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));
        }
コード例 #10
0
ファイル: Tips.cs プロジェクト: Chandler0591/wMaper
 /// <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;
                     }
                 }
             }
         }
     }
 }
コード例 #11
0
        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));
        }
コード例 #12
0
ファイル: Geom.cs プロジェクト: Chandler0591/wMaper
 /// <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;
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #13
0
        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());
        }
コード例 #14
0
 /// <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;
     }
 }
コード例 #15
0
        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);
        }
コード例 #16
0
        public void Modify(Client model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            Client modelInDb = GetById(model.Id);

            Maper.Map(model, modelInDb);

            SaveChanges();
        }
コード例 #17
0
ファイル: FormRegistration.cs プロジェクト: TGrigor/CarShop
        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!!!");
            }
        }
コード例 #18
0
        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));
        }
コード例 #19
0
        public bool KreirajKontakt(KontaktBiznisModel kontaktBM)
        {
            Kontakt kontakt = Maper.Map <Kontakt>(kontaktBM);

            try
            {
                _unitOfWork.Kontakti.Dodaj(kontakt);
                _unitOfWork.KomitujIzmene();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #20
0
ファイル: FormClient.cs プロジェクト: MZakaryan/CarStore
        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();
        }
コード例 #21
0
ファイル: FormMain.cs プロジェクト: TGrigor/CarShop
        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!!!");
            }
        }
コード例 #22
0
        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!!!");
            }
        }
コード例 #23
0
ファイル: Scale.cs プロジェクト: Chandler0591/wMaper
 /// <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;
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #24
0
ファイル: FormAddCar.cs プロジェクト: TGrigor/CarShop
        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!!");
            }
        }
コード例 #25
0
        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;
            }
        }
コード例 #26
0
        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);
        }
コード例 #27
0
        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);
        }
コード例 #28
0
        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'"));
        }
コード例 #29
0
ファイル: About.cs プロジェクト: Chandler0591/wMaper
 /// <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;
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #30
0
 /// <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);
 }