Beispiel #1
0
        private void mainDatagrid_GotMouseCapture(object sender, MouseEventArgs e)
        {
            var person = mainDatagrid.SelectedItem as PharmacyHajiawa.Models.Cost;

            if (person is null)
            {
                return;
            }
            if (person.IsDeleted == true)
            {
                DisplaySheet displaySheet = new DisplaySheet(new List <string>()
                {
                    "گەڕاندنەوە"
                });
                displaySheet.ShowDialog();
                if (DisplaySheet.theResult is "گەڕاندنەوە")
                {
                    query.ExcuteAsync($"update Cost set IsDeleted=0 where CostId={person.CostId}");

                    GetItems(true);
                }
                return;
            }
            CostEditWindow it = new CostEditWindow(false, person.CostId)
            {
            };

            it.ShowDialog();
            GetItems(false);
        }
Beispiel #2
0
        private async void mainDatagrid_GotMouseCapture(object sender, MouseEventArgs e)
        {
            if (_isBuy)
            {
                try
                {
                    var p = mainDatagrid.SelectedItem as PharmacyHajiawa.Models.Company;
                    if (p is null)
                    {
                        return;
                    }
                    CompanyId   = p.CompanyId;
                    CompanyName = p.Name;
                    foreach (var wndOtherWindow in Application.Current.Windows)
                    {
                        if (wndOtherWindow is ForPageWindow)
                        {
                            (wndOtherWindow as Window).Close();
                        }
                    }
                    return;
                }
                catch (Exception)
                {
                    MessageBox.Show("کێشەیەک ڕویدا تکایە دووبارە هەوڵ بەرەوە");
                    throw;
                }
            }
            var person = mainDatagrid.SelectedItem as Models.Company;

            if (person is null)
            {
                return;
            }
            if (person.Status is true)
            {
                DisplaySheet sh = new DisplaySheet(new List <string> {
                    "گەڕاندنەوە"
                });
                sh.ShowDialog();
                if (DisplaySheet.theResult is "گەڕاندنەوە")
                {
                    QueryInside($"update Company set Status=0 where CompanyId={person.CompanyId}");
                    GetItems(true);
                }
                return;
            }
            else
            {
                CompanyEditWindow it = new CompanyEditWindow(false, person.CompanyId)
                {
                };
                it.ShowDialog();
                GetItems(false);
            }
        }
        private async void mainDatagrid_GotMouseCapture(object sender, MouseEventArgs e)
        {
            if (_isBuy)
            {
                var persons = mainDatagrid.SelectedItem as PharmacyHajiawa.Models.Item;
                if (persons is null)
                {
                    return;
                }
                ItemId   = persons.ItemId;
                TypeId   = persons.ItemTypeId;
                Barcode  = persons.Barcode;
                ItemName = persons.ScienceName;
                Query q = new Query();
                TypeName = await q.GetOne("select TypeName from ItemType where ItemTypeId=@id", new string[, ] {
                    { "@id", TypeId.ToString() }
                });

                foreach (var wndOtherWindow in Application.Current.Windows)
                {
                    if (wndOtherWindow is ForPageWindow)
                    {
                        (wndOtherWindow as Window).Close();
                    }
                }
                return;
            }

            var person = mainDatagrid.SelectedItem as PharmacyHajiawa.Models.Item;

            if (person is null)
            {
                return;
            }
            if (person.Status == true)
            {
                DisplaySheet displaySheet = new DisplaySheet(new List <string>()
                {
                    "گەڕاندنەوە"
                });
                displaySheet.ShowDialog();
                if (DisplaySheet.theResult is "گەڕاندنەوە")
                {
                    QueryInside($"update Item set Status=0 where ItemId={person.ItemId}");

                    GetItems(true);
                }
                return;
            }
            ItemEditWindow it = new ItemEditWindow(false, person.ItemId)
            {
            };

            it.ShowDialog();
            GetItems(false);
        }
