Пример #1
0
 public JobDetailPage()
 {
     InitializeComponent();
     detailJob= (App.Current as App).CurrentJob;
      btn0=  (ApplicationBarIconButton)ApplicationBar.Buttons[0];
      btn2=  (ApplicationBarIconButton)ApplicationBar.Buttons[2];
     btn2.Text = detailJob.CollectBtnText;
     btn0.IsEnabled = detailJob.IsPathAvailable;
     if (string.IsNullOrEmpty(detailJob.OfficalWeibo))
     {
         tb_relativeWeiboEmpty.Visibility = Visibility.Visible;
         relativeWeiboListBox.Visibility = Visibility.Collapsed;
     }
 }
Пример #2
0
 public Job_Share()
 {
     InitializeComponent();
     job = (App.Current as App).CurrentJob;
     List<ShareItem> ShareItemList = new List<ShareItem>();
     ShareItemList.Add(new ShareItem("短信分享", ""));
     ShareItemList.Add(new ShareItem("邮件分享", ""));
     ShareItemList.Add(new ShareItem("微博分享", ""));
     ShareListBox.ItemsSource = ShareItemList;
     shareText=job.CompanyName+Environment.NewLine+job.University+Environment.NewLine
         +job.AddressDetail+Environment.NewLine
         +job.StartTime+Environment.NewLine+"来自:校园招聘(http://www.ybole.com/xyzp)";
     weiShareText = job.CompanyName + "  "+ job.University + " "
         + job.AddressDetail + " "
         + job.StartTime + " " + "来自:校园招聘(http://www.ybole.com/xyzp)";
 }
Пример #3
0
 public void Add(DetailJob job)
 {
     FavouriteTable favourtie = new FavouriteTable()
     {
         Job_ID = job.JobId,
         //Job_AddressCity = job.Address.City,
         Job_AddressDetail = job.AddressDetail,
         //Job_CompanyId = job.CompanyId,
         Job_CompanyName = job.CompanyName,
         Job_Url = job.Url,
         Job_StartTime = job.StartTime,
         Fav_Remarks=job.NoteText,
         Fav_Status = "宣讲会",
         Job_IsRemind = false,
         Job_University = job.University,
         Job_OfficalWeibo=job.OfficalWeibo
         //Job_ID = job.Job_ID,
         //Job_AddressCity = job.Job_AddressCity,
         //Job_AddressDetail = job.Job_AddressDetail,
         //Job_AddressLatitude = job.Job_AddressLatitude,
         //Job_AddressLongitude = job.Job_AddressLongitude,
         //Job_CompanyId = job.Job_CompanyId,
         //Job_CompanyName = job.Job_CompanyName,
         //Job_Url = job.Job_Url,
         //Job_StartTime = job.Job_StartTime,
         //Job_University = job.Job_University,
         //Job_CompanyWeiboid = job.Job_CompanyWeiboid,
         //Fav_Remarks = "",
         //Fav_Status = "宣讲会",
         //Job_Detail = job.Job_Detail,
         //Job_IsRemind = false
     };
     if (favourtie.Fav_Remarks == null) favourtie.Fav_Remarks = "";
     if (job.Latitude != null&&job.Longitude!=null)
     {
         favourtie.Job_AddressLatitude = job.Latitude;
         favourtie.Job_AddressLongitude = job.Longitude;
     }
     db.favouriteTable.InsertOnSubmit(favourtie);
     db.SubmitChanges();
 }
Пример #4
0
 public void Delete(DetailJob job)
 {
     db.favouriteTable.DeleteOnSubmit(db.favouriteTable.SingleOrDefault(c => c.Job_ID.Equals(job.JobId)));
     db.SubmitChanges();
 }
