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"; }
public ChangeEndAddServis() { InitializeComponent(); var s = new DB.Service(); s.MainImagePath = s + @"Услуги салона красоты\No.jpg.bmp"; gr.DataContext = s; }
public ChangeEndAddServis(Model.Servis servis) { InitializeComponent(); contoller = new Model.ServisesContoller(servis); Service = contoller.ServiceOne; Service.MainImagePath = s + Service.MainImagePath; gr.DataContext = Service; }
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"); } }
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"); } } }
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"; }
public ServisController(DB.Service service) { entities = new DB.DETLT2020Entities(); Service = service; }
/// <summary> /// Добавляет в бд /// </summary> /// <param name="service"></param> public ServisesContoller(DB.Service service) { entities.Service.Add(service); Save(); }
/// <summary> /// загрузка одного сервиса /// </summary> /// <param name="servis"></param> public ServisesContoller(Model.Servis servis) { ServiceOne = entities.Service.FirstOrDefault(x => x.Title == servis.Name); }