Beispiel #4
0
        private async void mainDatagrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var person = mainDatagrid.SelectedItem as Models.View.ViewSell;

            if (person is null)
            {
                return;
            }
            DisplaySheet sheet = new DisplaySheet(new List <string> {
                "گۆڕینی نرخی فرۆشتن", "ڕەشکردنەوە", "فرۆشتن بە پاکەت"
            });

            sheet.ShowDialog();
            if (DisplaySheet.theResult == "گۆڕینی نرخی فرۆشتن")
            {
                SellChange sellChange = new SellChange(person.RealBuyId, person.SellPrice);
                sellChange.ShowDialog();
                getSells();
            }
            else if (DisplaySheet.theResult == "ڕەشکردنەوە")
            {
                await query.ExcuteProcedureAsyncWithParameter("spTransUpdateQuantity", new string[, ]
                {
                    { "@RealBuyId", person.RealBuyId.ToString() },
                    { "@quantity", person.Quantity.ToString() }
                });

                getSells();
            }
            else if (DisplaySheet.theResult == "فرۆشتن بە پاکەت")
            {
                PacketWindow g = new PacketWindow(person.RealBuyId);
                g.ShowDialog();
                if (PacketWindow.isSuccess)
                {
                    for (int i = 0; i < PacketWindow.Q; i++)
                    {
                        int quantity = int.Parse(await query.GetOne($"SELECT Quantity from BuyQuantity WHERE RealBuyId=@id; ", new string[, ] {
                            { "@id", person.RealBuyId.ToString() }
                        }));
                        if (quantity == 0)
                        {
                            DisplayAlert alert = new DisplayAlert("ئاگاداری", "هیچ دانەیەکت لەم کاڵایە نەماوە، ئەگەر بەردەستە تکایە لەبەشی کاڵادا زیادی بکە", "باشە");
                            alert.ShowDialog();
                            break;
                        }
                        await query.ExcuteAsync($"update BuyQuantity set Quantity=Quantity-1 where RealBuyId={person.RealBuyId}");

                        await query.ExcuteAsync($" insert into Sells(SellPrice,RealBuyId) values({person.SellPrice},{person.RealBuyId})");
                    }
                    getSells();
                }
            }
        }
        private async void mainDatagrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            var person = mainDatagrid.SelectedItem as Models.View.ViewStore;

            if (person is null)
            {
                MessageBox.Show("تکایە سەرەتا کلیک لەسەر ئەو شتە بکە کە دەتەوێ");
                return;
            }
            if (person.BuyId != 0 || person.BuyId != null)
            {
                DisplaySheet sh = new DisplaySheet(new List <string> {
                    "ڕەشکردنەوە + گەڕاندنەوە", "دەستکاریکردن"
                });
                sh.ShowDialog();
                if (DisplaySheet.theResult is "ڕەشکردنەوە + گەڕاندنەوە")
                {
                    string isdelet = await query.GetOneNoParameter($"select isDeleted from RealBuy where BuyId={person.BuyId}");

                    if (isdelet == "False")
                    {
                        await query.ExcuteAsync($"update RealBuy set isDeleted=1 where BuyId={person.BuyId}");

                        GetItems(false);
                    }
                    else if (isdelet == "True")
                    {
                        await query.ExcuteAsync($"update RealBuy set isDeleted=0 where BuyId={person.BuyId}");

                        GetItems(true);
                    }
                }
                else if (DisplaySheet.theResult == "دەستکاریکردن")
                {
                }
            }
        }
Beispiel #6
0
        private async void mainDatagrid_GotMouseCapture(object sender, MouseEventArgs e)
        {
            if (_isbuy)
            {
                var p = mainDatagrid.SelectedItem as PharmacyHajiawa.Models.ItemType;
                if (p is null)
                {
                    return;
                }
                ItemPage it = new ItemPage(p.ItemTypeId, true);

                this.NavigationService.Navigate(it);
                return;
            }
            var person = mainDatagrid.SelectedItem as Models.ItemType;

            if (person is null)
            {
                return;
            }
            if (person.Status is true)
            {
                DisplaySheet sh = new DisplaySheet(new List <string> {
                    "گەڕاندنەوە"
                });
                sh.ShowDialog();
                if (DisplaySheet.theResult is "گەڕاندنەوە")
                {
                    QueryInside($"update ItemType set Status=0 where ItemTypeId={person.ItemTypeId}");
                    GetItems(true);
                }
                return;
            }


            DisplaySheet sheet = new DisplaySheet(new List <string> {
                "دەستکاریکردن", "جۆرەکانی"
            });

            sheet.ShowDialog();
            if (DisplaySheet.theResult != null)
            {
                if (DisplaySheet.theResult is "دەستکاریکردن")
                {
                    if (person is null)
                    {
                        return;
                    }
                    ItemTypeEditWindow it = new ItemTypeEditWindow(false, person.ItemTypeId)
                    {
                    };
                    it.ShowDialog();
                    GetItems(false);
                }

                if (DisplaySheet.theResult is "جۆرەکانی")
                {
                    if (person is null)
                    {
                        return;
                    }
                    ItemPage it = new ItemPage(person.ItemTypeId);

                    this.NavigationService.Navigate(it);
                    GetItems(false);
                }
            }
            else
            {
                mainDatagrid.UnselectAllCells();
            }
        }