Beispiel #1
0
 public void Subscribe()
 {
     MessageService.Subscribe <PlaceListViewModel>(this, (Action <PlaceListViewModel, string, object>) this.OnMessage);
     PlaceList.Subscribe();
     PlaceDetails.Subscribe();
     PlaceOrders.Subscribe();
 }
        private void TestGetClosestPlaceException()
        {
            var PlaceList = new PlaceList();
            var location  = new Location(0, 0);

            PlaceList.GetClosestPlace(location);
        }
Beispiel #3
0
 public void Unsubscribe()
 {
     MessageService.Unsubscribe(this);
     PlaceList.Unsubscribe();
     PlaceDetails.Unsubscribe();
     PlaceOrders.Unsubscribe();
 }
 private void addPlaceButtonClick()
 {
     if (PlaceNameData != null && PlaceInfoData != null)
     {
         PlaceModel temp = new PlaceModel();
         temp.Name        = PlaceNameData;
         temp.Information = PlaceInfoData;
         temp.DateStart   = PlaceDSData.ToString("dd/MM/yyyy");
         temp.DateFinish  = PlaceDFData.ToString("dd/MM/yyyy");
         PlaceList.Add(temp);
     }
     else
     {
         MessageBox.Show("Vui lòng nhập đủ thông tin trước khi thêm!!!");
     }
     PlaceNameData = null;
     PlaceInfoData = null;
     PlaceDSData   = DateTime.Now;
     PlaceDFData   = DateTime.Now;
     OnPropertyChanged(nameof(PlaceList));
     OnPropertyChanged(nameof(PlaceNameData));
     OnPropertyChanged(nameof(PlaceInfoData));
     OnPropertyChanged(nameof(PlaceDSData));
     OnPropertyChanged(nameof(PlaceDFData));
 }
