protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ReceptionMainLayout); myToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.ReceptionMainToolbar); SetSupportActionBar(myToolbar); FindElements(); SetCmbData(); SetFonts(); var names = CustomerBussines.GetAll().Select(q => q.Name).ToList(); ArrayAdapter adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, names); txtReceptionMainCustomerName.Adapter = adapter; var names_ = ReceptionBussines.GetAll().Select(q => q.BankName).ToList(); ArrayAdapter adapter_ = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, names_); txtReceptionMainBankName.Adapter = adapter_; cls = new ReceptionBussines(); txtReceptionMainYear.Text = Calendar.GetYearOfDateSh(cls.DateSh).ToString(); txtReceptionMainMounth.Text = Calendar.GetMonthOfDateSh(cls.DateSh).ToString(); txtReceptionMainDay.Text = Calendar.GetDayOfDateSh(cls.DateSh).ToString(); lblReceptionMainDateSh.Text = cls.DateSh; cmbSandouq.ItemSelected += CmbSandouq_ItemSelected; cmbBank.ItemSelected += CmbBank_ItemSelected; }
public static async Task <ReturnedSaveFuncInfo> SaveAsync(ReceptionBussines cls) { var res = new ReturnedSaveFuncInfo(); try { var obj = new WebReception() { Guid = cls.Guid, Modified = cls.Modified, Description = cls.Description, HardSerial = cls.HardSerial, ServerStatus = cls.ServerStatus, ServerDeliveryDate = cls.ServerDeliveryDate, DateM = cls.DateM, Number = cls.Number, UserGuid = cls.UserGuid, TafsilGuid = cls.TafsilGuid, SanadNumber = cls.SanadNumber, MoeinGuid = cls.MoeinGuid, SumHavale = cls.SumHavale, SumNaqd = cls.SumNaqd, Sum = cls.Sum, SumCheck = cls.SumCheck }; await obj.SaveAsync(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
public override bool OnOptionsItemSelected(IMenuItem item) { var res = new ReturnedSaveFuncInfo(); res.AddReturnedValue(CheckValidation()); if (res.HasError) { Toast.MakeText(this, res.ErrorMessage, ToastLength.Short).Show(); return(base.OnOptionsItemSelected(item)); } cls.Guid = Guid.NewGuid(); cls.Modified = DateTime.Now; cls.Status = true; cls.UserGuid = CurrentUser.User.Guid; cls.NaqdPrice = txtReceptionMainNaqdPrice.Text.ParseToDecimal(); cls.BankName = txtReceptionMainBankName.Text; cls.BankPrice = txtReceptionMainBankPrice.Text.ParseToDecimal(); cls.Check = txtReceptionMainCheckPrice.Text.ParseToDecimal(); cls.CheckNo = txtReceptionMainChechNo.Text; cls.CreateDate = DateTime.Now; cls.Description = ""; cls.FishNo = txtReceptionMainBankFishNo.Text; cls.Receptor = customerGuid; cls.SarResid = txtReceptionMainYear.Text + "/" + txtReceptionMainMounth.Text + "/" + txtReceptionMainDay.Text; ReceptionBussines.Save(cls); Finish(); return(base.OnOptionsItemSelected(item)); }
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); } }
public async Task <ReceptionBussines> GetAsync(string _connectionString, Guid guid) { ReceptionBussines res = null; try { using (var cn = new SqlConnection(_connectionString)) { var cmd = new SqlCommand("sp_Reception_GetByGuid", cn) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@guid", guid); await cn.OpenAsync(); var dr = await cmd.ExecuteReaderAsync(); if (dr.Read()) { res = LoadData(dr); } cn.Close(); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } return(res); }
private ReceptionBussines LoadData(SqlDataReader dr) { var item = new ReceptionBussines(); try { item.Guid = (Guid)dr["Guid"]; item.Modified = (DateTime)dr["Modified"]; item.DateM = (DateTime)dr["DateM"]; item.Description = dr["Description"].ToString(); item.Number = (long)dr["Number"]; item.TafsilGuid = (Guid)dr["TafsilGuid"]; item.MoeinGuid = (Guid)dr["MoeinGuid"]; item.UserGuid = (Guid)dr["UserGuid"]; item.SanadNumber = (long)dr["SanadNumber"]; item.TafsilName = dr["TafsilName"].ToString(); item.UserName = dr["UserName"].ToString(); item.ServerDeliveryDate = (DateTime)dr["ServerDeliveryDate"]; item.ServerStatus = (ServerStatus)dr["ServerStatus"]; item.IsModified = true; item.CheckList = AsyncContext.Run(() => ReceptionCheckBussines.GetAllAsync(item.Guid)); item.HavaleList = AsyncContext.Run(() => ReceptionHavaleBussines.GetAllAsync(item.Guid)); item.NaqdList = AsyncContext.Run(() => ReceptionNaqdBussines.GetAllAsync(item.Guid)); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } return(item); }
public static async Task <ReturnedSaveFuncInfo> BargashtAsync(ReceptionCheckBussines cls) { var res = new ReturnedSaveFuncInfo(); try { cls.CheckStatus = EnCheckM.Bargashti; cls.Modified = DateTime.Now; res.AddReturnedValue(await cls.SaveAsync()); var reception = await ReceptionBussines.GetAsync(cls.MasterGuid.Value); var pardazande = await TafsilBussines.GetAsync(reception.TafsilGuid); var sanad = new SanadBussines() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Description = $"برگشت زدن چک دریافتنی * شناره: {cls.CheckNumber} بانک صادرکننده: {cls.BankName} * پردازنده: {pardazande.Name}", DateM = DateTime.Now, Number = await SanadBussines.NextNumberAsync(), SanadStatus = EnSanadStatus.Temporary, SanadType = EnSanadType.Auto, UserGuid = UserBussines.CurrentUser.Guid }; //بستانکار--اسناد sanad.AddToListSanad(new SanadDetailBussines() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Description = $"برگشت زدن چک {cls.CheckNumber} {cls.BankName} * پردازنده: {pardazande.Name}", Debit = 0, Credit = cls.Price, TafsilGuid = cls.SandouqTafsilGuid, MasterGuid = sanad.Guid, MoeinGuid = cls.SandouqMoeinGuid }); //بدهکار--شخص sanad.AddToListSanad(new SanadDetailBussines() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Description = $"برگشت زدن چک {cls.CheckNumber} {cls.BankName} * پردازنده: {pardazande.Name}", Debit = cls.Price, Credit = 0, TafsilGuid = pardazande.Guid, MasterGuid = sanad.Guid, MoeinGuid = ParentDefaults.MoeinCoding.CLSMoein10304 }); res.AddReturnedValue(await sanad.SaveAsync()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
private async void mnuViewSanad_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var avalDore = (bool)DGrid[dgAvalDore.Index, DGrid.CurrentRow.Index].Value; if (!avalDore) { var str = await ReceptionCheckBussines.GetAsync(guid); var rec = await ReceptionBussines.GetAsync(str.MasterGuid.Value); var sanad = await SanadBussines.GetAsync(rec.SanadNumber); var frm_ = new frmSanadMain(sanad.Guid, true); frm_.ShowDialog(this); return; } var frm = new frmCheckM_AvalDore(guid, true); frm.ShowDialog(this); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async void mnuBatel_Click(object sender, EventArgs e) { var res = new ReturnedSaveFuncInfo(); try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var st = (EnCheckM)DGrid[dgStatus.Index, DGrid.CurrentRow.Index].Value; if (st == EnCheckM.Bargashti || st == EnCheckM.Naqd) { frmNotification.PublicInfo.ShowMessage($"شما مجاز به ابطال چک {st.GetDisplay()} نمی باشید"); return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var avalDore = (bool)DGrid[dgAvalDore.Index, DGrid.CurrentRow.Index].Value; if (MessageBox.Show("آیا از ابطال چک اطمینان دارید؟", "پیغام سیستم", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (!avalDore) { var str = await ReceptionCheckBussines.GetAsync(guid); var rec = await ReceptionBussines.GetAsync(str.MasterGuid.Value); rec.RemoveFromDetList(str); res.AddReturnedValue(await rec.SaveAsync()); return; } var cls = await ReceptionCheckAvalDoreBussines.GetAsync(guid); res.AddReturnedValue(await cls.RemoveAsync()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } finally { if (res.HasError) { this.ShowError(res, "خطا در ابطال چک دریافتنی"); } else { await LoadDataAsync(txtSearch.Text); } } }
public frmReceptionMain(Guid guid, bool isShowMode) { InitializeComponent(); cls = ReceptionBussines.Get(guid); grp.Enabled = !isShowMode; btnFinish.Enabled = !isShowMode; contextMenu.Enabled = !isShowMode; SetAccess(); }
private async Task SetDataAsync() { try { await SetTafilAsync(cls?.TafsilGuid ?? Guid.Empty); txtDate.Text = cls?.DateSh; txtDesc.Text = cls?.Description; if (cls.Guid == Guid.Empty) { txtNumber.Value = await ReceptionBussines.NextCodeAsync(); txtSanadNo.Value = await SanadBussines.NextNumberAsync(); } else { txtNumber.Value = cls.Number; txtSanadNo.Value = cls.SanadNumber; } if (!_isLoaded) { if (cls.NaqdList != null) { foreach (var item in cls.NaqdList) { AddToGrid(item); } } if (cls.HavaleList != null) { foreach (var item in cls.HavaleList) { AddToGrid(item); } } if (cls.CheckList != null) { foreach (var item in cls.CheckList) { AddToGrid(item); } } } SetLables(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private void BindList() { try { list = ReceptionBussines.GetAll(); if (CurrentUser.User.Type != EnUserType.Manager) list = list.Where(q => q.UserGuid == CurrentUser.User.Guid).ToList(); lstReception.Adapter = new ReceptionAdapter(this, list.OrderByDescending(q => q.CreateDate).ToList()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async void mnuDelete_Click(object sender, EventArgs e) { var res = new ReturnedSaveFuncInfo(); try { if (DGrid.RowCount <= 0) { return; } if (DGrid.CurrentRow == null) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var hazine = await ReceptionBussines.GetAsync(guid); if (hazine == null) { return; } var sum = (decimal)DGrid[dgSum.Index, DGrid.CurrentRow.Index].Value; if (MessageBox.Show(this, $@"آیا از حذف دریافت به شماره {DGrid[dgNumber.Index, DGrid.CurrentRow.Index].Value} و به جمع {sum:N0} اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } res.AddReturnedValue(await hazine.RemoveAsync()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } finally { if (res.HasError) { this.ShowError(res, "خطا در حذف برگه دریافت"); } else { await LoadDataAsync(txtSearch.Text); } } }
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 static async Task <ReturnedSaveFuncInfo> NaqdBargashtAsync(ReceptionCheckBussines cls, SanadBussines sanad) { var res = new ReturnedSaveFuncInfo(); try { var reception = await ReceptionBussines.GetAsync(cls.MasterGuid.Value); var pardazande = await TafsilBussines.GetAsync(reception.TafsilGuid); //بستانکار--شخص sanad.AddToListSanad(new SanadDetailBussines() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Description = $"استرداد چک {cls.CheckNumber} {cls.BankName} * پردازنده: {pardazande.Name}", Debit = 0, Credit = cls.Price, TafsilGuid = pardazande.Guid, MasterGuid = sanad.Guid, MoeinGuid = ParentDefaults.MoeinCoding.CLSMoein10304 }); //بدهکار--اسناد sanad.AddToListSanad(new SanadDetailBussines() { Guid = Guid.NewGuid(), Modified = DateTime.Now, Description = $"استرداد چک {cls.CheckNumber} {cls.BankName} * پردازنده: {pardazande.Name}", Debit = cls.Price, Credit = 0, TafsilGuid = cls.SandouqTafsilGuid, MasterGuid = sanad.Guid, MoeinGuid = cls.SandouqMoeinGuid }); res.AddReturnedValue(await sanad.SaveAsync()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
public frmReceptionMain(EnOperation op) { InitializeComponent(); cls = new ReceptionBussines(); _isLoaded = true; switch (op) { case EnOperation.CheckM: mnuAddCheck.PerformClick(); break; case EnOperation.Havale: mnuAddHavale.PerformClick(); break; case EnOperation.Naqd: mnuAddNaqd.PerformClick(); break; } SetAccess(); }
private async void mnuDelete_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0) { return; } if (DGrid.CurrentRow == null) { return; } if (MessageBox.Show("آیا از حذف دریافت اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var rec = await ReceptionBussines.GetAsync(guid); rec.Status = false; var res = await ReceptionBussines.RemoveAsync(rec); if (res.HasError) { frmNotification.PublicInfo.ShowMessage(res.ErrorMessage); return; } await LoadDataAsync(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public async Task <ReturnedSaveFuncInfo> SaveAsync(ReceptionBussines item, SqlTransaction tr) { var res = new ReturnedSaveFuncInfo(); try { var cmd = new SqlCommand("sp_Reception_Save", tr.Connection, tr) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@guid", item.Guid); cmd.Parameters.AddWithValue("@modif", item.Modified); cmd.Parameters.AddWithValue("@dateM", item.DateM); cmd.Parameters.AddWithValue("@desc", item.Description ?? ""); cmd.Parameters.AddWithValue("@number", item.Number); cmd.Parameters.AddWithValue("@tafsilGuid", item.TafsilGuid); cmd.Parameters.AddWithValue("@userGuid", item.UserGuid); cmd.Parameters.AddWithValue("@moeinGuid", ParentDefaults.MoeinCoding.CLSMoein10304); cmd.Parameters.AddWithValue("@sanadNumber", item.SanadNumber); cmd.Parameters.AddWithValue("@serverSt", (short)item.ServerStatus); cmd.Parameters.AddWithValue("@serverDate", item.ServerDeliveryDate); cmd.Parameters.AddWithValue("@sumCheck", item.SumCheck); cmd.Parameters.AddWithValue("@sumHavale", item.SumHavale); cmd.Parameters.AddWithValue("@sumNaqd", item.SumNaqd); cmd.Parameters.AddWithValue("@sum", item.Sum); await cmd.ExecuteNonQueryAsync(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
public frmReceptionMain(Guid guid) { InitializeComponent(); cls = ReceptionBussines.Get(guid); }
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 static async Task StartSendToServerAsync() { try { var list = await TempBussines.GetAllAsync(); while (true) { if (list == null || list.Count <= 0) { await Task.Delay(2000); continue; } foreach (var item in list) { switch (item.Type) { case EnTemp.States: var states = await StatesBussines.GetAsync(item.ObjectGuid); if (states != null) { await WebStates.SaveAsync(states); } break; case EnTemp.Cities: var city = await CitiesBussines.GetAsync(item.ObjectGuid); if (city != null) { await WebCity.SaveAsync(city); } break; case EnTemp.Region: var region = await RegionsBussines.GetAsync(item.ObjectGuid); if (region != null) { await WebRegion.SaveAsync(region); } break; case EnTemp.Users: var user = await UserBussines.GetAsync(item.ObjectGuid); if (user != null) { await WebUser.SaveAsync(user); } break; case EnTemp.PeopleGroups: var pg = await PeopleGroupBussines.GetAsync(item.ObjectGuid); if (pg != null) { await WebPeopleGroup.SaveAsync(pg); } break; case EnTemp.Peoples: var p = await PeoplesBussines.GetAsync(item.ObjectGuid); if (p != null) { await WebPeople.SaveAsync(p); } break; case EnTemp.BuildingAccountType: var acc = await BuildingAccountTypeBussines.GetAsync(item.ObjectGuid); if (acc != null) { await WebBuildingAccountType.SaveAsync(acc); } break; case EnTemp.BuildingCondition: var co = await BuildingConditionBussines.GetAsync(item.ObjectGuid); if (co != null) { await WebBuildingCondition.SaveAsync(co); } break; case EnTemp.BuildingType: var type = await BuildingTypeBussines.GetAsync(item.ObjectGuid); if (type != null) { await WebBuildingType.SaveAsync(type); } break; case EnTemp.BuildingView: var view = await BuildingViewBussines.GetAsync(item.ObjectGuid); if (view != null) { await WebBuildingView.SaveAsync(view); } break; case EnTemp.DocumentType: var doc = await DocumentTypeBussines.GetAsync(item.ObjectGuid); if (doc != null) { await WebDocumentType.SaveAsync(doc); } break; case EnTemp.FloorCover: var fc = await FloorCoverBussines.GetAsync(item.ObjectGuid); if (fc != null) { await WebFloorCover.SaveAsync(fc); } break; case EnTemp.KitchenService: var ks = await KitchenServiceBussines.GetAsync(item.ObjectGuid); if (ks != null) { await WebKitchenService.SaveAsync(ks); } break; case EnTemp.RentalAuthority: var ra = await RentalAuthorityBussines.GetAsync(item.ObjectGuid); if (ra != null) { await WebRental.SaveAsync(ra); } break; case EnTemp.BuildingOptions: var o = await BuildingOptionsBussines.GetAsync(item.ObjectGuid); if (o != null) { await WebBuildingOptions.SaveAsync(o); } break; case EnTemp.Building: var bu = await BuildingBussines.GetAsync(item.ObjectGuid); if (bu != null) { await WebBuilding.SaveAsync(bu, Application.StartupPath); } break; case EnTemp.Contract: var con = await ContractBussines.GetAsync(item.ObjectGuid); if (con != null) { await WebContract.SaveAsync(con); } break; case EnTemp.Requests: var req = await BuildingRequestBussines.GetAsync(item.ObjectGuid); if (req != null) { await WebBuildingRequest.SaveAsync(req); } break; case EnTemp.Reception: var rec = await ReceptionBussines.GetAsync(item.ObjectGuid); if (rec != null) { await WebReception.SaveAsync(rec); } break; case EnTemp.Pardakht: var pa = await PardakhtBussines.GetAsync(item.ObjectGuid); if (pa != null) { await WebPardakht.SaveAsync(pa); } break; case EnTemp.BuildingRelatedOptions: var re = await BuildingRelatedOptionsBussines.GetAsync(item.ObjectGuid); if (re != null) { await WebBuildingRelatedOptions.SaveAsync(re); } break; case EnTemp.RequestRegions: var rr = await BuildingRequestRegionBussines.GetAsync(item.ObjectGuid); if (rr != null) { await WebBuildingRequestRegion.SaveAsync(rr); } break; case EnTemp.PhoneBook: var ph = await PhoneBookBussines.GetAsync(item.ObjectGuid); if (ph != null) { await WebPhoneBook.SaveAsync(ph); } break; case EnTemp.Advisor: var ad = await AdvisorBussines.GetAsync(item.ObjectGuid); if (ad != null) { await WebAdvisor.SaveAsync(ad); } break; case EnTemp.Bank: var ba = await BankBussines.GetAsync(item.ObjectGuid); if (ba != null) { await WebBank.SaveAsync(ba); } break; case EnTemp.Kol: var kol = await KolBussines.GetAsync(item.ObjectGuid); if (kol != null) { await WebKol.SaveAsync(kol); } break; case EnTemp.Moein: var moein = await MoeinBussines.GetAsync(item.ObjectGuid); if (moein != null) { await WebMoein.SaveAsync(moein); } break; case EnTemp.Tafsil: var tafsil = await TafsilBussines.GetAsync(item.ObjectGuid); if (tafsil != null) { await WebTafsil.SaveAsync(tafsil); } break; case EnTemp.Sanad: var sa = await SanadBussines.GetAsync(item.ObjectGuid); if (sa != null) { await WebSanad.SaveAsync(sa); } break; case EnTemp.SanadDetail: var saD = await SanadDetailBussines.GetAsync(item.ObjectGuid); if (saD != null) { await WebSanadDetail.SaveAsync(saD); } break; } await item.RemoveAsync(); } await Task.Delay(2000); list = await TempBussines.GetAllAsync(); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async void mnuPrintOne_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; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var reception = await ReceptionBussines.GetAsync(guid); var list = new List <OperationOnePrintViewModel>(); foreach (var item in reception.NaqdList) { list.Add(new OperationOnePrintViewModel() { PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now), Description = reception.Description, Type = "نقد", Price = item.Price, SanadNumber = reception.SanadNumber, DateSh = reception.DateSh, TafsilName = reception.TafsilName, TotalSum = reception.Sum, RowDesc = item.Description }); } foreach (var item in reception.HavaleList) { list.Add(new OperationOnePrintViewModel() { PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now), Description = reception.Description, Type = "حواله", Price = item.Price, SanadNumber = reception.SanadNumber, DateSh = reception.DateSh, TafsilName = reception.TafsilName, TotalSum = reception.Sum, RowDesc = item.Description }); } foreach (var item in reception.CheckList) { list.Add(new OperationOnePrintViewModel() { PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now), Description = reception.Description, Type = "چک", Price = item.Price, SanadNumber = reception.SanadNumber, DateSh = reception.DateSh, TafsilName = reception.TafsilName, TotalSum = reception.Sum, RowDesc = item.Description }); } if (frm._PrintType == EnPrintType.Excel) { return; } var cls = new ReportGenerator(StiType.Reception_One, frm._PrintType) { Lst = new List <object>(list) }; cls.PrintNew(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public frmReceptionMain() { InitializeComponent(); cls = new ReceptionBussines(); SetAccess(); }
private async void btnFinish_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtName.Text)) { frmNotification.PublicInfo.ShowMessage("طرف حساب نمی تواند خالی باشد"); txtName.Focus(); return; } if (txtNaqdPrice.Text == "0" && txtBankPrice.Text == "0" && txtCheckPrice.Text == "0") { frmNotification.PublicInfo.ShowMessage("لطفا یکی از فیلدهای مبلغ را وارد نمایید"); return; } if (cls.Guid == Guid.Empty) { cls.Guid = Guid.NewGuid(); } cls.BankName = txtBankName.Text; cls.CheckNo = txtCheckNo.Text; cls.Description = txtDesc.Text; cls.FishNo = txtFishNo.Text; cls.SarResid = txtSarResid.Text; cls.NaqdPrice = txtNaqdPrice.Text.ParseToDecimal(); if (cmbNaqd.SelectedValue != null) { cls.NaqdSafeBoxGuid = (Guid)cmbNaqd.SelectedValue; } else { cls.NaqdSafeBoxGuid = Guid.Empty; } cls.BankPrice = txtBankPrice.Text.ParseToDecimal(); if (cmbBank.SelectedValue != null) { cls.BankSafeBoxGuid = (Guid)cmbBank.SelectedValue; } else { cls.BankSafeBoxGuid = Guid.Empty; } cls.Check = txtCheckPrice.Text.ParseToDecimal(); cls.UserGuid = Users.CurentUser.CurrentUser.Guid; var res = await ReceptionBussines.SaveAsync(cls); if (res.HasError) { frmNotification.PublicInfo.ShowMessage(res.ErrorMessage); return; } DialogResult = DialogResult.OK; Close(); } 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; })); } }