Пример #5
0
 private void NavigatedJobDetail(CollectJob job)
 {
     if (job == null) return;
     DetailJob detailJob = new DetailJob()
     {
         AddressDetail = job.AddressDetail,
         CompanyName = job.CompanyName,
         IsCollected = true,
         JobId = job.JobId,
         StartTime = job.StartTime,
         University = job.University,
         Latitude=job.Latitude,
         Longitude=job.Longitude,
         Url=job.Url,
         Status=job.Status,
         NoteText=job.NoteText,
         OfficalWeibo=job.OfficalWeibo
     };
     if (!double.IsNaN(job.Latitude)) detailJob.IsPathAvailable = true;
     else
         detailJob.IsPathAvailable = false;
     (App.Current as App).CurrentJob = detailJob;
     Messenger.Default.Send<string>(@"/View/JobDetailPage.xaml?jobId=" + job.JobId, "Navigate");
 }
Пример #6
0
        private void NavigatedJobDetail(Job job)
        {
            if (job == null) return;
            foreach (CollectJob collectJob in CollectJobList)
            {
                if (collectJob.JobId.Equals(job.Id))
                {
                    NavigatedJobDetail(collectJob);
                    return;
                }
            }
            DetailJob detailJob = new DetailJob()
            {
                AddressDetail = job.Address.Detail,
                CompanyName=job.Company.Name,
                IsCollected=false,
                JobId=job.Id,
                StartTime=job.StartTime,
                University=job.Address.University,
                Url=job.Url,
                Status="宣讲会",
                OfficalWeibo=job.Company.OfficialWeibo,
                NoteText=""
            };
            if (job.Address.Accurate != null)
            {
                detailJob.Longitude = job.Address.Accurate.Longitude;
                detailJob.Latitude = job.Address.Accurate.Latitude;
                detailJob.IsPathAvailable = true;
            }
            else
            {
                detailJob.IsPathAvailable = false;
            }

            (App.Current as App).CurrentJob = detailJob;
            Messenger.Default.Send<string>(@"/View/JobDetailPage.xaml?jobId=" + job.Id, "Navigate");
        }