Beispiel #5
0
    //删除按键
    protected void Delete_Click(object sender, EventArgs e)
    {
        //获取当前行id
        Button      but = (Button)sender;
        GridViewRow row = (GridViewRow)but.NamingContainer;
        int         id  = int.Parse(row.Cells[0].Text);
        //判断操作对象并执行操作
        string table_name = Request.QueryString["name"];
        //受影响行数
        int r = 0;

        switch (table_name)
        {
        case "type":
            TypeList type = new TypeList();
            r = type.DeleteOne(id);
            break;

        case "place":
            PlaceList place = new PlaceList();
            r = place.DeleteOne(id);
            break;
        }
        BuildView();
        if (r == int.Parse(row.Cells[2].Text))
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('删除成功');", true);
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('删除失败');", true);
        }
    }
        private async Task ExecuteRefresh()
        {
            try
            {
                MaterialViewModel c = SelectedPlace;
                var mats            = await _warehouse.DBService.GetPlacesMaterialID(_excludeWout);

                PlaceList.Clear();
                foreach (var p in mats)
                {
                    PlaceList.Add(new MaterialViewModel {
                        Location = p.Location, ID = p.ID, Size = p.Size, Weight = p.Weight
                    });
                }
                foreach (var mvm in PlaceList)
                {
                    mvm.Initialize(_warehouse);
                }
//                RaisePropertyChanged("PlaceList");
                if (c != null)
                {
                    SelectedPlace = PlaceList.FirstOrDefault(p => p.ID == c.ID);
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
Beispiel #7
0
    //建立页面
    void BuildView()
    {
        //判断并获取数据源
        DataTable data       = null;
        string    table_name = Request.QueryString["name"];

        switch (table_name)
        {
        case "type":
            title = "衣服分类";
            TypeList type = new TypeList();
            data = type.ReadCount();
            break;

        case "place":
            title = "存放地点";
            PlaceList place = new PlaceList();
            data = place.ReadCount();
            break;
        }
        //建立表格
        GridView.DataSource = data;
        GridView.DataBind();
        //添加是否删除的确认弹窗
        Button delBtn;

        for (int i = 0; i < GridView.Rows.Count; i++)
        {
            delBtn = (Button)GridView.Rows[i].FindControl("Delete");
            delBtn.Attributes.Add("onclick", "javascript:if (confirm('确定要删除吗,将会删除该分类下所有衣服数据')) { return true; } else { return false; }");
        }
    }
        public override async Task OnResume()
        {
            await base.OnResume();

            HttpResponseMessage res;

            try {
                res = await _apiClient.Execute(HttpMethod.Get, Urls.URI + Urls.PLACES);
            }catch {
                await _dialogService.Value.DisplayAlertAsync("Connection Failed...", "", "Ok");

                return;
            }
            Response <Collection <PlaceItemSummary> > resp = await _apiClient.ReadFromResponse <Response <Collection <PlaceItemSummary> > >(res);

            if (resp.IsSuccess)
            {
                Dictionary <int, PlaceItemSummary> placeById = PlaceList.ToDictionary(x => x.Id, x => x);
                foreach (PlaceItemSummary place in resp.Data)
                {
                    if (!placeById.ContainsKey(place.Id))
                    {
                        place.SelectPlaceCommand = SelectPlaceCommand;
                        PlaceList.Add(place);
                    }
                }
            }
            else if (PlaceList.Count == 0)
            {
                await _dialogService.Value.DisplayAlertAsync("Échec de récupération de la liste", "", "OK");
            }
        }
Beispiel #9
0
    //保存按键
    protected void SaveNew_Click(object sender, EventArgs e)
    {
        //判断操作对象并执行操作
        string table_name = Request.QueryString["name"];
        bool   r          = false;
        string newName    = NewName.Text.Trim();

        if (newName != "")
        {
            switch (table_name)
            {
            case "type":
                TypeList type = new TypeList();
                r = type.AddOne(newName);
                break;

            case "place":
                PlaceList place = new PlaceList();
                r = place.AddOne(newName);
                break;
            }
        }
        BuildView();
        if (r)
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('添加成功');", true);
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('添加失败');", true);
        }
    }
Beispiel #10
0
 public void Clean()
 {
     PlaceList.Clear();
     TreasureList.Clear();
     TreasureSelected = null;
     PlaceSelected    = null;
 }
        public void TestPlaceListNotLoadedException()
        {
            var placeList = new PlaceList();
            var location  = new Location(58, 10);

            Assert.Throws <PlaceListNotLoadedException>(() => placeList.GetClosestPlace(location));
        }
Beispiel #12
0
        public void AddPlaceForTrip(object o)
        {
            var           parameter = (object[])o;
            List <string> Data      = new List <string>();

            foreach (var x in parameter)
            {
                if (x.GetType().Equals(typeof(DateTime)))
                {
                    DateTime y = (DateTime)x;
                    Data.Add(y.ToString("dd/MM/yyyy"));
                }
                else
                {
                    Data.Add(x.ToString());
                }
            }
            PlaceModel temp = new PlaceModel();

            temp.Name        = Data[0];
            temp.Information = Data[1];
            temp.DateStart   = Data[2];
            temp.DateFinish  = Data[3];
            Trip.AddPlace(temp);
            PlaceList.Add(temp);
            OnPropertyChanged(nameof(Trip));
        }
Beispiel #13
0
            public bool AddTree(int[] place, ref PlaceList parent)
            {
                int i;

                if (parent == null)
                {
                    parent          = new PlaceList();
                    parent.Place[0] = place[0];
                    parent.Place[1] = place[1];

                    return(true);
                }

                for (i = 0; i < 2; i++)
                {
                    if (parent.Place[i] > place[i])
                    {
                        return(AddTree(place, ref parent.Right));
                    }
                    else if (parent.Place[i] < place[i])
                    {
                        return(AddTree(place, ref parent.Left));
                    }
                }

                return(false);
            }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     HomeModel homeModel = new HomeModel();
     CommonModel.bgImage = homeModel.bgImage;
     imgBack.Source = homeModel.bgImage;
     PlaceList m = new PlaceList();
     postXMLData1();
 }
 private void doneButtonClick()
 {
     if (TripName == null)
     {
         MessageBox.Show("Tên chuyến đi rỗng!!!");
     }
     else if (ImageSource == null)
     {
         MessageBox.Show("Image is empty", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         List <MemberInTripModel> tempMember   = new List <MemberInTripModel>();
         List <PlaceModel>        tempPlace    = new List <PlaceModel>();
         List <ExpenseModel>      tempExpenses = new List <ExpenseModel>();
         for (int i = 0; i < MemberList.Count(); i++)
         {
             tempMember.Add(MemberList[i]);
         }
         for (int i = 0; i < PlaceList.Count(); i++)
         {
             tempPlace.Add(PlaceList[i]);
         }
         for (int i = 0; i < ExpensesList.Count(); i++)
         {
             tempExpenses.Add(ExpensesList[i]);
         }
         TripModel newTrip = DatabaseAccess.AddNewTrip(TripName, tempMember, tempExpenses, tempPlace);
         //Thêm hình
         if (ImageSource == null)
         {
             ImageSource = "";
         }
         var directory         = AppDomain.CurrentDomain.BaseDirectory;
         var locationDirectory = AppDomain.CurrentDomain.BaseDirectory;
         directory         += "Data\\Images\\TripsImage\\" + newTrip.ID + "\\Main";
         locationDirectory += "Data\\Images\\TripsImage\\" + newTrip.ID + "\\Location";
         if (!Directory.Exists(directory))
         {
             Directory.CreateDirectory(directory);
         }
         if (!Directory.Exists(locationDirectory))
         {
             Directory.CreateDirectory(locationDirectory);
         }
         string fileName   = "main.png";
         string sourcePath = ImageSource;
         string targetPath = directory;
         //Combine file và đường dẫn
         string sourceFile = System.IO.Path.Combine(sourcePath, "");
         string destFile   = System.IO.Path.Combine(targetPath, fileName);
         //Copy file từ file nguồn đến file đích
         System.IO.File.Copy(sourceFile, destFile, true);
         MessageBox.Show("Thêm chuyến đi mới thành công!!!");
         ICommand BackToHomePage = new UpdateMainViewCommand(MainViewModel);
         BackToHomePage.Execute((object)"HomePage");
     }
 }
Beispiel #16
0
        public ICopySupportObject Clone()
        {
            var u = new Universe()
            {
                Description = Description, BeginTime = BeginTime, EndTime = EndTime
            };

            LawList.ForEach(v => u.LawList.Add(v.Clone() as IRole));
            PlaceList.ForEach(v => u.PlaceList.Add(v.Clone() as IPlace));
            return(u);
        }
Beispiel #17
0
        public void TestLoadIsTrue()
        {
            var location = new Location(5913118, 1021665);
            var place    = new Place("norway", "vestfold", "sandefjord", "Sandefjord", location);


            var placelist = new PlaceList();

            placelist.Load(new[] { place });
            Assert.IsTrue(placelist.IsLoaded);
        }
        public void TestGetClosestPlace()
        {
            var location  = new Location(59.13118f, 10.21665f);
            var place     = new Place("Norway", "Vestfold", "Sandefjord", "Sandefjord", location);
            var placeList = new PlaceList();

            placeList.Load(new[] { place });
            var closestPlace = placeList.GetClosestPlace(location);

            Assert.AreEqual(place, closestPlace);
        }
        public void TestGetClosestPlace3()
        {
            var location1 = new Location(0.5f, 0.5f);
            var place1    = new Place("Norway", "Vestfold", "Sandefjord", "Sandefjord", location1);
            var location2 = new Location(0.6f, 0.6f);
            var place2    = new Place("Norway", "Vestfold", "Sandefjord", "Sandefjord", location2);
            var placeList = new PlaceList();

            placeList.Load(new[] { place1, place2 });
            var location3    = new Location(0.7f, 0.7f);
            var closestPlace = placeList.GetClosestPlace(location2);

            Assert.AreEqual(place2, closestPlace);
        }
Beispiel #20
0
        /// <summary>Update Data event, runs every time</summary>
        /// <param name="something"></param>
        private async void UpdateData(string something)
        {
            using (var db = new MainDbContext())
            {
                var places =
                    await db.Locations.Where(loc => loc.Devices.Count > 0).Include(loc => loc.CropCycles).ToListAsync();

                var cropTypeCache = await db.CropTypes.ToListAsync();

                foreach (var cropType in cropTypeCache)
                {
                    if (_cropTypeCache.Any(ct => ct.Key.Equals(cropType.Name.ToLower())) == false)
                    {
                        var pair = new KeyValuePair <string, CropType>(cropType.Name.ToLower(), cropType);
                        _cropTypeCache.Add(pair);
                    }
                }

                foreach (var loc in places)
                {
                    var tuple = PlaceList.FirstOrDefault(ct => ct.Location.Equals(loc));
                    if (tuple == null)
                    {
                        tuple = new PlaceTuple {
                            Location = loc
                        };
                        PlaceList.Add(tuple);
                    }

                    var runningCropCycle = loc.CropCycles.FirstOrDefault(cc => cc.EndDate == null);
                    if (runningCropCycle != null)
                    {
                        tuple.DisplayName = loc.Name + " - already monitoring " + runningCropCycle.CropTypeName +
                                            " of variety " + runningCropCycle.CropVariety;
                        tuple.IsVacant = false;
                    }
                    else
                    {
                        tuple.DisplayName = loc.Name + " - Avaliable";
                        tuple.IsVacant    = true;
                    }
                }
                OnPropertyChanged(nameof(PlaceList));
            }
        }
Beispiel #21
0
    //建立页面
    private void BuildView()
    {
        Clothes clothes = new Clothes();

        NewID.Text = clothes.GetNewID().ToString();
        DataTable data = null;
        TypeList  type = new TypeList();

        data = type.ReadAll();
        TypeRadio.DataSource     = data;
        TypeRadio.DataTextField  = "name";
        TypeRadio.DataValueField = "id";
        TypeRadio.DataBind();
        PlaceList place = new PlaceList();

        data = place.ReadAll();
        PlaceRadio.DataSource     = data;
        PlaceRadio.DataTextField  = "name";
        PlaceRadio.DataValueField = "id";
        PlaceRadio.DataBind();
    }
Beispiel #22
0
    protected void Change_Click(object sender, EventArgs e)
    {
        ConditionRadio.Visible  = true;
        GradeRadio.Visible      = true;
        PlaceRadio.Visible      = true;
        TypeRadio.Visible       = true;
        SeatText.Visible        = true;
        DescribeText.Visible    = true;
        Restore.Visible         = true;
        Save.Visible            = true;
        labelFileUpload.Visible = true;
        Delete.Visible          = false;
        Return.Visible          = false;
        Change.Visible          = false;
        SeatLabel.Visible       = false;
        DescribeLabel.Visible   = false;
        TypeList  type = new TypeList();
        DataTable data = type.ReadAll();

        TypeRadio.DataSource     = data;
        TypeRadio.DataTextField  = "name";
        TypeRadio.DataValueField = "id";
        TypeRadio.DataBind();
        PlaceList place = new PlaceList();

        data = place.ReadAll();
        PlaceRadio.DataSource     = data;
        PlaceRadio.DataTextField  = "name";
        PlaceRadio.DataValueField = "id";
        PlaceRadio.DataBind();
        //设置默认选择项
        ConditionRadio.SelectedValue = ConditionLabel.ToolTip;
        GradeRadio.SelectedValue     = GradeLabel.ToolTip;
        PlaceRadio.SelectedValue     = PlaceLabe.ToolTip;
        TypeRadio.SelectedValue      = TypeLabel.ToolTip;
        SeatText.Text      = SeatLabel.Text;
        DescribeText.Value = DescribeLabel.Text;
    }
Beispiel #23
0
    //保存重命名
    protected void Save_Click(object sender, EventArgs e)
    {
        Button      but = (Button)sender;
        GridViewRow row = (GridViewRow)but.NamingContainer;
        //获取当前行id
        int     id      = int.Parse(row.Cells[0].Text);
        TextBox textBox = (TextBox)row.FindControl("ReName_text");
        //获取要修改的新名字
        string newName = textBox.Text.Trim();
        //判断操作对象并执行操作
        string table_name = Request.QueryString["name"];
        bool   r          = false;

        if (newName != "")
        {
            switch (table_name)
            {
            case "type":
                TypeList type = new TypeList();
                r = type.UpdateOne(id, newName);
                break;

            case "place":
                PlaceList place = new PlaceList();
                r = place.UpdateOne(id, newName);
                break;
            }
        }
        BuildView();
        if (r)
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('修改成功');", true);
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "", "window.alert('修改失败');", true);
        }
    }
