コード例 #1
0
ファイル: AreaService.cs プロジェクト: depweili/grjkweb
        public OperationResult Delete(int Id)
        {
            var model = Areas.FirstOrDefault(t => t.Id == Id);

            model.IsDeleted = true;
            AreaRepository.Update(model);
            return(new OperationResult(OperationResultType.Success, "删除成功"));
        }
コード例 #2
0
        public Area FetchArea(Guid id)
        {
            var area = Areas.FirstOrDefault(a => a.Id.Equals(id));

            if (area == null)
            {
                throw new BusinessRuleException("Invalid area id supplied");
            }
            return(area);
        }
コード例 #3
0
        /// <summary>
        /// 初始化地址
        /// </summary>
        /// <param name="user">对应的用户</param>
        public void InitialViewAddress(DataOfUserDetial user)
        {
            MyDetialPage = 0;
            CountryList.Clear();
            ProvinceList.Clear();
            CityList.Clear();
            AreaList.Clear();
            var countryList = new Areas()
            {
                parent_id = 0, type = 1
            }.GetChildrenList();

            CountryList.AddRange(countryList.ToObservableCollection());
            var currentCoun = countryList.FirstOrDefault(c => c.id == user.countryId);

            DCountry = (currentCoun == null) ? "" : currentCoun.name;//设置国家名称

            var provinceList = new Areas()
            {
                parent_id = user.countryId == 0 ? (1) : (user.countryId), type = 2
            }.GetChildrenList();                                                                                                    //如果未选择国家则默认为中国

            ProvinceList.AddRange(provinceList.ToObservableCollection());
            var currentProvin = provinceList.FirstOrDefault(c => c.id == user.provinceId);

            DProvince = (currentProvin == null) ? "" : currentProvin.name;//设置省份名称

            var cityList = new Areas()
            {
                parent_id = user.provinceId, type = 3
            }.GetChildrenList();

            CityList.AddRange(cityList.ToObservableCollection());
            var cuttentCity = cityList.FirstOrDefault(c => c.id == user.cityId);

            DCity = cuttentCity == null ? "" : cuttentCity.name;//设置城市名称

            var areaList = new Areas()
            {
                parent_id = user.cityId, type = 4
            }.GetChildrenList();

            AreaList.AddRange(areaList.ToObservableCollection());
            var currentArea = areaList.FirstOrDefault(c => c.id == user.areaId);

            DArea = currentArea == null ? "" : currentArea.name;//设置区域名称
        }
コード例 #4
0
        internal static Area TryGet(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
            {
                return(null);
            }

            var area = Areas.FirstOrDefault(x => x.Handle == ptr);

            if (area != null)
            {
                return(area);
            }

            area = new Area(ptr);
            Areas.Add(area);

            return(area);
        }
コード例 #5
0
        private void __New(string AreaId)
        {
            IsNewDropDownOpen = false;

            if (!__CheckForSaving())
            {
                return;
            }

            __CleanUp();
            __Initialize(Areas.FirstOrDefault(a => a.Id == AreaId));

            if (m_CurrentArea == null)
            {
                return;
            }

            m_CurrentFilename = null;

            __ShowEstwSelectionWindow();
        }
コード例 #6
0
 public AreaModel LoadArea(int id)
 {
     return(Areas.FirstOrDefault(a => a.Id == id));
 }
コード例 #7
0
        public void SetInterventionToEdit()
        {
            TotalInfoSelectedEl = new TotalsIfo()
            {
                TotalHours         = -SelectedInterventionDetails.LocalIntervention.DateHourDetail.Duration,
                TotalInverventions = -1,
                TotalRevenue       = -SelectedInterventionDetails.LocalIntervention.Revenue,
                TotalProfit        = -SelectedInterventionDetails.LocalIntervention.Percent
            };
            SelectedArea = SelectedInterventionDetails.LocalIntervention.Area != null?Areas.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Area.Id) : null;

            if (SelectedInterventionDetails.LocalIntervention.Location != null)
            {
                SelectedLocation = LocalLocations.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Location.Id);
            }
            if (SelectedInterventionDetails.LocalIntervention.Material != null && Materials != null)
            {
                SelectedMaterial = Materials.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Material.Id);
            }
            SelectedPatient = PatientsList.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.PatientId);
            SelectedWork    = SelectedInterventionDetails.LocalIntervention.Lucrare != null?Works.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.Lucrare.Id) : new LocalWork();

            Durata             = SelectedInterventionDetails.Durata.TotalMinutes.ToString();
            Date               = SelectedInterventionDetails.LocalIntervention.DateHourDetail.Date;
            StartingHour       = SelectedInterventionDetails.LocalIntervention.DateHourDetail.StartHour;
            Revenue            = SelectedInterventionDetails.LocalIntervention.Revenue;
            Id                 = SelectedInterventionDetails.LocalIntervention.Id;
            LocalIntervention  = SelectedInterventionDetails.LocalIntervention;
            Observation        = SelectedInterventionDetails.Observations;
            IsInEditMode       = true;
            WasPayedByDental   = SelectedInterventionDetails.WasPayedByDental;
            SelectedTechnician =
                Technicians.FirstOrDefault(item => item.Id == SelectedInterventionDetails.LocalIntervention.TechnicianId);
            MaterialCost = SelectedInterventionDetails.MaterialCost;
        }
コード例 #8
0
 public Area GetArea(string id)
 => Areas?.FirstOrDefault(x => x.Id == id);