Пример #7
0
        public JobDetailViewModel()
        {
            currentJob = (App.Current as App).CurrentJob;
            ObservableCollection<StatusTile> statusList = IsolateFile.Get<ObservableCollection<StatusTile>>("statusList.xml");
            RelativeWeiboList = new ObservableCollection<RelativeWeibo>();

            if (statusList != null)
            {
                StatusList = statusList;
            }
            else
            {
                StatusList = new ObservableCollection<StatusTile>();
                StatusList.Add(new StatusTile("宣讲会", "#e5927d"));
                StatusList.Add(new StatusTile("网申", "#e5927d"));
                StatusList.Add(new StatusTile("笔试", "#e97c65"));
                StatusList.Add(new StatusTile("一面", "#5db5e6"));
                StatusList.Add(new StatusTile("二面", "#5db5e6"));
                StatusList.Add(new StatusTile("三面", "#5db5e6"));
                StatusList.Add(new StatusTile("拿Offer", "#77c47f"));
                StatusList.Add(new StatusTile("添加", "#77c47f"));
                IsolateFile.Set<ObservableCollection<StatusTile>>("statusList.xml", StatusList);
            }
            ObservableCollection<StatusTile> stList = IsolateFile.Get<ObservableCollection<StatusTile>>("statusList.xml");
            Messenger.Default.Register<string>(this, "SendJobToDetail",
              (empty) =>
              {
                  DetailJob job = (App.Current as App).CurrentJob;
                      Status = job.Status;
                      University = job.University;
                      Address =job.AddressDetail;
                      StartTime = job.StartTime;
                      CompanyName = job.CompanyName;
                      NoteText = job.NoteText;
                      //if (date == null && time=!= null)
                      {
                          Date = DateTime.Parse(StartTime).ToLongDateString();
                          Time = DateTime.Parse(StartTime).ToLongTimeString();
                      }
                     // Debug.WriteLine(CompanyName + "     " + Address);
                      JobDal.Instance.GetJobDetail(job.JobId,(html)=>
                          {
                              Detail=html;
                              if (!string.IsNullOrEmpty(html))
                              {
                                  Messenger.Default.Send<string>(Detail, "job_detail");
                              }
                              else
                                  Messenger.Default.Send<string>(job.Url, "job_detail");
                          });

              }
              );
            ChangeStatusCommand = new RelayCommand(() =>
            {
                Messenger.Default.Send<string>("", "changeStatus");
            });
            Messenger.Default.Register<string>(this, "RelativeWeiboListBoxRefresh",
              empty =>
              {
                  if (!string.IsNullOrEmpty(currentJob.OfficalWeibo))
                      WeiboDal.Instance.GetRelativeWeiboList(20,1, currentJob.OfficalWeibo, GetRelativeWeiboListEnd);

              }
              );

            Messenger.Default.Register<string>(this, "RelativeWeiboListBoxLoad",
             empty =>
             {
                 if (!string.IsNullOrEmpty(currentJob.OfficalWeibo))
                     WeiboDal.Instance.GetRelativeWeiboList(20, ++currentPage, currentJob.OfficalWeibo, GetRelativeWeiboListEnd);

             }
             );
            Messenger.Default.Register<string>(this, "CollectJob",
             jobId =>
             {
                 if (jobId != null)
                 {
                     // JobTable job = JobDal.Instance.GetJobById(jobId);
                     DetailJob job = (App.Current as App).CurrentJob;
                     CollectJobDal.Instance.Add(job);

                     Messenger.Default.Send<string>(job.JobId, "collectJobCompleted");
                 }
             }
             );
            Messenger.Default.Register<string>(this, "AddJobStatusCompleted",
              statusName =>
              {
                  StatusList.RemoveAt(statusList.Count - 1);
                  StatusList.Add(new StatusTile(statusName, "#5db5e6"));
                  StatusList.Add(new StatusTile("添加", "#77c47f"));
                  //int count = 0;
                  //if (Isolated.Get("StatusCount") != null) count = (int)Isolated.Get("StatusCount");
                  //Isolated.Set("StatusCount", count  + 1);
                  //Isolated.Set(count + "", statusName);
                  IsolateFile.Set<ObservableCollection<StatusTile>>("statusList.xml", StatusList);
                  Messenger.Default.Send<string>(statusName, "ChangeStatusCompleted");
              }
              );
            Messenger.Default.Register<string>(this, "UnCollectJob",
             jobId =>
             {
                 if (jobId != null)
                 {
                     // JobTable job = JobDal.Instance.GetJobById(jobId);
                     DetailJob job = (App.Current as App).CurrentJob;
                     CollectJobDal.Instance.Delete(job);
                     Messenger.Default.Send<string>(job.JobId, "UnCollectJobCompleted");
                 }
             }
             );
            Messenger.Default.Register<bool>(this, "UpdateCollectJobData",
              isCollected =>
              {
                  DetailJob job = (App.Current as App).CurrentJob;

                  if (isCollected && isValueChange)
                  {
                      isValueChange = false;
                      //(App.Current as App).isCurrentJobChange = false;
                      job.NoteText = NoteText;
                      job.Status = Status;
                      job.AddressDetail = Address;
                      job.University = University;
                      job.StartTime = Date.Substring(Date.IndexOf("年")+1)+ Time;
                      job.Date = Date;
                      job.Time = Time;
                      CollectJobDal.Instance.Update(job.JobId, Status, job.University,job.AddressDetail,job.StartTime,NoteText);

                      Messenger.Default.Send<string>("", "UpdateCollectJobList");
                  }
                  address = null;
                  status = null;
                  noteText = null;
                  date = null;
                  time = null;
                  university = null;
              }
              );
            StatusChangeCompletedCommand = new RelayCommand<StatusTile>((item) =>
                {
                    if (item == null) return;

                    Messenger.Default.Send<string>(item.Name, "ChangeStatusCompleted");
                    if (!item.Name.Equals("添加"))  Status = item.Name;
                    else
                    {
                        Messenger.Default.Send<string>("", "AddJobStatus");
                    }
                });

            if (!string.IsNullOrEmpty(currentJob.OfficalWeibo))
                WeiboDal.Instance.GetRelativeWeiboList(20, 1, currentJob.OfficalWeibo, GetRelativeWeiboListEnd);
        }