Exemplo n.º 1
0
        private void BtnContinue_Click(object sender, EventArgs e)
        {
            for (var i = 0; i < book.Words.Count; i++) // Compose print list
            {
                if (ListBox.GetItemChecked(i))
                {
                    printList.Add(book.Words[i]);
                }
            }

            var dialog = new PrintDialog
            {
                AllowCurrentPage = false,
                AllowSomePages   = false,
                UseEXDialog      = true
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                invertSides = RbAskForMotherTongue.Checked;

                PrintList.PrinterSettings = dialog.PrinterSettings;
                PrintList.DocumentName    = book.Name ?? Words.Vocup;
                PrintList.Print();
            }

            dialog.Dispose();
        }
Exemplo n.º 2
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            Photos      = (PhotoList)(this.Resources["Photos"] as ObjectDataProvider).Data;
            Photos.Path = "...\\...\\Resources";

            PhotoTray = (PrintList)(this.Resources["PhotoTray"] as ObjectDataProvider).Data;
        }
        private void Button_Click_2(object sender, RoutedEventArgs e)   // Кнопка "Добавить товар"
        {
            try
            {
                int i_id    = Convert.ToInt32(item_id.Text); // Считываем id товара и его количество
                int i_count = Convert.ToInt32(item_count.Text);

                if (i_id > 0 && i_count > 0) // Если поля заполнены корректно
                {
                    using (ADOmodel db = new ADOmodel(conString))
                    {
                        bool ItemExist = db.Items.Any(i => i.id_Item == i_id);  // Если товар существует
                        if (ItemExist)
                        {
                            discount = db.Loyality_card.Where(lc => lc.id_Loyality_card == client.id_Loyality_card).Select(lc => lc.Loyality_discount).FirstOrDefault(); // Считываем скидку

                            Item_list new_item = new Item_list()
                            {
                                id_Order = or_id, id_Item = i_id, Quantity = i_count
                            };                                                                                                          // Создаем новый товар
                            new_order_list.Add(new_item);                                                                               // И заносим его в список для БД

                            string    i_name  = db.Items.Where(i => i.id_Item == i_id).Select(i => i.Name).FirstOrDefault().ToString(); // Запоминаем имя товара
                            int       i_price = (int)db.Items.Where(i => i.id_Item == i_id).Select(i => i.Price).FirstOrDefault();      // И его стоимость
                            PrintList pr_item = new PrintList()
                            {
                                id = i_id, ItemName = i_name, Quantity = i_count, CostTotal = i_price * i_count, CostOne = i_price
                            };                                                                                                                                          // Заносим данные в список для вывода
                            list_for_print.Add(pr_item);

                            total_cost      += pr_item.CostTotal; // Расчет стоимости
                            costWithDiscount = total_cost - (total_cost / 100 * discount);

                            order_cost.Content         = total_cost + " руб."; // Вывод стоимости
                            order_discountCost.Content = costWithDiscount + " руб.";
                        }
                        else
                        {
                            MessageBox.Show("Товар не найден!", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Корректно заполните поля 'id Товара' и 'Кол-во'!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Корректно заполните поля 'id Товара' и 'Кол-во'!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemplo n.º 4
0
        private void WindowLoaded(object sender, EventArgs e)
        {
            var layer = AdornerLayer.GetAdornerLayer(CurrentPhoto);
            _cropSelector = new RubberbandAdorner(CurrentPhoto) {Window = this};
            layer.Add(_cropSelector);
#if VISUALCHILD
            CropSelector.Rubberband.Visibility = Visibility.Hidden;
#endif
#if NoVISUALCHILD
            CropSelector.ShowRect = false;
#endif

            Photos = (PhotoList) (Application.Current.Resources["Photos"] as ObjectDataProvider)?.Data;
            Photos.Path = "..\\..\\Photos";
            ShoppingCart = (PrintList) (Application.Current.Resources["ShoppingCart"] as ObjectDataProvider)?.Data;
        }
Exemplo n.º 5
0
        private static string PrintCollectionById(Rom rom, int id, PrintList PrintListFunction)
        {
            Scene scene;
            List <FileAddress> roomAddresses;
            Room          room;
            int           sceneId;
            int           roomId;
            StringBuilder result;
            int           count = 0;

            result = new StringBuilder();
            result.AppendLine("Scene,Setup,Room");
            for (sceneId = 0; sceneId < rom.Scenes; sceneId++)
            {
                //set room negative to denote scene level actors
                roomId = -1;

                //load scene
                var sceneFile = rom.Files.GetSceneFile(sceneId);

                scene = InitializeScene(sceneId, sceneFile);
                if (scene == null)
                {
                    continue;
                }

                //scene level actors
                count += PrintListFunction(id, scene.Header, sceneId, roomId, result);

                //load room list
                roomAddresses = scene.Header.GetRoomAddresses();

                for (roomId = 0; roomId < roomAddresses.Count; roomId++)
                {
                    try
                    {
                        room   = InitializeRoom(rom.Files.GetFile(roomAddresses[roomId]));
                        count += PrintListFunction(id, room.Header, sceneId, roomId, result);
                    }
                    catch { }
                }
            }
            result.AppendLine("Total: " + count.ToString());
            return(result.ToString());
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Session["lblStatusSelected"] = 1;
     Session["lblDateSelectedTo"] = null;
     Session["lblDateSelected"]   = null;
     Session["SortDefault"]       = true;
     Session["IsFirstTime"]       = null;
     Session["SelectedRange"]     = "all";
     if (!IsPostBack)
     {
         Miami.Substitute.Dal.User user = new Miami.Substitute.Dal.User();
         DataView dv = user.LoadForMain(Micajah.Common.Security.UserContext.Current.UserId);
         lblLocationSelected.Text  = dv[0]["LocationId"].ToString();
         DefaultLocationLabel.Text = "Location: <b>" + dv[0]["LocationName"] + "</b>&nbsp;&nbsp;Region: <b>" + dv[0]["RegionName"] + "</b>";
         PrintList.DataBind();
         SetNoRecords();
     }
 }
        private void WindowLoaded(object sender, EventArgs e)
        {
            var layer = AdornerLayer.GetAdornerLayer(CurrentPhoto);

            _cropSelector = new RubberbandAdorner(CurrentPhoto)
            {
                Window = this
            };
            layer.Add(_cropSelector);
#if VISUALCHILD
            CropSelector.Rubberband.Visibility = Visibility.Hidden;
#endif
#if NoVISUALCHILD
            CropSelector.ShowRect = false;
#endif

            Photos = (PhotoList)(this.Resources["Photos"] as ObjectDataProvider)?.Data;
            Photos.Init(PhotosFolder.Current);
            ShoppingCart = (PrintList)(this.Resources["ShoppingCart"] as ObjectDataProvider)?.Data;
        }
Exemplo n.º 8
0
        private void WindowLoaded(object sender, EventArgs e)
        {
            if (ExecutionMode.IsRunningWithIdentity())
            {
                this.Title = "PhotoStore";
                this.TitleSpan.Foreground = Brushes.Blue;
            }
            else
            {
                this.Title = "Desktop App";
                this.TitleSpan.Foreground = Brushes.Navy;
            }

            var layer = AdornerLayer.GetAdornerLayer(CurrentPhoto);

            _cropSelector = new RubberbandAdorner(CurrentPhoto)
            {
                Window = this
            };
            layer.Add(_cropSelector);
#if VISUALCHILD
            CropSelector.Rubberband.Visibility = Visibility.Hidden;
#endif
#if NoVISUALCHILD
            CropSelector.ShowRect = false;
#endif

            Photos = (PhotoList)(this.Resources["Photos"] as ObjectDataProvider)?.Data;
            Photos.Init(PhotosFolder.Current);
            ShoppingCart = (PrintList)(this.Resources["ShoppingCart"] as ObjectDataProvider)?.Data;

            // listen for files being created via Share UX
            FileSystemWatcher watcher = new FileSystemWatcher(PhotosFolder.Current);
            watcher.EnableRaisingEvents = true;
            watcher.Created            += Watcher_Created;
        }
Exemplo n.º 9
0
 public Statement_Print(PrintList _printList)
 {
     printList = _printList;
 }
Exemplo n.º 10
0
        private void WindowLoaded(object sender, EventArgs e)
        {
            //Please refer to the following blogpost to learn how you can use the method "IsRunningAsUWP" to detect whether or not you are running as a packged app or not:
            //https://blogs.msdn.microsoft.com/appconsult/2016/11/03/desktop-bridge-identify-the-applications-context/
            if (ExecutionMode.IsRunningAsUwp())
            {
                this.Title = "Desktop Bridge App: PhotoStore --- (Windows App Package)";
                this.TitleSpan.Foreground = Brushes.Blue;

                //Detect if the previous version of the Desktop App is installed
                //The location of the uninstaller in the registry depends on the app's architecture and installer technology. This is different for every app.
                String uninstallString = (String)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{7AD02FB8-B85E-44BC-8998-F4803BA5A0E3}\", "UninstallString", null);

                //Detect if there is previous user data
                //In this example, the previous user data lives under the "unpackaged" local app data location
                String sourceDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\PreviousPhotoStore";

                bool isDataToMigrate = false;

                if (Directory.Exists(sourceDir))
                {
                    var list = Directory.EnumerateFiles(sourceDir);
                    if (list.Count() == 0)
                    {
                        isDataToMigrate = false;
                    }
                    else
                    {
                        isDataToMigrate = true;
                    }
                }

                //Prepare the message for the dialog box to be shown to the user, depending on whether any of the following actions are requried: data migration, uninstallation, or both
                String userMessage = "";
                if (isDataToMigrate && uninstallString != null)
                {
                    userMessage = "We need to migrate your old data and uninstall the previous version of this app. Would you like to go ahead right now?";
                }
                else if (isDataToMigrate && uninstallString == null)
                {
                    userMessage = "We need to migrate your old data. Would you like to go ahead right now?";
                }
                else if (!isDataToMigrate && uninstallString != null)
                {
                    userMessage = "We need to uninstall the previous version of this app. Would you like to go ahead right now?";
                }

                if (isDataToMigrate || uninstallString != null)
                {
                    MessageBoxResult messageResult = MessageBox.Show(userMessage, "Migration in progress...", MessageBoxButton.YesNo);

                    if (messageResult.Equals(MessageBoxResult.Yes))
                    {
                        //Migrate user data (if required)
                        if (Directory.Exists(sourceDir))
                        {
                            //Obtain the path (String) to the "packaged" location, where the previous data will be migrated TO.
                            String destinationDir = Windows.Storage.ApplicationData.Current.LocalFolder.Path;

                            //If you are moving data from one of the redirected folders, you need to use robocopy.exe to bypass redirection. This is the only time you should bypass redirection
                            //Redirected folders: https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-behind-the-scenes
                            //Robocopy.exe: https://technet.microsoft.com/en-us/library/cc733145(v=ws.11
                            //Otherwise, you should move files using System.IO
                            //Note: The "/move" flag is used to copy data over AND delete previous data in one operation
                            if (RunProcess("robocopy.exe", sourceDir + " " + destinationDir + " /move") > 1)
                            {
                                //Migration was unsuccessful -- App Developer can choose to block/retry/other action
                            }
                        }

                        //Uninstall previous version
                        if (uninstallString != null)
                        {
                            //In this case, the uninstaller takes additional arguments.
                            //Since the uninstallString is app-specific, make sure your call to the uninstaller is properly formatted before calling create process
                            string[] uninstallArgs = uninstallString.Split(' ');
                            if (RunProcess(uninstallArgs[0], uninstallArgs[1]) != 0)
                            {
                                //Uninstallation was unsuccessful - App Developer can choose to block the app here
                            }
                        }
                    }
                }
            }
            else
            {
                this.Title = "Desktop App";
                this.TitleSpan.Foreground = Brushes.Navy;
            }

            var layer = AdornerLayer.GetAdornerLayer(CurrentPhoto);

            _cropSelector = new RubberbandAdorner(CurrentPhoto)
            {
                Window = this
            };
            layer.Add(_cropSelector);
#if VISUALCHILD
            CropSelector.Rubberband.Visibility = Visibility.Hidden;
#endif
#if NoVISUALCHILD
            CropSelector.ShowRect = false;
#endif

            Photos = (PhotoList)(this.Resources["Photos"] as ObjectDataProvider)?.Data;
            Photos.Init(PhotosFolder.Current);
            ShoppingCart = (PrintList)(this.Resources["ShoppingCart"] as ObjectDataProvider)?.Data;
        }
Exemplo n.º 11
0
        public ActionResult PrintService(int?id)
        {
            if (id == null || id == 0)
            {
                return(RedirectToAction("List"));
            }
            var model  = new PrintListViewModel();
            var prosip = _proformaSiparisORM.GetList("select * from PROFORMA_SIPARISLER where pro_RECno='" + id + "'").FirstOrDefault();

            if (prosip != null)
            {
                model.MusteriAd  = _carihesaplarORM.GetList("select * from CARI_HESAPLAR where cari_kod='" + prosip.pro_mustkodu + "'").FirstOrDefault().cari_unvan1;
                model.MusteriKod = prosip.pro_mustkodu;
                var adres = _carihesapadresleriORM.GetList("select * from CARI_HESAP_ADRESLERI where adr_cari_kod='" + prosip.pro_mustkodu + "'").FirstOrDefault();
                if (adres != null)
                {
                    model.Adres = adres.adr_cadde;
                    model.il    = adres.adr_il;
                    model.ilce  = adres.adr_ilce;
                }
                string[] parcali = prosip.pro_aciklama2.Split('=');

                if (parcali.Length == 2)
                {
                    model.Saat       = parcali[0].ToString();//prosip.pro_aciklama2;
                    model.BasBitSaat = parcali[1].ToString();
                }
                else
                {
                    model.Saat = parcali[0].ToString();
                }



                model.Tarih   = prosip.pro_tarihi;
                model.EvrakNo = prosip.pro_evrakno_seri + " " + prosip.pro_evrakno_sira.ToString();
                List <PrintList> list = new List <PrintList>();

                var siparisler = _proformaSiparisORM.GetList("select * from PROFORMA_SIPARISLER where pro_evrakno_seri='" + prosip.pro_evrakno_seri + "' and pro_evrakno_sira='" + prosip.pro_evrakno_sira + "'");
                var aciklama   = _evrakAciklamaORM.GetList("select top 1 * from EVRAK_ACIKLAMALARI where egk_evr_seri='" + prosip.pro_evrakno_seri + "' and egk_evr_sira='" + prosip.pro_evrakno_sira + "'").FirstOrDefault();
                if (siparisler.Count > 0)
                {
                    foreach (var item in siparisler)
                    {
                        PrintList print = new PrintList();

                        if (item.pro_harekettipi == 0)
                        {
                            print.HizmetAd  = ToTitleCase(_stoklarORM.GetList("select * from STOKLAR where sto_kod='" + item.pro_stokkodu + "'").FirstOrDefault().sto_isim.ToLower());
                            print.HizmetTip = "Stok";
                        }
                        else
                        {
                            print.HizmetAd  = ToTitleCase(_hizmethesaplarORM.GetList("select * from HIZMET_HESAPLARI where hiz_kod='" + item.pro_stokkodu + "'").FirstOrDefault().hiz_isim.ToLower().Trim());
                            print.HizmetKod = item.pro_stokkodu;
                            if (aciklama != null)
                            {
                                print.Aciklama = ToTitleCase(Convert.ToString(aciklama.egk_evracik1 + " " + aciklama.egk_evracik2 + " " + aciklama.egk_evracik3 + " " + aciklama.egk_evracik4 + " " + aciklama.egk_evracik5).Trim().ToLower());
                            }
                            print.HizmetTip = "Hizmet";
                        }
                        list.Add(print);
                    }
                }
                model.PrintList = list;
            }
            else
            {
                return(RedirectToAction("List"));
            }

            return(View(model));
        }
Exemplo n.º 12
0
        public void PrintTest()
        {
            PrintList p = new PrintList();

            p.Print(testList);
        }
Exemplo n.º 13
0
 public void EnterPrintlist(BASICParser.PrintlistContext context)
 {
     currentPrintList = new PrintList();
 }