Ejemplo n.º 1
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int            res            = new SalonControl().SaveSalonService(Code, Serivces);
         ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("MessageResources");
         string         message        = resourceLoader.GetString("Success");
         MessagePopup   messageopup    = new MessagePopup(message);
         messageopup.Show();
     }
     catch (AppException appex)
     {
         MessagePopup messageopup = new MessagePopup(appex.ToString());
         messageopup.Show();
     }
 }
Ejemplo n.º 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var parameter = e.Parameter;

            Type type = e.Parameter?.GetType();

            if (type != null)
            {
                SalonModel model = (SalonModel)type.GetProperty("SalonModel").GetValue(parameter);
                Code      = model.Code;
                SalonName = model.Name;
                Location  = model.Location.Name;
                Manager   = model.Manager.Name;

                Serivces = new SalonControl().GetAllSalonServiceInfos(Code);
            }
        }
Ejemplo n.º 3
0
        public ObservableCollection <StaffInfoModel> GetAllStaffInfos()
        {
            var models = new ObservableCollection <StaffInfoModel>();

            using (DBConnect connect = new DBFactory().GetPostgreSQLDBConnect().StartConnect())
            {
                var salons    = new SalonControl().GetAllSalonInfos();
                var listStaff = connect.FindAll <DBModels.PostgreSQL.Staff, string>(m => m.Code);
                foreach (var item in listStaff)
                {
                    StaffInfoModel model = new StaffInfoModel();
                    ModelHelper.CopyModel(model, item);
                    model.Salons = salons;
                    model.Salon  = salons.Where(s => s.Code == item.SalonCode).FirstOrDefault();
                    if (!string.IsNullOrEmpty(item.Services))
                    {
                        model.Services = JsonConvert.DeserializeObject <ObservableCollection <ServiceModel> >(item.Services);
                    }
                    if (!string.IsNullOrEmpty(item.ServiceTimes))
                    {
                        model.ServiceTimes = JsonConvert.DeserializeObject <ObservableCollection <StaffServiceTimeModel> >(item.ServiceTimes);
                    }
                    models.Add(model);
                }
            }
            return(models);
            //var Staffs = new ObservableCollection<StaffInfoModel>();
            //DBConnect connect = new DBFactory().GetMongDBConnect();

            //var list = connect.FindAll<DBModels.MongDB.Staff, ObjectId>(m => m.Id);
            //foreach (var staff in list)
            //{
            //    StaffInfoModel staffEdit = new StaffInfoModel();
            //    ModelHelper.CopyModel(staffEdit, staff);
            //    staffEdit.Skills = new ObservableCollection<SkillModel>();
            //    foreach (var skill in staff.Skill)
            //    {
            //        SkillModel skillModel = new SkillModel();
            //        ModelHelper.CopyModel(skillModel, skill);
            //        staffEdit.Skills.Add(skillModel);
            //    }
            //    Staffs.Add(staffEdit);
            //}
            //return Staffs;
        }
 public StaffBookTimeEditViewModel()
 {
     try
     {
         Salons = new SalonControl().GetAllSalonInfos();
         if (Salons.Count > 0)
         {
             Salon      = Salons[0];
             StaffInfos = new StaffControl().GetStaffInfosBySalon(Salon.Code);
             if (StaffInfos.Count > 0)
             {
                 StaffInfo = StaffInfos[0];
                 BookTimes = new StaffBookTimeControl().GetBookTimesByStaff(StaffInfo.Code);
             }
         }
     }
     catch (Exception ex)
     {
         AppLog.Error(typeof(StaffServiceTimeEditViewModel), ex.ToString());
     }
 }