private async void btnFinish_Click(object sender, EventArgs e) { try { if (cls.Guid == Guid.Empty) { cls.Guid = Guid.NewGuid(); cls.DateSabt = DateConvertor.M2SH(DateTime.Now); } if (string.IsNullOrEmpty(txtName.Text)) { WebErrorLog.ErrorInstence.StartErrorLog("عنوان گروه نمی تواند خالی باشد", false); txtName.Focus(); return; } if (!AdvGroupBussines.Check_Name(txtName.Text, cls.Guid)) { WebErrorLog.ErrorInstence.StartErrorLog("عنوان وارد شده تکراری است", false); txtName.Focus(); return; } cls.Status = true; cls.Name = txtName.Text.Trim(); cls.ParentGuid = (Guid)cmbParent.SelectedValue; await cls.SaveAsync(); DialogResult = DialogResult.OK; Close(); } catch (Exception exception) { WebErrorLog.ErrorInstence.StartErrorLog(exception); } }
private async Task LoadData() { try { var a = new AdvGroupBussines() { Guid = Guid.Empty, DateSabt = DateConvertor.M2SH(DateTime.Now), Status = true, Name = "[هیچکدام]", ParentGuid = Guid.Empty }; var list = await AdvGroupBussines.GetAllAsync(); list = list.Where(q => q.Status && q.ParentGuid == Guid.Empty).ToList(); list.Add(a); list = list.OrderBy(q => q.Name).ToList(); ParentBindingSource.DataSource = list; } catch (Exception e) { WebErrorLog.ErrorInstence.StartErrorLog(e); } }
public frmAdsGroup(Guid guid) { InitializeComponent(); cls = AdvGroupBussines.Get(guid); }
public frmAdsGroup() { InitializeComponent(); cls = new AdvGroupBussines(); }