private void LoadData() { cboProduct.Focus(); CTable t = new CTable(""); vw = new MProject(t); vw.CreateDefaultValue(); DataContext = vw; CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable m = OnixWebServiceAPI.SubmitObjectAPI("GetProjectInfo", actualView.GetDbObject()); if (m != null) { vw.SetDbObject(m); vw.NotifyAllPropertiesChanged(); } } vw.IsModified = false; CUtil.EnableForm(true, this); }
private Boolean SaveData() { if (!CHelper.VerifyAccessRight("SASS_PROJECT_EDIT")) { return(false); } vw.ProjectGroup = projectGroup.MasterID; vw.ProjectGroupName = projectGroup.Description; if (Mode.Equals("A")) { if (SaveToView()) { CUtil.EnableForm(false, this); CTable newobj = OnixWebServiceAPI.SubmitObjectAPI("CreateProject", vw.GetDbObject()); CUtil.EnableForm(true, this); if (newobj != null) { vw.SetDbObject(newobj); parentItemsSource.Insert(0, vw); return(true); } CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null); return(false); } } else if (Mode.Equals("E")) { if (vw.IsModified) { Boolean result = SaveToView(); if (result) { CUtil.EnableForm(false, this); CTable t = OnixWebServiceAPI.SubmitObjectAPI("UpdateProject", vw.GetDbObject()); CUtil.EnableForm(true, this); if (t != null) { actualView.SetDbObject(t); actualView.NotifyAllPropertiesChanged(); return(true); } CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_EDIT", null); } return(false); } return(true); } return(false); }