public async Task <IActionResult> Edit(int id, [Bind("SOURCEID,DESIGNATION,HIERARCHIEID,COMMENTAIRE")] SOURCE sOURCE)
        {
            if (id != sOURCE.SOURCEID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sOURCE);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SOURCEExists(sOURCE.SOURCEID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sOURCE));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            SOURCE sOURCE = db.SOURCEs.Find(id);

            db.SOURCEs.Remove(sOURCE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        private void btnDraw2_Click(object sender, EventArgs e)
        {
            ISurfaceSymbol sym = new SurfaceSymbol();

            sym.Color = System.Drawing.Color.Green;
            preDraw(sym);
            source = SOURCE.DRAW2;
        }
Exemple #4
0
        private void btnSelect2_Click(object sender, EventArgs e)
        {
            this.axRenderControl1.RcMouseClickSelect += new _IRenderControlEvents_RcMouseClickSelectEventHandler(axRenderControl1_RcMouseClickSelect);

            this.axRenderControl1.InteractMode          = gviInteractMode.gviInteractSelect;
            this.axRenderControl1.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectAll;
            this.axRenderControl1.MouseSelectMode       = gviMouseSelectMode.gviMouseSelectClick;
            source = SOURCE.SELECT2;
        }
        public static string BuildNuGetAdd(string aTokenizedCommandLine)
        {
            StringBuilder vResult = new StringBuilder(aTokenizedCommandLine);

            vResult
            .Replace(SOURCE.AsToken(), Source)
            .Replace(CONFIG_FILE.AsToken(), ConfigFile)
            .Replace(VERBOSITY_NUGET.AsToken(), VerbosityNuGet);
            return(vResult.ToString());
        }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "SOURCEID,DESIGNATION,HIERARCHIEID,COMMENTAIRE")] SOURCE sOURCE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sOURCE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sOURCE));
 }
Exemple #7
0
        public void When_creating_a_completed_task_from_null_value()
        {
            const string SOURCE = null;

            var task = SOURCE.ToCompletedTask();

            task.Status.ShouldBe(TaskStatus.RanToCompletion);

            task.Result.ShouldBe(SOURCE);
        }
Exemple #8
0
        public void When_creating_a_completed_task_from_value_type()
        {
            const int SOURCE = 42;

            var task = SOURCE.ToCompletedTask();

            task.Status.ShouldBe(TaskStatus.RanToCompletion);

            task.Result.ShouldBe(SOURCE);
        }
Exemple #9
0
        public void When_creating_a_completed_task_from_reference_type()
        {
            const string SOURCE = "some-text";

            var task = SOURCE.ToCompletedTask();

            task.Status.ShouldBe(TaskStatus.RanToCompletion);

            task.Result.ShouldBe(SOURCE);
        }
Exemple #10
0
 public void SetTrivia(string playlistID)
 {
     questionID = 0;
     if (source == SOURCE.questions)
     {
         return;
     }
     StartCoroutine(LoadFromJWPlayer(playlistID, true));
     source = SOURCE.questions;
 }
        public void When_creating_a_completed_task_from_null_value()
        {
            const string SOURCE = null;

            var task = SOURCE.ToCompletedValueTask();

            task.IsCompleted.ShouldBeTrue();
            task.IsCompletedSuccessfully.ShouldBeTrue();

            task.Result.ShouldBe(SOURCE);
        }
        public void When_creating_a_completed_task_from_reference_type()
        {
            const string SOURCE = "some-text";

            var task = SOURCE.ToCompletedValueTask();

            task.IsCompleted.ShouldBeTrue();
            task.IsCompletedSuccessfully.ShouldBeTrue();

            task.Result.ShouldBe(SOURCE);
        }
Exemple #13
0
        public ActionResult Create([Bind(Include = "SOURCEID,DESIGNATION,HIERARCHIEID,COMMENTAIRE")] SOURCE sOURCE)
        {
            if (ModelState.IsValid)
            {
                db.SOURCEs.Add(sOURCE);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sOURCE));
        }
        public async Task <IActionResult> Create([Bind("SOURCEID,DESIGNATION,HIERARCHIEID,COMMENTAIRE")] SOURCE sOURCE)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sOURCE);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sOURCE));
        }
        public static string BuildDotNetNuGetDelete(string aTokenizedCommandLine)
        {
            StringBuilder vResult = new StringBuilder(aTokenizedCommandLine);

            vResult
            .Replace(PACKAGE_ID.AsToken(), PackageId)
            .Replace(PACKAGE_VERSION.AsToken(), PackageVersion)
            .Replace(SOURCE.AsToken(), Source)
            .Replace(API_KEY.AsToken(), ApiKey)
            .Replace(VERBOSITY_DOTNET.AsToken(), VerbosityDotNet);
            return(vResult.ToString());
        }