Beispiel #24
0
        private void Init(DataTemplate template)
        {
            Random random = new Random(DateTime.Now.Millisecond);

            foreach (var info in _mapPointsInfo)
            {
                var mapPointViewModel = new MapPointViewModel(info)
                {
                    Count = _mapNameToCount[info.Name]
                };
                mapPointViewModel.Zoom          = Zoom;
                mapPointViewModel.MapPointColor = new SolidColorBrush(Color.FromRgb(
                                                                          (byte)random.Next(1, 255),
                                                                          (byte)random.Next(1, 255),
                                                                          (byte)random.Next(1, 255)));
                PlaceList.Add(mapPointViewModel);
                _mapNameToMapPoint.Add(mapPointViewModel.Name, mapPointViewModel);

                var mapCustomElement = new MapCustomElement()
                {
                    Content         = mapPointViewModel,
                    ContentTemplate = template,
                };

                _mapNameToMapElement.Add(info.Name, mapCustomElement);

                mapCustomElement.MouseLeftButtonDown += OnMapCustomElementClick;

                BindingOperations.SetBinding(mapCustomElement, MapCustomElement.LocationProperty,
                                             new Binding("Location")
                {
                    Source = mapPointViewModel
                });

                MapElements.Add(mapCustomElement);
            }
        }
        public async void postXMLData1()
        {
            try
            {
                StorageFile sampleFile = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync("PlaceNames.xml");
                String timestamp = await FileIO.ReadTextAsync(sampleFile);
                XDocument loadedData = XDocument.Parse(timestamp);
                var PlaceList = loadedData.Descendants("PlaceList").
                Select(x => new PlaceList
                {
                    PlaceID = x.Element("placeID").Value,
                    PlaceCode = x.Element("placeCode").Value,
                    PlaceName = x.Element("placeName").Value
                });
                foreach (var item in PlaceList)
                {
                    PlaceList pl = new PlaceList();
                    pl.PlaceID = item.PlaceID;
                    pl.PlaceName = item.PlaceName;
                    pl.PlaceCode = item.PlaceCode;
                    CityList.Add(pl);
                }
                ListMenuItems.ItemsSource = PlaceList;
                LoderPopup.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {

                PopupError.Visibility = Visibility.Visible;
                LoderPopup.Visibility = Visibility.Collapsed;
                ExceptionLog obj = new ExceptionLog();
                Error objError = new Error();
                objError.ErrorEx = ex.Message;
                obj.CreateLogFile(objError);
            }
        }
Beispiel #26
0
 public void Unload()
 {
     PlaceDetails.CancelEdit();
     PlaceList.Unload();
 }
        public async void postXMLData1()
        {
            try
            {
                string uri = AppStatic.WebServiceBaseURL;  // some xml string
                Uri _url = new Uri(uri, UriKind.RelativeOrAbsolute);
                GetAvailableServicesRequest _objAGR = new GetAvailableServicesRequest();
                _objAGR.franchUserID = AppStatic.franchUserID;
                _objAGR.password = AppStatic.password;
                _objAGR.userID = AppStatic.userID;
                _objAGR.userKey = AppStatic.userKey;
                _objAGR.userName = AppStatic.userName;
                _objAGR.userRole = AppStatic.userRole;
                _objAGR.userStatus = AppStatic.userStatus;
                _objAGR.userType = AppStatic.userType;
                _objAGR.placeNameFrom = txtBFromLocationT.Text;
                _objAGR.placeNameTo = txtBToLocationT.Text;
                _objAGR.placeIDFrom = txtBFromID.Text;
                _objAGR.placeIDto = txtBToID.Text;
                _objAGR.placeCodeFrom = txtBFromCode.Text;
                _objAGR.placeCodeTo = txtBToCode.Text;
                string d = txtBDateTab.Text;
                System.DateTime dt = System.DateTime.ParseExact(d, "dd MMM yyyy", CultureInfo.InvariantCulture);
                string Date = dt.ToString("dd/MM/yyyy");
                _objAGR.journeyDate = Date;

                xmlUtility listings = new xmlUtility();
                XDocument element = listings.getservice(_objAGR);
                string stringXml = element.ToString();
                var httpClient = new Windows.Web.Http.HttpClient();
                var info = AppStatic.WebServiceAuthentication;
                var token = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(info));
                httpClient.DefaultRequestHeaders.Authorization = new Windows.Web.Http.Headers.HttpCredentialsHeaderValue("Basic", token);
                httpClient.DefaultRequestHeaders.Add("SOAPAction", "");
                Windows.Web.Http.HttpRequestMessage httpRequestMessage = new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Post, _url);
                httpRequestMessage.Headers.UserAgent.TryParseAdd("Mozilla/4.0");
                IHttpContent content = new HttpStringContent(stringXml, Windows.Storage.Streams.UnicodeEncoding.Utf8);
                httpRequestMessage.Content = content;
                Windows.Web.Http.HttpResponseMessage httpResponseMessage = await httpClient.SendRequestAsync(httpRequestMessage);

                string strXmlReturned = await httpResponseMessage.Content.ReadAsStringAsync();
                XmlDocument xDoc = new XmlDocument();

                XDocument loadedData = XDocument.Parse(strXmlReturned);

                XDocument element1 = listings.getAvailableServicelayout(_objAGR);
                string stringXml1 = element1.ToString();


                byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(stringXml1.ToString());
                StorageFile file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("HistoryTest1.xml", CreationCollisionOption.OpenIfExists);
                String historyTestContent = await FileIO.ReadTextAsync(file);
                using (var stream = await file.OpenStreamForWriteAsync())
                {
                    stream.Seek(0, SeekOrigin.End);
                    stream.Write(fileBytes, 0, fileBytes.Length);
                }

                List<XElement> _list = (from t1 in loadedData.Descendants("wsResponse") select t1).ToList();
                List<PlaceList> seatsList = new List<PlaceList>();
                string _msg = "";
                if (_list != null)
                {
                    foreach (XElement _elemet in _list)
                    {
                        PlaceList _obj = new PlaceList();
                        _obj.message = _elemet.Element("message").Value.ToString();
                        seatsList.Add(_obj);
                    }
                    _msg = seatsList.FirstOrDefault().message.ToString();
                }


                if (_msg != "FAILURE")
                {
                    var sdata = loadedData.Descendants("service").
                    Select(x => new GetAvailableService
                    {
                        arrivalDate = x.Element("arrivalDate").Value,
                        arrivalTime = x.Element("arrivalTime").Value,
                        classID = x.Element("classID").Value,
                        classLayoutID = x.Element("classLayoutID").Value,
                        className = x.Element("className").Value,
                        corpCode = x.Element("corpCode").Value,
                        departureTime = x.Element("departureTime").Value,
                        destination = x.Element("destination").Value,
                        fare = x.Element("fare").Value,
                        journeyDate = x.Element("journeyDate").Value,
                        journeyHours = x.Element("journeyHours").Value,
                        maxSeatsAllowed = x.Element("maxSeatsAllowed").Value,
                        origin = x.Element("origin").Value,
                        placeIDFrom = x.Element("biFromPlace").Element("placeID").Value,
                        placeIDto = x.Element("biToPlace").Element("placeID").Value,
                        refundStatus = x.Element("refundStatus").Value,
                        routeNo = x.Element("routeNo").Value,
                        seatsAvailable = x.Element("seatsAvailable").Value,
                        seatStatus = x.Element("seatStatus").Value,
                        serviceID = x.Element("serviceID").Value,
                        startPoint = x.Element("startPoint").Value,
                        studID = x.Element("stuID").Value,
                        tripCode = x.Element("tripCode").Value,
                        viaPlaces = x.Element("viaPlaces").Value
                    });
                    foreach (var item in sdata)
                    {
                        GetAvailableService gas = new GetAvailableService();
                        gas.arrivalDate = item.arrivalDate;
                        gas.arrivalTime = item.arrivalTime;
                        gas.classID = item.classID;
                        gas.classLayoutID = item.classLayoutID;
                        gas.className = item.className;
                        gas.corpCode = item.corpCode;
                        gas.departureTime = item.departureTime;
                        gas.destination = item.destination;
                        gas.fare = item.fare;
                        gas.journeyDate = item.journeyDate;
                        gas.journeyHours = item.journeyHours;
                        gas.maxSeatsAllowed = item.maxSeatsAllowed;
                        gas.origin = item.origin;
                        gas.placeIDFrom = item.placeIDFrom;
                        gas.placeIDto = item.placeIDto;
                        gas.refundStatus = item.refundStatus;
                        gas.routeNo = item.routeNo;
                        gas.seatsAvailable = item.seatsAvailable;
                        gas.seatStatus = item.seatStatus;
                        gas.serviceID = item.serviceID;
                        gas.startPoint = item.startPoint;
                        gas.studID = item.studID;
                        gas.tripCode = item.tripCode;
                        gas.viaPlaces = item.viaPlaces;
                        availableservice.Add(gas);
                    }
                    ListMenuItems.ItemsSource = sdata;

                    string MaxPriceresult = sdata.OrderByDescending(x => x.fare).Select(x => x.fare).FirstOrDefault().ToString();
                    if (MaxPriceresult != null)
                    {
                        txtBMaxPriceCurrent.Text = MaxPriceresult;
                        txtBMaxPrice.Text = MaxPriceresult;
                        maxPrice = Convert.ToInt32(MaxPriceresult);
                        MaxPrice = Convert.ToInt32(MaxPriceresult);
                        Thumb2PositionPrice = Convert.ToInt32(MaxPriceresult);
                    }

                    string MinPriceresult = sdata.OrderBy(x => x.fare).Select(x => x.fare).FirstOrDefault().ToString();
                    if (MinPriceresult != null)
                    {
                        txtBMinPrice.Text = MinPriceresult;
                        txtBMinPriceCurrent.Text = MinPriceresult;
                        minPrice = Convert.ToInt32(MinPriceresult);
                        MinPrice = Convert.ToInt32(MinPriceresult);
                        Thumb1PositionPrice = Convert.ToInt32(MinPriceresult);
                    }
                    ListMenuItemsFilterCorp.ItemsSource = sdata.Select(x => x.corpCode).Distinct().ToList();
                    ListMenuItemsFilterBusType.ItemsSource = sdata.Select(x => x.className).Distinct().ToList();

                    FilterFunVisible();
                }
                else
                {
                    FilterFunCollapsed();

                }
            }
            catch (Exception ex)
            {

                LoaderPop.Visibility = Visibility.Collapsed;
                //gridErrorOccured.Children.Add(_ObjErrorOccured);
                ExceptionLog obj = new ExceptionLog();
                Error objError = new Error();
                objError.ErrorEx = ex.Message;
                obj.CreateLogFile(objError);
            }
        }
