public async Task <string> NextCodeAsync(string _connectionString, HesabType type) { var res = "0"; try { using (var cn = new SqlConnection(_connectionString)) { var cmd = new SqlCommand("sp_Tafsil_NextCode", cn) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@hType", (short)type); await cn.OpenAsync(); var obj = await cmd.ExecuteScalarAsync(); if (obj != null) { res = obj.ToString(); } cn.Close(); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } return(res); }
public frmCheckM_Vagozar(ReceptionCheckAvalDoreBussines cls, HesabType hType) { InitializeComponent(); _oldTafsil = TafsilBussines.Get(cls.SandouqTafsilGuid); _isAvalDore = true; _newHesabType = hType; recAvalDore = cls; }
public frmTafsilMain(HesabType hType) { InitializeComponent(); cls = new TafsilBussines(); ucHeader.Text = $"افزودن {hType.GetDisplay()} جدید"; cmbType.Enabled = false; this.hType = hType; if (hType == HesabType.Hazine || hType == HesabType.Bank) { cmbAccount.Enabled = txtAccount_.Enabled = false; } }
private async Task LoadTafsilAsync(HesabType hType) { try { _token?.Cancel(); _token = new CancellationTokenSource(); var list = await TafsilBussines.GetAllAsync("", _token.Token, hType); tafsilBundingSource.DataSource = list.Where(q => q.Status).OrderBy(q => q.Name); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public frmTafsilMain(Guid guid, bool isShowMode, HesabType?htype = null) { InitializeComponent(); cls = TafsilBussines.Get(guid); ucHeader.Text = !isShowMode ? $"ویرایش حساب تفصیلی {cls.Name}" : $"مشاهده حساب تفصیلی {cls.Name}"; ucHeader.IsModified = true; grp.Enabled = !isShowMode; btnFinish.Enabled = !isShowMode; if (htype != null) { cmbType.Enabled = false; this.hType = htype.Value; if (hType == HesabType.Hazine || hType == HesabType.Bank) { cmbAccount.Enabled = txtAccount_.Enabled = false; } } }
private static TafsilBussines SetDef(string name, string code, Guid guid, HesabType hType) { try { var state = new TafsilBussines() { Guid = guid, Name = name, Code = code, Account = 0, Description = "", isSystem = true, HesabType = hType, AccountFirst = 0 }; return(state); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); return(null); } }
public static string NextCode(HesabType hType) => AsyncContext.Run(() => NextCodeAsync(hType));
public static async Task <string> NextCodeAsync(HesabType hType) => await UnitOfWork.Tafsil.NextCodeAsync(Cache.ConnectionString, hType);
public static async Task <List <TafsilBussines> > GetAllAsync(string search, CancellationToken token, HesabType htype = HesabType.All) { try { if (string.IsNullOrEmpty(search)) { search = ""; } var res = await GetAllAsync(token); if (token.IsCancellationRequested) { return(null); } if (htype != HesabType.All) { res = res.Where(q => q.HesabType == htype).ToList(); } if (token.IsCancellationRequested) { return(null); } var searchItems = search.SplitString(); if (searchItems?.Count > 0) { foreach (var item in searchItems) { if (token.IsCancellationRequested) { return(null); } if (!string.IsNullOrEmpty(item) && item.Trim() != "") { res = res.Where(x => x.Name.ToLower().Contains(item.ToLower()) || x.Code.ToLower().Contains(item.ToLower()) || x.Account.ToString().ToLower().Contains(item.ToLower())) ?.ToList(); } } } res = res?.OrderBy(o => o.Name).ToList(); return(res); } catch (TaskCanceledException) { return(null); } catch (OperationCanceledException) { return(null); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); return(new List <TafsilBussines>()); } }
public frmSelectTafsil(HesabType htype = HesabType.All) { InitializeComponent(); _type = htype; DGrid.Focus(); }