Exemple #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="window"></param>
        public SalesItemViewModel(Window window)
        {
            SOURCE      = new ObservableCollection <ItemSales>(SqlServerCompactService.GetItemSales(DateTime.Now, 0));
            TotalCount  = SOURCE.Count.ToString();
            TotalProfit = SOURCE.Sum(s => s.SoldPirce - (s.SalesCount * s.StockPrice)).ToString();

            ItemSalesColletion = new ObservableCollection <ItemSales>(SOURCE.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));

            CloseCommand = new DelegateCommand(() =>
            {
                window.Close();
            });

            AnalyseCommand = new DelegateCommand <string>(s =>
            {
                ItemSalesColletion.Clear();

                int t = 0;
                switch (s)
                {
                case "0":
                    t = 0;
                    break;

                case "1":
                    t = 1;
                    break;

                case "2":
                    t = 2;
                    break;
                }

                SOURCE             = new ObservableCollection <ItemSales>(SqlServerCompactService.GetItemSales(SelectedDate, t));
                TotalCount         = SOURCE.Count.ToString();
                TotalProfit        = SOURCE.Sum(k => k.SoldPirce - (k.SalesCount * k.StockPrice)).ToString();
                ItemSalesColletion = new ObservableCollection <ItemSales>(SOURCE.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            });

            PreviousCommand = new DelegateCommand(() =>
            {
                PageIndex--;
                ItemSalesColletion = new ObservableCollection <ItemSales>(SOURCE.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(PageIndex > 0 ? true : false); });

            NextCommand = new DelegateCommand(() =>
            {
                PageIndex++;
                ItemSalesColletion = new ObservableCollection <ItemSales>(SOURCE.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return((PageIndex + 1) * PAGESIZE < SOURCE.Count() ? true : false); });
        }
Exemple #17
0
        // GET: SOURCEs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SOURCE sOURCE = db.SOURCEs.Find(id);

            if (sOURCE == null)
            {
                return(HttpNotFound());
            }
            return(View(sOURCE));
        }
        public static string BuildDotNetNuGetPush(string aTokenizedCommandLine)
        {
            StringBuilder vResult = new StringBuilder(aTokenizedCommandLine);

            vResult
            .Replace(PACKAGE_PATH.AsToken(), PackagePath)
            .Replace(SOURCE.AsToken(), Source)
            .Replace(API_KEY.AsToken(), ApiKey)
            .Replace(SYMBOL_SOURCE.AsToken(), SymbolSource)
            .Replace(SYMBOL_API_KEY.AsToken(), SymbolApiKey)
            .Replace(TIMEOUT.AsToken(), Timeout)
            .Replace(VERBOSITY_DOTNET.AsToken(), VerbosityDotNet);
            return(vResult.ToString());
        }
Exemple #19
0
        public SelectCustomerViewModel(Window window)
        {
            BindData();

            CloseCommand = new DelegateCommand(() =>
            {
                window.Close();

                CheckedList = SOURCE.Where(s => s.IsChecked).FirstOrDefault();
            });

            SearchCommand = new DelegateCommand(() =>
            {
                var s             = SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0);
                PageIndex         = 0;
                CustomerColletion = new ObservableCollection <Customer>(s.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchName) ? false : true); });

            AllCommand = new DelegateCommand(() =>
            {
                SearchName        = "";
                CustomerColletion = new ObservableCollection <Customer>(SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchName) ? false : true); });


            PreviousCommand = new DelegateCommand(() =>
            {
                PageIndex--;
                CustomerColletion = new ObservableCollection <Customer>(SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(PageIndex > 0 ? true : false); });

            NextCommand = new DelegateCommand(() =>
            {
                PageIndex++;
                CustomerColletion = new ObservableCollection <Customer>(SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return((PageIndex + 1) * PAGESIZE < SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Count() ? true : false); });

            SelectCommand = new DelegateCommand <Customer>(s =>
            {
                if (s != null)
                {
                    s.IsChecked = !s.IsChecked;
                }
                SOURCE.Where(t => t.Id != s.Id).ToList().ForEach(t => t.IsChecked = false);
            });
        }
        public SelectItemMasterViewModel(Window window)
        {
            BindData();

            CloseCommand = new DelegateCommand(() =>
            {
                window.Close();

                CheckedList = SOURCE.Where(s => s.IsChecked && s.StockCount > 0).ToList();
            });

            SearchCommand = new DelegateCommand(() =>
            {
                var s               = SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0);
                PageIndex           = 0;
                ItemMasterColletion = new ObservableCollection <ItemMaster>(s.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchItemId) ? false : true); });

            AllCommand = new DelegateCommand(() =>
            {
                SearchItemId        = "";
                ItemMasterColletion = new ObservableCollection <ItemMaster>(SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchItemId) ? false : true); });


            PreviousCommand = new DelegateCommand(() =>
            {
                PageIndex--;
                ItemMasterColletion = new ObservableCollection <ItemMaster>(SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(PageIndex > 0 ? true : false); });

            NextCommand = new DelegateCommand(() =>
            {
                PageIndex++;
                ItemMasterColletion = new ObservableCollection <ItemMaster>(SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return((PageIndex + 1) * PAGESIZE < SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Count() ? true : false); });

            SelectCommand = new DelegateCommand <ItemMaster>(s =>
            {
                if (s != null)
                {
                    s.IsChecked = !s.IsChecked;
                }
            });
        }
 assertElementHasNamespace(SOURCE, "/a/b/d/e", null);
 assertElementHasNamespace(SOURCE, "/a/b/c", "http://domain/a");
Exemple #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="window"></param>
        public StockViewModel(Window window)
        {
            ItemTypeCollection      = new ObservableCollection <ItemTypeModel>(ItemTypeModel.ItemTypeModelList);
            ItemType                = ItemTypeCollection.FirstOrDefault();
            InsertCommandVisibility = Visibility.Visible;
            UpdateCommandVisibility = Visibility.Collapsed;

            BindData();

            CloseCommand = new DelegateCommand(() =>
            {
                window.Close();
            });

            InsertCommand = new DelegateCommand(() =>
            {
                var item = new ItemMaster()
                {
                    Id         = Guid.NewGuid().ToString(),
                    ItemId     = ItemId,
                    ItemName   = ItemName,
                    ItemSize   = int.Parse(ItemSize),
                    ItemType   = ItemType.Type,
                    StockCount = Count,
                    StockPrice = decimal.Parse(StockPrice),
                    Price      = decimal.Parse(Price),
                    UpdateTime = DateTime.Now,
                    Color      = Color
                };

                if (SqlServerCompactService.InsertItemMaster(item))
                {
                    InitialControlValue();
                    BindData();
                }
            }, CanExcute);

            UpdateCommand = new DelegateCommand(() =>
            {
                var item = new ItemMaster()
                {
                    Id         = Id,
                    ItemId     = ItemId,
                    ItemName   = ItemName,
                    ItemSize   = int.Parse(ItemSize),
                    ItemType   = ItemType.Type,
                    StockCount = Count,
                    StockPrice = decimal.Parse(StockPrice),
                    Price      = decimal.Parse(Price),
                    UpdateTime = DateTime.Now,
                    Color      = Color
                };


                if (SqlServerCompactService.UpdateItemMaster(item))
                {
                    InitialControlValue();
                    BindData();
                    InsertCommandVisibility = Visibility.Visible;
                    UpdateCommandVisibility = Visibility.Collapsed;
                }
            }, CanExcute);

            ClearCommand = new DelegateCommand(() =>
            {
                InitialControlValue();
            });

            PreviousCommand = new DelegateCommand(() =>
            {
                PageIndex--;
                ItemMasterColletion = new ObservableCollection <ItemMaster>(SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(PageIndex > 0 ? true : false); });

            NextCommand = new DelegateCommand(() =>
            {
                PageIndex++;
                ItemMasterColletion = new ObservableCollection <ItemMaster>(SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return((PageIndex + 1) * PAGESIZE < SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Count() ? true : false); });

            SearchCommand = new DelegateCommand(() =>
            {
                var s               = SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0);
                PageIndex           = 0;
                ItemMasterColletion = new ObservableCollection <ItemMaster>(s.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchItemId) ? false : true); });

            AllCommand = new DelegateCommand(() =>
            {
                SearchItemId        = "";
                ItemMasterColletion = new ObservableCollection <ItemMaster>(SOURCE.Where(t => t.ItemId.IndexOf(SearchItemId, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchItemId) ? false : true); });

            SelectCommand = new DelegateCommand <ItemMaster>(s =>
            {
                if (s != null)
                {
                    InsertCommandVisibility = Visibility.Collapsed;
                    UpdateCommandVisibility = Visibility.Visible;

                    Id         = s.Id;
                    ItemId     = s.ItemId;
                    ItemName   = s.ItemName;
                    ItemSize   = s.ItemSize.ToString();
                    ItemType   = ItemTypeCollection.FirstOrDefault(t => t.Type == s.ItemType);
                    StockPrice = s.StockPrice.ToString();
                    Price      = s.Price.ToString();
                    Count      = s.StockCount;
                    Color      = s.Color;

                    IsRepeat = false;
                }
            });

            DeleteCommand = new DelegateCommand <ItemMaster>(s =>
            {
                if (s != null)
                {
                    if (MessageBox.Show(window, "是否确认删除该货品?", "确认删除点“Yes”,否则点“No”", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes) == MessageBoxResult.Yes)
                    {
                        SqlServerCompactService.DeleteItemMaster(s);
                        BindData();
                        InitialControlValue();
                    }
                }
            });
        }
Exemple #24
0
 public xCell()
 {
     value = 0;
     source = SOURCE.UNKNOWN;
     error = false;
 }
Exemple #25
0
        //
        // GET: /Public/
        public ActionResult HWMInfoPage(int siteId, int hwmId)
        {
            try
            {
                STNServiceCaller serviceCaller = STNServiceCaller.Instance;
                var request = new RestRequest();

                #region SiteInfo
                //get site
                request.Resource    = "Sites/{entityId}";
                request.RootElement = "SITE";
                request.AddParameter("entityId", siteId, ParameterType.UrlSegment);
                SITE thisSite = serviceCaller.Execute <SITE>(request);
                ViewData["Site"] = thisSite;

                //get hdatum

                request             = new RestRequest();
                request.Resource    = "Sites/{siteId}/hDatum";
                request.RootElement = "HORIZONTAL_DATUMS";
                request.AddParameter("siteId", thisSite.SITE_ID, ParameterType.UrlSegment);
                ViewData["HDatum"] = serviceCaller.Execute <HORIZONTAL_DATUMS>(request).DATUM_NAME;
                #endregion SiteInfo

                //get Peaks
                GetPeakSummaries(siteId);

                #region HWMinfo
                //get hwm
                request             = new RestRequest();
                request.Resource    = "HWMs/{entityId}";
                request.RootElement = "HWM";
                request.AddParameter("entityId", hwmId, ParameterType.UrlSegment);
                HWM aHWM = serviceCaller.Execute <HWM>(request);
                ViewData["HWM"] = aHWM;

                //get event
                request             = new RestRequest();
                request.Resource    = "/HWMs/{hwmId}/Event";
                request.RootElement = "EVENT";
                request.AddParameter("hwmId", aHWM.HWM_ID, ParameterType.UrlSegment);
                EVENT hwmEvent = serviceCaller.Execute <EVENT>(request);
                if (hwmEvent != null)
                {
                    ViewData["HwmEvent"] = hwmEvent.EVENT_NAME;
                }

                //get HWM Type
                request             = new RestRequest();
                request.Resource    = "/HWMTypes/{entityId}";
                request.RootElement = "HWM_TYPES";
                request.AddParameter("entityId", aHWM.HWM_TYPE_ID, ParameterType.UrlSegment);
                HWM_TYPES thisHWMType = serviceCaller.Execute <HWM_TYPES>(request);
                if (thisHWMType != null)
                {
                    ViewData["HWMType"] = thisHWMType.HWM_TYPE;
                }

                //get HWM Quality
                request             = new RestRequest();
                request.Resource    = "/HWMQualities/{entityId}";
                request.RootElement = "HWM_QUALITIES";
                request.AddParameter("entityId", aHWM.HWM_QUALITY_ID, ParameterType.UrlSegment);
                HWM_QUALITIES thisHWMQual = serviceCaller.Execute <HWM_QUALITIES>(request);
                if (thisHWMQual != null)
                {
                    ViewData["HWMQaul"] = thisHWMQual.HWM_QUALITY;
                }

                if (aHWM.FLAG_TEAM_ID != null && aHWM.FLAG_TEAM_ID != 0)
                {
                    //get CollectionTeam
                    request             = new RestRequest();
                    request.Resource    = "/CollectionTeams/{entityId}";
                    request.RootElement = "COLLECT_TEAM";
                    request.AddParameter("entityId", aHWM.FLAG_TEAM_ID, ParameterType.UrlSegment);
                    ViewData["FlagTeam"] = serviceCaller.Execute <COLLECT_TEAM>(request).DESCRIPTION;
                }

                if (aHWM.SURVEY_TEAM_ID != null && aHWM.SURVEY_TEAM_ID != 0)
                {
                    //get CollectionTeam
                    request             = new RestRequest();
                    request.Resource    = "/CollectionTeams/{entityId}";
                    request.RootElement = "COLLECT_TEAM";
                    request.AddParameter("entityId", aHWM.SURVEY_TEAM_ID, ParameterType.UrlSegment);
                    ViewData["SurveyTeam"] = serviceCaller.Execute <COLLECT_TEAM>(request).DESCRIPTION;
                }

                //get collectionMethod
                request             = new RestRequest();
                request.Resource    = "/VerticalMethods/{entityId}";
                request.RootElement = "VERTICAL_COLLECT_METHODS";
                request.AddParameter("entityId", aHWM.VCOLLECT_METHOD_ID, ParameterType.UrlSegment);
                VERTICAL_COLLECT_METHODS thisVCollMtd = serviceCaller.Execute <VERTICAL_COLLECT_METHODS>(request);
                if (thisVCollMtd != null)
                {
                    ViewData["VCollectMethod"] = thisVCollMtd.VCOLLECT_METHOD;
                }

                //Get Vertical Datum
                request             = new RestRequest();
                request.Resource    = "/VerticalDatums/{entityId}";
                request.RootElement = "VERTICAL_DATUMS";
                request.AddParameter("entityId", aHWM.VDATUM_ID, ParameterType.UrlSegment);
                VERTICAL_DATUMS thisVD = serviceCaller.Execute <VERTICAL_DATUMS>(request);
                if (thisVD != null)
                {
                    ViewData["VerticalDatum"] = thisVD.DATUM_NAME;
                }

                //Get marker
                request             = new RestRequest();
                request.Resource    = "/Markers/{entityId}";
                request.RootElement = "MARKER";
                request.AddParameter("entityId", aHWM.MARKER_ID, ParameterType.UrlSegment);
                MARKER thisMarker = serviceCaller.Execute <MARKER>(request);
                if (thisMarker != null)
                {
                    ViewData["Marker"] = thisMarker.MARKER1;
                }

                //get Horizontal Collection Method
                request             = new RestRequest();
                request.Resource    = "/HorizontalMethods/{entityId}";
                request.RootElement = "HORIZONTAL_COLLECT_METHODS";
                request.AddParameter("entityId", aHWM.HCOLLECT_METHOD_ID, ParameterType.UrlSegment);
                HORIZONTAL_COLLECT_METHODS thisHColMethod = serviceCaller.Execute <HORIZONTAL_COLLECT_METHODS>(request);
                if (thisHColMethod != null)
                {
                    ViewData["HColMethod"] = thisHColMethod.HCOLLECT_METHOD;
                }
                #endregion HWMinfo

                #region FileInfo
                //now get all the files
                request             = new RestRequest();
                request.Resource    = "/HWMs/{hwmId}/Files/";
                request.RootElement = "ArrayOfFILE";
                request.AddParameter("hwmId", aHWM.HWM_ID, ParameterType.UrlSegment);
                List <FILE> allTheseFiles = serviceCaller.Execute <List <FILE> >(request);
                List <FILE> photoFiles    = allTheseFiles.Where(pf => pf.FILETYPE_ID == 1).ToList();

                List <PhotoFileCaption> PhotoCapFiles = new List <PhotoFileCaption>();
                foreach (FILE f in photoFiles)
                {
                    //build caption
                    PhotoFileCaption thisPhoto = new PhotoFileCaption();
                    thisPhoto.FileID          = f.FILE_ID.ToString();
                    thisPhoto.FileDesc        = f.DESCRIPTION;
                    thisPhoto.SiteDescription = thisSite.SITE_DESCRIPTION;
                    thisPhoto.County          = thisSite.COUNTY;
                    thisPhoto.State           = thisSite.STATE;
                    thisPhoto.Date            = f.FILE_DATE;

                    request             = new RestRequest();
                    request.Resource    = "/Sources/{entityId}";
                    request.RootElement = "SOURCE";
                    request.AddParameter("entityId", f.SOURCE_ID, ParameterType.UrlSegment);
                    SOURCE thisSource = serviceCaller.Execute <SOURCE>(request);
                    thisPhoto.MemberName = thisSource.SOURCE_NAME;

                    request             = new RestRequest();
                    request.Resource    = "/Agencies/{entityId}";
                    request.RootElement = "AGENCY";
                    request.AddParameter("entityId", thisSource.AGENCY_ID, ParameterType.UrlSegment);
                    thisPhoto.MemberAgency = serviceCaller.Execute <AGENCY>(request).AGENCY_NAME;
                    PhotoCapFiles.Add(thisPhoto);
                }

                ViewData["PhotoCaptionList"] = PhotoCapFiles;
                #endregion FileInof

                return(PartialView());
            }
            catch (Exception e)
            {
                return(PartialView("../Shared/Error", e));
            }
        }
Exemple #26
0
        public ActionResult SensorInfoPage(int siteId, int sensorId)
        {
            try
            {
                STNServiceCaller serviceCaller = STNServiceCaller.Instance;
                var request = new RestRequest();

                #region SiteInfo
                //get site
                request.Resource    = "Sites/{entityId}";
                request.RootElement = "SITE";
                request.AddParameter("entityId", siteId, ParameterType.UrlSegment);
                SITE thisSite = serviceCaller.Execute <SITE>(request);
                ViewData["Site"] = thisSite;

                //get hdatum
                request             = new RestRequest();
                request.Resource    = "/HorizontalDatums/{entityId}";
                request.RootElement = "HORIZONTAL_DATUMS";
                request.AddParameter("entityId", thisSite.HDATUM_ID, ParameterType.UrlSegment);
                ViewData["HDatum"] = serviceCaller.Execute <HORIZONTAL_DATUMS>(request).DATUM_NAME;
                #endregion SiteInfo

                //get peaks
                GetPeakSummaries(siteId);

                #region SensorInfo
                //get the sensor
                request             = new RestRequest();
                request.Resource    = "Instruments/{entityId}";
                request.RootElement = "INSTRUMENT";
                request.AddParameter("entityId", sensorId, ParameterType.UrlSegment);
                INSTRUMENT thisInstrument = serviceCaller.Execute <INSTRUMENT>(request);
                ViewData["Instrument"] = thisInstrument;

                //get event
                request             = new RestRequest();
                request.Resource    = "/Instruments/{instrumentId}/Event";
                request.RootElement = "EVENT";
                request.AddParameter("instrumentId", thisInstrument.INSTRUMENT_ID, ParameterType.UrlSegment);
                EVENT sensorEvent = serviceCaller.Execute <EVENT>(request);
                ViewData["sensorEvent"] = sensorEvent.EVENT_NAME;

                //pull from log the statuses
                request             = new RestRequest();
                request.Resource    = "/Instruments/{instrumentId}/InstrumentStatusLog";
                request.RootElement = "ArrayOfInstrumentStatus";
                request.AddParameter("instrumentId", sensorId, ParameterType.UrlSegment);
                List <INSTRUMENT_STATUS> InstrStatusList = serviceCaller.Execute <List <INSTRUMENT_STATUS> >(request);

                foreach (INSTRUMENT_STATUS IS in InstrStatusList)
                {
                    switch (Convert.ToInt32(IS.STATUS_TYPE_ID))
                    {
                    case 1:
                        ViewData["DeployedStatus"] = IS;
                        break;

                    case 2:
                        ViewData["RetrievedStatus"] = IS;
                        break;

                    default:
                        ViewData["LostStatus"] = IS;
                        break;
                    }
                }

                //get Sensor Type if one
                if (thisInstrument.SENSOR_TYPE_ID != null)
                {
                    request             = new RestRequest();
                    request.Resource    = "/SensorTypes/{entityId}";
                    request.RootElement = "SENSOR_TYPE";
                    request.AddParameter("entityId", thisInstrument.SENSOR_TYPE_ID, ParameterType.UrlSegment);
                    string aSensor = serviceCaller.Execute <SENSOR_TYPE>(request).SENSOR;
                    ViewData["SensorType"] = aSensor;
                }

                ////get deployment_type if one
                if (thisInstrument.DEPLOYMENT_TYPE_ID != null && thisInstrument.DEPLOYMENT_TYPE_ID != 0)
                {
                    request             = new RestRequest();
                    request.Resource    = "/DeploymentTypes/{entityId}";
                    request.RootElement = "DEPLOYMENT_TYPE";
                    request.AddParameter("entityId", thisInstrument.DEPLOYMENT_TYPE_ID, ParameterType.UrlSegment);
                    string aDepType = serviceCaller.Execute <DEPLOYMENT_TYPE>(request).METHOD;
                    ViewData["DeplType"] = aDepType;
                }
                //get condition
                if (thisInstrument.INST_COLLECTION_ID != null && thisInstrument.INST_COLLECTION_ID != 0)
                {
                    request             = new RestRequest();
                    request.Resource    = "/InstrCollectConditions/{entityId}";
                    request.RootElement = "INSTR_COLLECTION_CONDITIONS";
                    request.AddParameter("entityId", thisInstrument.INST_COLLECTION_ID, ParameterType.UrlSegment);
                    ViewData["Condition"] = serviceCaller.Execute <INSTR_COLLECTION_CONDITIONS>(request).CONDITION;
                }

                if (InstrStatusList.Count > 1)
                {
                    if (InstrStatusList[0].COLLECTION_TEAM_ID != 0 && InstrStatusList[0].COLLECTION_TEAM_ID != null)
                    {
                        request             = new RestRequest();
                        request.Resource    = "/CollectionTeams/{entityId}";
                        request.RootElement = "COLLECT_TEAM";
                        request.AddParameter("entityId", InstrStatusList[0].COLLECTION_TEAM_ID, ParameterType.UrlSegment);
                        COLLECT_TEAM ct = serviceCaller.Execute <COLLECT_TEAM>(request);
                        ViewData["depTeamName"] = ct.DESCRIPTION;
                    }
                    if (InstrStatusList[1].COLLECTION_TEAM_ID != 0 && InstrStatusList[1].COLLECTION_TEAM_ID != null)
                    {
                        request             = new RestRequest();
                        request.Resource    = "/CollectionTeams/{entityId}";
                        request.RootElement = "COLLECT_TEAM";
                        request.AddParameter("entityId", InstrStatusList[1].COLLECTION_TEAM_ID, ParameterType.UrlSegment);
                        COLLECT_TEAM ct = serviceCaller.Execute <COLLECT_TEAM>(request);
                        ViewData["retTeamName"] = ct.DESCRIPTION;
                    }
                }
                #endregion SensorInfo

                #region FileInfo
                request             = new RestRequest();
                request.Resource    = "/Instruments/{instrumentId}/Files";
                request.RootElement = "ArrayOfFILE";
                request.AddParameter("instrumentId", sensorId, ParameterType.UrlSegment);
                List <FILE> sensorFiles = serviceCaller.Execute <List <FILE> >(request);

                ViewData["dataFiles"] = sensorFiles.Where(df => df.FILETYPE_ID == 2).ToList();
                List <FILE> photoFiles = sensorFiles.Where(pf => pf.FILETYPE_ID == 1).ToList();

                //build photo caption
                List <PhotoFileCaption> photoCapFiles = new List <PhotoFileCaption>();
                foreach (FILE f in photoFiles)
                {
                    PhotoFileCaption thisPhoto = new PhotoFileCaption();
                    thisPhoto.FileID          = f.FILE_ID.ToString();
                    thisPhoto.FileDesc        = f.DESCRIPTION;
                    thisPhoto.SiteDescription = thisSite.SITE_DESCRIPTION;
                    thisPhoto.County          = thisSite.COUNTY;
                    thisPhoto.State           = thisSite.STATE;
                    thisPhoto.Date            = f.FILE_DATE;

                    request             = new RestRequest();
                    request.Resource    = "/Sources/{entityId}";
                    request.RootElement = "SOURCE";
                    request.AddParameter("entityId", f.SOURCE_ID, ParameterType.UrlSegment);
                    SOURCE thisSource = serviceCaller.Execute <SOURCE>(request);
                    thisPhoto.MemberName = thisSource.SOURCE_NAME;

                    request             = new RestRequest();
                    request.Resource    = "/Agencies/{entityId}";
                    request.RootElement = "AGENCY";
                    request.AddParameter("entityId", thisSource.AGENCY_ID, ParameterType.UrlSegment);
                    thisPhoto.MemberAgency = serviceCaller.Execute <AGENCY>(request).AGENCY_NAME;
                    photoCapFiles.Add(thisPhoto);
                }
                ViewData["PhotoCaptionList"] = photoCapFiles;

                #endregion FileInfo

                return(PartialView());
            }
            catch (Exception e)
            {
                return(PartialView("../Shared/Error", e));
            }
        }
Exemple #27
0
 public xCell()
 {
     value  = 0;
     source = SOURCE.UNKNOWN;
     error  = false;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="windwow"></param>
        public CustomerViewModel(Window window)
        {
            InsertCommandVisibility = Visibility.Visible;
            UpdateCommandVisibility = Visibility.Collapsed;
            DepositIsReadOnly       = false;

            BindData();

            CloseCommand = new DelegateCommand(() =>
            {
                window.Close();
            });

            InsertCommand = new DelegateCommand(() =>
            {
                var customer = new Customer()
                {
                    Id         = Guid.NewGuid().ToString(),
                    Name       = Name,
                    Phone      = Phone,
                    IM         = IM,
                    Deposit    = string.IsNullOrEmpty(Deposit)? 0: decimal.Parse(Deposit),
                    Discount   = Discount,
                    Remark     = Remark,
                    UpdateTime = DateTime.Now
                };

                if (SqlServerCompactService.InsertCustomer(customer))
                {
                    InitialControlValue();
                    BindData();
                }
            }, CanExcute);

            UpdateCommand = new DelegateCommand(() =>
            {
                var item = new Customer()
                {
                    Id         = Id,
                    Name       = Name,
                    Phone      = Phone,
                    IM         = IM,
                    Discount   = Discount,
                    Deposit    = string.IsNullOrEmpty(Deposit) ? 0 : decimal.Parse(Deposit),
                    Remark     = Remark,
                    UpdateTime = DateTime.Now
                };

                if (SqlServerCompactService.UpdateCustomer(item))
                {
                    InitialControlValue();
                    BindData();
                }
            }, CanExcute);

            SelectCommand = new DelegateCommand <Customer>(s =>
            {
                if (s != null)
                {
                    InsertCommandVisibility = Visibility.Collapsed;
                    UpdateCommandVisibility = Visibility.Visible;
                    DepositIsReadOnly       = true;

                    Id       = s.Id;
                    Name     = s.Name;
                    Phone    = s.Phone;
                    IM       = s.IM;
                    Discount = s.Discount;
                    Deposit  = s.Deposit.ToString();
                    Remark   = s.Remark;

                    IsPhoneRepeat = false;
                    IsIMRepeat    = false;
                }
            });

            AddDepositCommand = new DelegateCommand(() =>
            {
                PopupIsOpen = !PopupIsOpen;
            });

            UpdateDepositCommand = new DelegateCommand(() =>
            {
                decimal j = 0;
                decimal.TryParse(Deposit, out j);
                if (SqlServerCompactService.TopUpCustomerDeposit(Id, j))
                {
                    BindData();
                    PopupIsOpen = false;

                    InitialControlValue();
                }
            }, () => {
                var ret   = false;
                decimal j = 0;
                if (!string.IsNullOrEmpty(Deposit) && decimal.TryParse(Deposit, out j))
                {
                    if (j > 0)
                    {
                        ret = true;
                    }
                }
                return(ret);
            });


            DeleteCommand = new DelegateCommand <Customer>(s =>
            {
                if (s != null)
                {
                    if (MessageBox.Show(window, "是否确认删除该客户?", "确认删除点“Yes”,否则点“No”", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes) == MessageBoxResult.Yes)
                    {
                        SqlServerCompactService.DeleteCustomer(s);
                        BindData();
                        InitialControlValue();
                    }
                }
            });

            ViewCommand = new DelegateCommand <Customer>(s =>
            {
                ViewCustomerDetailWindow w        = new ViewCustomerDetailWindow();
                ViewCustomerDetailViewModel model = new ViewCustomerDetailViewModel(w, s);
                w.DataContext = model;
                w.Owner       = App.Current.MainWindow;
                w.ShowDialog();
            });

            ClearCommand = new DelegateCommand(() =>
            {
                InitialControlValue();
            });

            PreviousCommand = new DelegateCommand(() =>
            {
                PageIndex--;
                CustomerColletion = new ObservableCollection <Customer>(SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(PageIndex > 0 ? true : false); });

            NextCommand = new DelegateCommand(() =>
            {
                PageIndex++;
                CustomerColletion = new ObservableCollection <Customer>(SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return((PageIndex + 1) * PAGESIZE < SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Count() ? true : false); });

            SearchCommand = new DelegateCommand(() =>
            {
                var s             = SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0);
                PageIndex         = 0;
                CustomerColletion = new ObservableCollection <Customer>(s.Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchName) ? false : true); });

            AllCommand = new DelegateCommand(() =>
            {
                SearchName        = "";
                CustomerColletion = new ObservableCollection <Customer>(SOURCE.Where(t => t.Name.IndexOf(SearchName, StringComparison.OrdinalIgnoreCase) >= 0).Skip(PageIndex * PAGESIZE).Take(PAGESIZE));
            }, () => { return(string.IsNullOrEmpty(SearchName) ? false : true); });
        }
Exemple #29
0
        /// <summary>
        /// Method used to add a property to the instance. Will be placed in the correct class Property.
        /// </summary>
        /// <param name="input">The vCard.Property to add.</param>
        public void AddProperty(Props.IProperty input)
        {
            if (input == null || input.IsValueNull)
            {
                return;
            }

            switch (input.Property)
            {
            case KnownProperties.ADR:
                ADR.AddIfNotNull(input as Props.ADR);
                break;

            case KnownProperties.ANNIVERSARY:
                ANNIVERSARY = input as Props.ANNIVERSARY;
                break;

            case KnownProperties.BDAY:
                BDAY = input as Props.BDAY;
                break;

            case KnownProperties.CALADRURI:
                CALADRURI.AddIfNotNull(input as Props.CALADRURI);
                break;

            case KnownProperties.CALURI:
                CALURI.AddIfNotNull(input as Props.CALURI);
                break;

            case KnownProperties.CATEGORIES:
                CATEGORIES.AddIfNotNull(input as Props.CATEGORIES);
                break;

            case KnownProperties.CLIENTPIDMAP:
                CLIENTPIDMAP.AddIfNotNull(input as Props.CLIENTPIDMAP);
                break;

            case KnownProperties.EMAIL:
                EMAIL.AddIfNotNull(input as Props.EMAIL);
                break;

            case KnownProperties.FBURL:
                FBURL.AddIfNotNull(input as Props.FBURL);
                break;

            case KnownProperties.FN:
                FN.AddIfNotNull(input as Props.FN);
                break;

            case KnownProperties.GENDER:
                GENDER = input as Props.GENDER;
                break;

            case KnownProperties.GEO:
                GEO.AddIfNotNull(input as Props.GEO);
                break;

            case KnownProperties.IMPP:
                IMPP.AddIfNotNull(input as Props.IMPP);
                break;

            case KnownProperties.KEY:
                KEY.AddIfNotNull(input as Props.KEY);
                break;

            case KnownProperties.KIND: {
                char k = (input as Props.KIND).Value.ToLower()[0];
                if (k == 'i')
                {
                    KIND = Kinds.Individual;
                }
                else if (k == 'g')
                {
                    KIND = Kinds.Group;
                }
                else if (k == 'o')
                {
                    KIND = Kinds.Org;
                }
                else if (k == 'l')
                {
                    KIND = Kinds.Location;
                }
                else
                {
                    KIND = Kinds.Individual;
                }
                break;
            }

            case KnownProperties.LANG:
                LANG.AddIfNotNull(input as Props.LANG);
                break;

            case KnownProperties.LOGO:
                LOGO.AddIfNotNull(input as Props.LOGO);
                break;

            case KnownProperties.MEMBER:
                MEMBER.AddIfNotNull(input as Props.MEMBER);
                break;

            case KnownProperties.N:
                N = input as Props.N;
                break;

            case KnownProperties.NICKNAME:
                NICKNAME.AddIfNotNull(input as Props.NICKNAME);
                break;

            case KnownProperties.NOTE:
                NOTE.AddIfNotNull(input as Props.NOTE);
                break;

            case KnownProperties.ORG:
                ORG.AddIfNotNull(input as Props.ORG);
                break;

            case KnownProperties.PHOTO:
                PHOTO.AddIfNotNull(input as Props.PHOTO);
                break;

            case KnownProperties.PRODID:
                PRODID = input as Props.PRODID;
                break;

            case KnownProperties.RELATED:
                RELATED.AddIfNotNull(input as Props.RELATED);
                break;

            case KnownProperties.REV:
                REV = input as Props.REV;
                break;

            case KnownProperties.ROLE:
                ROLE.AddIfNotNull(input as Props.ROLE);
                break;

            case KnownProperties.SOUND:
                SOUND.AddIfNotNull(input as Props.SOUND);
                break;

            case KnownProperties.SOURCE:
                SOURCE.AddIfNotNull(input as Props.SOURCE);
                break;

            case KnownProperties.TEL:
                TEL.AddIfNotNull(input as Props.TEL);
                break;

            case KnownProperties.TITLE:
                TITLE.AddIfNotNull(input as Props.TITLE);
                break;

            case KnownProperties.TZ:
                TZ.AddIfNotNull(input as Props.TZ);
                break;

            case KnownProperties.UID:
                UID = input as Props.UID;
                break;

            case KnownProperties.URL:
                URL.AddIfNotNull(input as Props.URL);
                break;

            case KnownProperties.VERSION:
                VERSION = input as Props.VERSION;
                break;

            case KnownProperties.XML:
                XML.AddIfNotNull(input as Props.XML);
                break;

            default:
                return;
            }
        }