Beispiel #28
0
 public async Task LoadAsync(PlaceListArgs args)
 {
     await PlaceList.LoadAsync(args);
 }
Beispiel #29
0
        public void TestLoadISFalse()
        {
            var placelist = new PlaceList();

            Assert.IsFalse(placelist.IsLoaded);
        }
Beispiel #30
0
        public SeeListsView()
        {
            InitializeComponent();

            lugarPrueba1 = new Place
            {
                Id          = 1,
                Name        = "Universidad Nacional de Colombia",
                Description = "Universidad blablablabla",
                Address     = "Carrera 30, Calle 45",
                Latitude    = 5.55,
                Longitude   = 5.55,
                PlaceImage  = "fdsfdsfsdffd",
                Grade       = 5,
                Visits      = 0,
            };
            lugarPrueba2 = new Place
            {
                Id          = 2,
                Name        = "Estadio Nemesio Camacho 'El Campín'",
                Description = "El máximo escenario deportivo de la capital blablablabla",
                Address     = "Carrera 30, Calle 57",
                Latitude    = 5.56,
                Longitude   = 5.56,
                PlaceImage  = "qwsadefgd",
                Grade       = 5,
                Visits      = 3,
            };

            listaPrueba = new List <Place>();
            listaPrueba.Add(lugarPrueba1);
            listaPrueba.Add(lugarPrueba2);

            placeListPrueba1 = new PlaceList()
            {
                Id            = 1,
                Name          = "Lugares en Bogotá",
                OwnerUser     = 1,
                Comment       = "La Candelaria y otros.",
                Places        = listaPrueba,
                EstimatedDate = "Ayer",
                Order         = 1,
                NumberPlaces  = listaPrueba.Count,
            };
            placeListPrueba2 = new PlaceList()
            {
                Id            = 2,
                Name          = "Estadios de Colombia",
                OwnerUser     = 1,
                Comment       = "Estadios del Mundial Sub-20 2011.",
                Places        = listaPrueba,
                EstimatedDate = "Ayer",
                Order         = 1,
                NumberPlaces  = listaPrueba.Count + 5,
            };
            placeListPrueba3 = new PlaceList()
            {
                Id            = 3,
                Name          = "Estadios de Inglaterra",
                OwnerUser     = 1,
                Comment       = "Wembley y otros históricos.",
                Places        = listaPrueba,
                EstimatedDate = "Ayer",
                Order         = 1,
                NumberPlaces  = listaPrueba.Count + 3,
            };
            placeListPrueba4 = new PlaceList()
            {
                Id            = 4,
                Name          = "Playas en Santa Marta",
                OwnerUser     = 1,
                Comment       = "Algunas de las más conocidas.",
                Places        = listaPrueba,
                EstimatedDate = "Ayer",
                Order         = 1,
                NumberPlaces  = listaPrueba.Count + 2,
            };
            placeListPrueba5 = new PlaceList()
            {
                Id            = 5,
                Name          = "Edificios UNAL",
                OwnerUser     = 1,
                Comment       = "Edificios donde tengo clase.",
                Places        = listaPrueba,
                EstimatedDate = "Ayer",
                Order         = 1,
                NumberPlaces  = listaPrueba.Count,
            };

            listPlaceListsPrueba = new List <PlaceList>
            {
                placeListPrueba1,
                placeListPrueba2,
                placeListPrueba3,
                placeListPrueba4,
                placeListPrueba5,
            };

            PlacesList.ItemsSource = listPlaceListsPrueba;
        }
