//保存 private void btnSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (validationProvider.Validate()) { if (Type == DBOperateType.Insert) { Destination = new CoDestination(); Destination.Code = txtCode.Text.Trim(); Destination.Valid = true; } Destination.Name = txtName.Text.Trim(); Destination.SiteID = (btneditSite.Tag as CoSite).ID; Destination.ModifyUser = Identity.CurrentUser.UserName; Destination.ModifyDate = DateTime.Now; if (Type == DBOperateType.Insert) WcfServiceHelper.Client.InsertDestination(Destination); else WcfServiceHelper.Client.UpdateDestination(Destination); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } catch (Exception ex) { ControlsHelper.ShowErrorMessage("保存失败", ex.Message); } finally { this.Cursor = Cursors.Default; } }
public FrmDestinationEdit(DBOperateType type, CoDestination destination) { InitializeComponent(); Type = type; Destination = destination; }