Example #1
0
        public Servis(DB.Service service)
        {
            Name = service.Title;

            if (service.Discount > 0)
            {
                RealPrice = Convert.ToDouble(service.Cost).ToString();
            }
            else
            {
                RealPrice = null;
            }


            PriceEndTime = GetRealPrice(service.Discount.Value, service.Cost, service.DurationInSeconds);

            Discont = GetDisconte(service.Discount);

            if (!string.IsNullOrWhiteSpace(service.MainImagePath))
            {
                FilePath = @"pack://application:,,,/" + service.MainImagePath.TrimStart();
            }

            buttinRemove = "Visible";
            ButtonChange = "Visible";
        }
Example #2
0
        public ChangeEndAddServis()
        {
            InitializeComponent();
            var s = new DB.Service();

            s.MainImagePath = s + @"Услуги салона красоты\No.jpg.bmp";
            gr.DataContext  = s;
        }
Example #3
0
        public ChangeEndAddServis(Model.Servis servis)
        {
            InitializeComponent();

            contoller             = new Model.ServisesContoller(servis);
            Service               = contoller.ServiceOne;
            Service.MainImagePath = s + Service.MainImagePath;
            gr.DataContext        = Service;
        }
Example #4
0
 public ServisController(BL.ModelView.ServisView view)
 {
     try
     {
         entities = new DB.DETLT2020Entities();
         Service  = entities.Services.Where(x => x.Title == view.Title).First();;
     }
     catch
     {
         throw new Exception("Ошибка БД");
     }
 }
        public AddEndCangeServis(BL.ModelView.ServisView view)
        {
            InitializeComponent();

            try
            {
                var cn = new BL.ServisController(view);
                service = cn.Service;
                mainGrid.DataContext = service;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Example #6
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (Service == null)
            {
                Service   = gr.DataContext as DB.Service;
                contoller = new Model.ServisesContoller(Service);
            }
            else
            {
                Service = gr.DataContext as DB.Service;
                Service.MainImagePath = Service.MainImagePath.Substring(s.Length);
                contoller.ServiceOne  = Service;
                contoller.Save();
            }

            this.DialogResult = true;
            this.Close();
        }
 private void tbSave_Click(object sender, RoutedEventArgs e)
 {
     service = mainGrid.DataContext as DB.Service;
     if (service != null)
     {
         try
         {
             var s = new BL.ServisController(service);
             s.AddServis();
             MessageBox.Show("Сохранение  прошло  успешно ");
             this.DialogResult = true;
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error");
         }
     }
 }
Example #8
0
        public ServisView(DB.Service service)
        {
            Title             = service.Title;
            RealCost          = GetRealcost(service);
            DiscountCost      = GetDiscountCost(service);
            DurationInSeconds = GetDurationInSeconds(service);
            Discount          = GetDiscount(service);
            MainImagePath     = service.MainImagePath;

            CostSort = GetCostSort(service);

            if (service.Discount != null && service.Discount > 0)
            {
                DiscountSort = service.Discount.Value;
            }
            else
            {
                DiscountSort = 0;
            }


            btChange = "Collapsed";
            btDell   = "Collapsed";
        }
Example #9
0
 public ServisController(DB.Service service)
 {
     entities = new DB.DETLT2020Entities();
     Service  = service;
 }
Example #10
0
 /// <summary>
 /// Добавляет  в бд
 /// </summary>
 /// <param name="service"></param>
 public ServisesContoller(DB.Service service)
 {
     entities.Service.Add(service);
     Save();
 }
Example #11
0
 /// <summary>
 /// загрузка одного  сервиса
 /// </summary>
 /// <param name="servis"></param>
 public ServisesContoller(Model.Servis servis)
 {
     ServiceOne = entities.Service.FirstOrDefault(x => x.Title == servis.Name);
 }