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 ReceptionBussines.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 ReceptionBussines.GetAllAsync(search, _token.Token); Invoke(new MethodInvoker(() => ReceptionBindingSource.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 reception = await ReceptionBussines.GetAllAsync(_token.Token); var list = new List <OperationListPrintViewModel>(); foreach (var item in reception) { var totalSum = reception.Sum(q => q.SumCheck) + reception.Sum(q => q.SumHavale) + reception.Sum(q => q.SumNaqd); list.Add(new OperationListPrintViewModel() { PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now), PrintTime = DateTime.Now.ToShortTimeString(), DateM = item.DateM, Count = reception.Count, Description = item.Description, Number = item.Number, Check = item.SumCheck, DateSh = item.DateSh, TafsilName = item.TafsilName, Havale = item.SumHavale, Naqd = item.SumNaqd, TotalRow = totalSum, TotalSum = item.Sum, TotalHorouf = $"{NumberToString.Num2Str(totalSum.ToString())} ریال" }); } list = list?.OrderBy(q => q.DateM)?.ToList(); if (frm._PrintType == EnPrintType.Excel) { return; } var cls = new ReportGenerator(StiType.Reception_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; })); } }