コード例 #1
0
        protected void OnPropertyChanged(string prop)
        {
            if (prop == "Id")
            {
                HoursWeekly = Fun.GetCleanerHours(Id, DateTime.Now);
            }
            if (PropertyChanged != null)
            {
                try
                {
                    using (var db = new PodaciContext())
                    {
                        db.Update(this);
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Cleaner Update Error: " + ex.Message);
                }


                PropertyChanged(this, new PropertyChangedEventArgs(prop));
            }
        }
コード例 #2
0
        protected void OnPropertyChanged(string prop)
        {
            if (PropertyChanged != null)
            {
                try
                {
                    using (var db = new PodaciContext())
                    {
                        db.Update(this);
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Team Update Error: " + ex.Message);
                }


                PropertyChanged(this, new PropertyChangedEventArgs(prop));
            }
        }
コード例 #3
0
        protected void OnPropertyChanged(string prop)
        {
            if (prop == "Date" && Date != null)
            {
                Week = Fun.getWeek(Date);
                Day  = Fun.getDay(Date);
            }



            if (prop == "ClientId")
            {
                setLocations(_ClientId);
            }



            if (PropertyChanged != null)
            {
                if (prop == "Date" && Date != null)
                {
                    RepeatJob   = null;
                    RepeatJobId = null;
                }
                else if (prop != "Locations")
                {
                    if (RepeatJobId != null && RepeatJob != null)
                    {
                        if (!changed)
                        {
                            changed = true;
                        }
                    }
                }

                if (prop == "TimeStart" && TimeStart != null)
                {
                    if (TimeEnd != null)
                    {
                        NoOfHours = ConvertTime();
                    }
                }
                else if (prop == "TimeEnd" && TimeEnd != null)
                {
                    if (TimeStart != null)
                    {
                        NoOfHours = ConvertTime();
                    }
                }


                if (prop == "TeamId" && TeamId != null)
                {
                    CleanerId = null;
                    Cleaner   = null;
                }
                else if (prop == "CleanerId" && CleanerId != null)
                {
                    TeamId = null;
                    Team   = null;
                }

                if (CleanerId == 0)
                {
                    CleanerId = null;
                    Cleaner   = null;
                }
                if (TeamId == 0)
                {
                    TeamId = null;
                    Team   = null;
                }
                if (ServiceId == 0)
                {
                    ServiceId = null;
                    Service   = null;
                }

                if (prop == "TimeEnd" || prop == "TimeStart" || prop == "ServiceId")
                {
                    ConvertAmount();
                }

                try
                {
                    using (var db = new PodaciContext())
                    {
                        db.Update(this);
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("CleaningJob Update Error: " + ex.Message);
                }


                PropertyChanged(this, new PropertyChangedEventArgs(prop));
            }
        }