示例#1
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);
            }
        }
示例#2
0
        private async void OnAddClicked(object sender, RoutedEventArgs e)
        {
            var person           = mainDatagrid.SelectedItem as PharmacyHajiawa.Models.Company;
            CompanyEditWindow it = new CompanyEditWindow(true, 1)
            {
            };

            it.ShowDialog();
            GetItems(false);
        }