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 PardakhtBussines.GetAllAsync(); Search(search); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async Task LoadDataAsync(string search = "") { try { _token?.Cancel(); _token = new CancellationTokenSource(); var list = await PardakhtBussines.GetAllAsync(search, _token.Token); Invoke(new MethodInvoker(() => PardakhtBindingSource.DataSource = list.OrderByDescending(q => q.Number).ToSortableBindingList())); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
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); } }
private async void mnuPrintList_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0) { return; } if (DGrid.CurrentRow == null) { return; } var frm = new frmSetPrintSize(false); if (frm.ShowDialog(this) != DialogResult.OK) { return; } _token?.Cancel(); _token = new CancellationTokenSource(); var pardakht = await PardakhtBussines.GetAllAsync(_token.Token); var list = new List <OperationListPrintViewModel>(); foreach (var item in pardakht) { var totalSum = pardakht.Sum(q => q.SumCheckMoshtari) + pardakht.Sum(q => q.SumHavale) + pardakht.Sum(q => q.SumNaqd) + pardakht.Sum(q => q.SumCheckShakhsi); list.Add(new OperationListPrintViewModel() { PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now), PrintTime = DateTime.Now.ToShortTimeString(), DateM = item.DateM, Count = pardakht.Count, Description = item.Description, Number = item.Number, Check = 0, DateSh = item.DateSh, TafsilName = item.TafsilName, Havale = 0, Naqd = 0, TotalRow = item.Sum, TotalSum = totalSum, TotalHorouf = $"{NumberToString.Num2Str(totalSum.ToString())} ریال" }); } list = list?.OrderBy(q => q.DateM)?.ToList(); if (frm._PrintType == EnPrintType.Excel) { return; } var cls = new ReportGenerator(StiType.Pardakht_List, frm._PrintType) { Lst = new List <object>(list) }; cls.PrintNew(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async Task ResendDataToHost() { try { if (chbState.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebStates.SaveAsync(await StatesBussines.GetAllAsync(_token.Token)); } if (chbCity.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebCity.SaveAsync(await CitiesBussines.GetAllAsync(_token.Token)); } if (chbRegion.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebRegion.SaveAsync(await RegionsBussines.GetAllAsync(_token.Token)); } if (chbUsers.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebUser.SaveAsync(await UserBussines.GetAllAsync(_token.Token)); } if (chbPeopleGroup.Checked) { await WebPeopleGroup.SaveAsync(await PeopleGroupBussines.GetAllAsync()); } if (chbPeople.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebPeople.SaveAsync(await PeoplesBussines.GetAllAsync(_token.Token)); } if (chbAccountType.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuildingAccountType.SaveAsync(await BuildingAccountTypeBussines.GetAllAsync(_token.Token)); } if (chbCondition.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuildingCondition.SaveAsync(await BuildingConditionBussines.GetAllAsync(_token.Token)); } if (chbType.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuildingType.SaveAsync(await BuildingTypeBussines.GetAllAsync(_token.Token)); } if (chbView.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuildingView.SaveAsync(await BuildingViewBussines.GetAllAsync(_token.Token)); } if (chbDocType.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebDocumentType.SaveAsync(await DocumentTypeBussines.GetAllAsync(_token.Token)); } if (chbFloor.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebFloorCover.SaveAsync(await FloorCoverBussines.GetAllAsync(_token.Token)); } if (chbKitchen.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebKitchenService.SaveAsync(await KitchenServiceBussines.GetAllAsync(_token.Token)); } if (chbRental.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebRental.SaveAsync(await RentalAuthorityBussines.GetAllAsync(_token.Token)); } if (chbOptions.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuildingOptions.SaveAsync(await BuildingOptionsBussines.GetAllAsync(_token.Token)); } if (chbBuilding.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuilding.SaveAsync(await BuildingBussines.GetAllAsync(_token.Token), Application.StartupPath); } if (chbRequest.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBuildingRequest.SaveAsync(await BuildingRequestBussines.GetAllAsync(_token.Token)); } if (chbContract.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebContract.SaveAsync(await ContractBussines.GetAllAsync(_token.Token)); } if (chbReception.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebReception.SaveAsync(await ReceptionBussines.GetAllAsync(_token.Token)); } if (chbPardakht.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebPardakht.SaveAsync(await PardakhtBussines.GetAllAsync(_token.Token)); } if (chbAdvisor.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebAdvisor.SaveAsync(await AdvisorBussines.GetAllAsync(_token.Token)); } if (chbBank.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebBank.SaveAsync(await BankBussines.GetAllAsync(_token.Token)); } if (chbKol.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebKol.SaveAsync(await KolBussines.GetAllAsync(_token.Token)); } if (chbMoein.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebMoein.SaveAsync(await MoeinBussines.GetAllAsync(_token.Token)); } if (chbTafsil.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebTafsil.SaveAsync(await TafsilBussines.GetAllAsync(_token.Token)); } if (chbSanad.Checked) { _token?.Cancel(); _token = new CancellationTokenSource(); await WebSanad.SaveAsync(await SanadBussines.GetAllAsync(_token.Token)); } Invoke(new MethodInvoker(() => MessageBox.Show("انتقال داده ها به سرور با موفقیت انجام شد"))); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } finally { Invoke(new MethodInvoker(() => { btnSend.Enabled = true; Cursor = Cursors.Default; })); } }