Beispiel #31
0
    void BuildCheckList()
    {
        //分类表
        TypeList  type = new TypeList();
        DataTable Data = type.ReadAll();

        Type_CBL.DataSource     = Data;
        Type_CBL.DataTextField  = "name";
        Type_CBL.DataValueField = "id";
        Type_CBL.DataBind();
        //地点表
        PlaceList site = new PlaceList();

        Data = site.ReadAll();
        Site_CBL.DataSource     = Data;
        Site_CBL.DataTextField  = "name";
        Site_CBL.DataValueField = "id";
        Site_CBL.DataBind();
        //获取cookie
        HttpCookie cookie = HttpContext.Current.Request.Cookies["find"];
        //将cookie转化为字典
        Dictionary <string, string> dict = null;

        if (cookie != null)
        {
            if (cookie.Value != "")
            {
                dict = new Dictionary <string, string>();
                foreach (string key in cookie.Values)
                {
                    dict.Add(key, cookie[key]);
                }
            }
            else
            {
                return;
            }
        }
        //置默认选中
        string[] str;
        foreach (var item in dict)
        {
            switch (item.Key)
            {
            case "type":
                str = item.Value.Split(',');
                foreach (string value in str)
                {
                    foreach (ListItem listItem in Type_CBL.Items)
                    {
                        if (value == listItem.Value)
                        {
                            listItem.Selected = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                break;

            case "condition":
                str = item.Value.Split(',');
                foreach (string value in str)
                {
                    foreach (ListItem listItem in Condition_CBL.Items)
                    {
                        if (value == listItem.Value)
                        {
                            listItem.Selected = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                break;

            case "grade":
                str = item.Value.Split(',');
                foreach (string value in str)
                {
                    foreach (ListItem listItem in Grade_CBL.Items)
                    {
                        if (value == listItem.Value)
                        {
                            listItem.Selected = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                break;

            case "place":
                str = item.Value.Split(',');
                foreach (string value in str)
                {
                    foreach (ListItem listItem in Site_CBL.Items)
                    {
                        if (value == listItem.Value)
                        {
                            listItem.Selected = true;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                break;

            case "seat":
                SeatText.Text = HttpUtility.UrlDecode(item.Value);
                break;

            case "describe":
                DescribeText.Text = HttpUtility.UrlDecode(item.Value);
                break;
            }
        }
    }