Пример #1
0
        private async Task LoadDataAsync(string search = "")
        {
            try
            {
                if (InvokeRequired)
                {
                    Invoke(new MethodInvoker(() =>
                    {
                        if (cmbUsers.SelectedValue == null)
                        {
                            return;
                        }
                    }));
                }
                else if (cmbUsers.SelectedValue == null)
                {
                    return;
                }
                list = await OrderBussines.GetAllAsync();

                Search(search);
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
Пример #2
0
        private async Task SetLabelsAsync()
        {
            try
            {
                var cust = await CustomerBussines.GetAllAsync();

                var order = await OrderBussines.GetAllAsync();

                var rece = await ReceptionBussines.GetAllAsync();

                var pardakht = await PardakhtBussines.GetAllAsync();

                var currentUser = CurentUser.CurrentUser;

                Invoke(new MethodInvoker(() =>
                {
                    lblAllCustomers.Text  = lblMyCustomers.Text = "";
                    lblAllOrders.Text     = lblMyOrders.Text = "";
                    lblAllPardakht.Text   = lblMyPardakht.Text = lblSumPardakht.Text = "";
                    lblAllReceptions.Text = lblMyReceptions.Text = lblSumReception.Text = "";

                    lblAllCustomers.Text = (cust?.Count ?? 0).ToString();
                    lblMyCustomers.Text  = (cust?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString();

                    lblAllOrders.Text = (order?.Count ?? 0).ToString();
                    lblMyOrders.Text  = (order?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString();

                    lblAllPardakht.Text = (pardakht?.Count ?? 0).ToString();
                    lblMyPardakht.Text  =
                        (pardakht?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString();
                    lblSumPardakht.Text =
                        (pardakht?.Where(q => q.UserGuid == currentUser.Guid)?.Sum(q => q.TotalPrice) ?? 0)
                        .ToString("N0");

                    lblAllReceptions.Text = (rece?.Count ?? 0).ToString();
                    lblMyReceptions.Text  = (rece?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString();
                    lblSumReception.Text  =
                        (rece?.Where(q => q.UserGuid == currentUser.Guid)?.Sum(q => q.TotalPrice) ?? 0).ToString("N0");
                }));
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }