示例#1
0
        private void dgBills_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // Je potřeba na základě DB dočasně vytvořit XML účtenku
            CreateXmlBillFromDatabaseSource(((BillRecord)dgBills.SelectedItem).FileName);

            BillRecord record = (BillRecord)dgBills.SelectedItem;
            BillWindow billW  = new BillWindow(record.FileName + ".xml", true);

            billW.Owner = Window.GetWindow(this);
            billW.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            billW.Show();
        }
        private void Calculate(object obj)
        {
            List <string> Checkedlines = new List <string>();

            foreach (var item in cbObjects)
            {
                if (item.IsSelected)
                {
                    Checkedlines.Add(item.ObjectData.Number);
                }
            }
            YearAndMonth     selectedDate               = new YearAndMonth(SelectedYear, SelectedMonth);
            BillRequestModel billRequestModel           = new BillRequestModel(currentClient.ID, Checkedlines, selectedDate);
            Tuple <object, HttpStatusCode> returnTuple1 = httpClient.PostRequest(ApiConfigs.CheckIfLineExistedRoute, billRequestModel);

            if (returnTuple1.Item2 == HttpStatusCode.OK)
            {
                if ((bool)returnTuple1.Item1)
                {
                    Tuple <object, HttpStatusCode> returnTuple = httpClient.PostRequest(ApiConfigs.GetSpecficLinesBillRoute, billRequestModel);
                    if (returnTuple.Item2 == HttpStatusCode.OK)
                    {
                        JObject jObject = new JObject();
                        jObject = (JObject)returnTuple.Item1;
                        ClientBill clientBill = jObject.ToObject <ClientBill>();
                        BillWindow billWindow = new BillWindow(clientBill, selectedDate);
                        billWindow.Show();
                        CloseThisWindow();
                    }
                }
                else
                {
                    logger.Print("One or more of the selected lines didnt exist in the selected date");
                }
            }
            else
            {
                logger.Print(returnTuple1.Item2.ToString());
            }
        }
 private void BtnAdd_Click(object sender, RoutedEventArgs e)
 {
     if (dgFurniture.Visibility.Equals(Visibility.Visible))
     {
         var newFurniture = new Furniture();
         var fw           = new FurnitureWindow(newFurniture, FurnitureWindow.Operation.ADD);
         fw.Show();
     }
     else if (dgFurnitureType.Visibility.Equals(Visibility.Visible))
     {
         var newFurnitureType = new FurnitureType();
         var ftw = new FurnitureTypeWindow(newFurnitureType, FurnitureTypeWindow.Operation.ADD);
         ftw.Show();
     }
     else if (dgSales.Visibility.Equals(Visibility.Visible))
     {
         var newSale = new Sale();
         var sw      = new SaleWindow(newSale, SaleWindow.Operation.ADD);
         sw.Show();
     }
     else if (dgUsers.Visibility.Equals(Visibility.Visible))
     {
         var newUser = new User();
         var uw      = new UserWindow(newUser, UserWindow.Operation.ADD);
         uw.Show();
     }
     else if (dgAdditionalService.Visibility.Equals(Visibility.Visible))
     {
         var newAdditionalService = new AdditionalService();
         var asw = new AdditionalServiceWindow(newAdditionalService, AdditionalServiceWindow.Operation.ADD);
         asw.Show();
     }
     else if (dgAdditionalService.Visibility.Equals(Visibility.Visible))
     {
         var        newBill = new Bill();
         BillWindow bw      = new BillWindow();
         bw.Show();
     }
 }
        private void Bill_Click(object sender, RoutedEventArgs e)
        {
            BillWindow bw = new BillWindow();

            bw.Show();
        }