private async void Delete(IList <long> idArray) { btnDelete.Enabled = false; var ss = idArray.JoinSome(); if (Commons.ShowConfirmBox(this, "删除以下工程项目:" + ss + " 此操作不可恢复!确认吗?")) { string suc = ""; foreach (var id in idArray) { var p = await PrjEngineers.Delete(id); if (p.IsOk) { suc += id + ","; myGridViewBinding1.BindTo(p, Commons.BindFlag.Delete, "bpeId"); } else { Commons.ShowResultErrorBox(this, p); } } if (suc != "") { Commons.ShowInfoBox(this, "工程项目:" + suc.TrimEnd(',') + " 已被删除。"); } } btnDelete.Enabled = true; }
private async void SaveData() { btnOk.Enabled = false; try { var r = new Dictionary <string, object>(); r["bpe-id"] = m_bpeId; r["name"] = tbEngName.Text.Trim(); r["eng-show-name"] = tbShowEngName.Text.Trim(); r["address"] = tbAddress.Text.Trim(); r["eng-show-address"] = tbShowAddress.Text.Trim(); r["mgr-org-level"] = cbbMgrOrgLevel.Text.Trim(); r["mgr-org"] = tbMgrOrg.Text.Trim(); r["show-mgr-org"] = tbShowMgrOrg.Text.Trim(); r["design-org-level"] = cbbDesignOrgLevel.Text.Trim(); r["design-org"] = tbDesignOrg.Text.Trim(); r["show-design-org"] = tbShowDesignOrg.Text.Trim(); r["eng-type"] = cbbEngType.Text.Trim(); r["all-org"] = tbAllOrg.Text.Trim(); r["show-all-org"] = tbShowAllOrg.Text.Trim(); r["area"] = tbArea.Text; r["show-area"] = cbbShowArea.Text.Trim(); r["prj-start-time"] = dtpPrjStart.Value.TruncToStart(); r["prj-end-time"] = dtpPrjEnd.Value.TruncToEnd(); r["pro-intro"] = tbProIntro.Text.LeftStr(2000); r["mgr-real-name"] = tbMgrRealName.Text.Trim(); r["mgr-show-name"] = tbShowMgrName.Text.Trim(); r["mgr-age"] = tbAge.Text; r["mgr-show-age"] = tbShowAge.Text; r["mgr-gender"] = cbbGenders.GetSelectedValue(); r["qualification"] = tbQualification.Text.Trim(); r["mgr-intro"] = tbMgrIntro.Text.LeftStr(2000); IResult p; if (m_bpeId == 0) { p = await PrjEngineers.Create(r); } else { p = await PrjEngineers.Update(r); } if (p.IsOk) { DlgResult = p; DialogResult = DialogResult.OK; } else { Commons.ShowResultErrorBox(this, p); } } finally { btnOk.Enabled = true; } }
private async void UpdateTable1() { btnSearch.Enabled = false; var p = new Dictionary <string, object>(); p["start-time"] = startDate.Value.TruncToStart(); p["end-time"] = endDate.Value.TruncToEnd(); p["key"] = tbKey.Text.Trim(); var r = await PrjEngineers.GetEngineers(p); if (r.IsOk) { this.myGridViewBinding1.BindTo(r); } else { Commons.ShowResultErrorBox(this, r); } btnSearch.Enabled = true; }
private async void UpdateData() { var r = await PrjEngineers.GetEngineer(m_bpeId); if (r.IsOk) { var d = r.AsDictionary; tbEngName.Text = d.GetOrDefault <string>("name"); tbShowEngName.Text = d.GetOrDefault <string>("engShowName"); tbAddress.Text = d.GetOrDefault <string>("address"); tbShowAddress.Text = d.GetOrDefault <string>("engShowAddress"); cbbMgrOrgLevel.SetSelectedValue(d.GetOrDefault <string>("mgrOrgLevel")); tbMgrOrg.Text = d.GetOrDefault <string>("mgrOrg"); tbShowMgrOrg.Text = d.GetOrDefault <string>("showMgrOrg"); cbbDesignOrgLevel.SetSelectedValue(d.GetOrDefault <string>("designOrgLevel")); tbDesignOrg.Text = d.GetOrDefault <string>("designOrg"); tbShowDesignOrg.Text = d.GetOrDefault <string>("showDesignOrg"); cbbEngType.SetSelectedValue(d.GetOrDefault <string>("engType")); tbAllOrg.Text = d.GetOrDefault <string>("allOrg"); tbShowAllOrg.Text = d.GetOrDefault <string>("showAllOrg"); tbArea.Text = d.GetOrDefault <string>("area"); cbbShowArea.SetSelectedValue(d.GetOrDefault <string>("showArea")); dtpPrjStart.Value = Commons.FromTimestamp(d.GetOrDefault <long>("prjStartTime")); dtpPrjEnd.Value = Commons.FromTimestamp(d.GetOrDefault <long>("prjEndTime")); tbProIntro.Text = d.GetOrDefault <string>("proIntro"); tbMgrRealName.Text = d.GetOrDefault <string>("mgrRealName"); tbShowMgrName.Text = d.GetOrDefault <string>("mgrShowName"); tbAge.Text = d.GetOrDefault <string>("mgrAge"); tbShowAge.Text = d.GetOrDefault <string>("mgrShowAge"); cbbGenders.SetSelectedValue(d.GetOrDefault <int>("mgrGender")); tbQualification.Text = d.GetOrDefault <string>("qualification"); tbMgrIntro.Text = d.GetOrDefault <string>("mgrIntro"); } else { Commons.ShowResultErrorBox(this, r); } }