private void cmdVerify_Click(object sender, RoutedEventArgs e) { Boolean r = SaveToView(); if (!r) { return; } CUtil.EnableForm(false, this); vw.DocumentType = ((int)dt).ToString(); CTable t = OnixWebServiceAPI.VerifyAccountDoc(vw.GetDbObject().Clone()); CUtil.EnableForm(true, this); if (t != null) { MInventoryDoc ivd = new MInventoryDoc(t); ivd.InitErrorItem(); if (ivd.ErrorItems.Count > 0) { WinErrorDetails w = new WinErrorDetails(ivd.ErrorItems, "InventoryDoc"); w.Title = CLanguage.getValue("approve_error"); w.ShowDialog(); } else { String msg = CLanguage.getValue("VERIFY_SUCCESS"); CMessageBox.Show(msg, "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information); } } }
protected Boolean approveData() { if (!CHelper.VerifyAccessRight(accessRightName)) { return(false); } if (!validateData()) { return(false); } CUtil.EnableForm(false, this); CTable newobj = OnixWebServiceAPI.SubmitObjectAPI(approveAPIName, vw.GetDbObject()); CUtil.EnableForm(true, this); if (newobj == null) { //Error here CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null); return(false); } MInventoryDoc vcd = new MInventoryDoc(newobj); vcd.InitErrorItem(); if (vcd.ErrorItems.Count > 0) { WinErrorDetails w = new WinErrorDetails(vcd.ErrorItems, "InventoryDoc"); w.Title = CLanguage.getValue("approve_error"); w.ShowDialog(); return(false); } if (loadParam.Mode.Equals("A")) { vw.SetDbObject(newobj); loadParam.ParentItemSources.Insert(0, vw); } else { loadParam.ActualView.SetDbObject(newobj); loadParam.ActualView.NotifyAllPropertiesChanged(); } return(true); }
private Boolean SaveData() { if (!CHelper.VerifyAccessRight("SALE_VOID_EDIT")) { return(false); } //if (!vw.IsModified) //{ // return (true); //} Boolean result = SaveToView(); if (!result) { return(false); } CUtil.EnableForm(false, this); CTable t = OnixWebServiceAPI.ApproveVoidedDoc(vw.GetDbObject()); CUtil.EnableForm(true, this); if (t != null) { MInventoryDoc ivd = new MInventoryDoc(t); ivd.InitErrorItem(); if (ivd.ErrorItems.Count > 0) { WinErrorDetails w = new WinErrorDetails(ivd.ErrorItems, "InventoryDoc"); w.Title = CLanguage.getValue("approve_error"); w.ShowDialog(); return(false); } else { accDoc.SetDbObject(t); accDoc.NotifyAllPropertiesChanged(); return(true); } } CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_EDIT", null); CUtil.EnableForm(true, this); return(false); }
protected Boolean verifyData() { if (!validateData()) { return(false); } CUtil.EnableForm(false, this); CTable newobj = OnixWebServiceAPI.SubmitObjectAPI(verifyAPIName, vw.GetDbObject()); CUtil.EnableForm(true, this); if (newobj == null) { //Error here CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null); return(false); } MInventoryDoc vcd = new MInventoryDoc(newobj); vcd.InitErrorItem(); if (vcd.ErrorItems.Count > 0) { WinErrorDetails w = new WinErrorDetails(vcd.ErrorItems, "InventoryDoc"); w.Title = CLanguage.getValue("approve_error"); w.ShowDialog(); return(false); } else { String msg = CLanguage.getValue("VERIFY_SUCCESS"); CMessageBox.Show(msg, "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information); } return(true); }
private Boolean SaveData(String approveFlag) { if (!CHelper.VerifyAccessRight(getAccessRightEdit())) { return(false); } vw.RefDocDate = vw.DocumentDate; vw.DocumentType = ((int)dt).ToString(); vw.ConstructWhDefinitionFromCrDr(); vw.CalculateARAmountForDrCr(); if (approveFlag.Equals("Y")) { Boolean result = SaveToView(); if (!result) { return(false); } CUtil.EnableForm(false, this); CTable t = OnixWebServiceAPI.ApproveAccountDoc(vw.GetDbObject().Clone()); CUtil.EnableForm(true, this); if (t != null) { MInventoryDoc vcd = new MInventoryDoc(t); vcd.InitErrorItem(); if (vcd.ErrorItems.Count > 0) { WinErrorDetails w = new WinErrorDetails(vcd.ErrorItems, "InventoryDoc"); w.Title = CLanguage.getValue("approve_error"); w.ShowDialog(); } else { if (Mode.Equals("A")) { vw.SetDbObject(t); vw.DocumentStatus = ((int)CashDocumentStatus.CashDocApproved).ToString(); (vw as MAccountDoc).NotifyAllPropertiesChanged(); if (itemAddedHandler != null) { itemAddedHandler(vw, null); } else { //Will be obsoleted soon parentItemsSource.Insert(0, vw); } } else if (Mode.Equals("E")) { actualView.SetDbObject(t); actualView.DocumentStatus = ((int)CashDocumentStatus.CashDocApproved).ToString(); (actualView as MAccountDoc).NotifyAllPropertiesChanged(); } vw.IsModified = false; this.Close(); } } } else if (Mode.Equals("A")) { if (SaveToView()) { CUtil.EnableForm(false, this); vw.DocumentStatus = ((int)CashDocumentStatus.CashDocPending).ToString(); CTable newobj = OnixWebServiceAPI.CreateAccountDoc(vw.GetDbObject()); CUtil.EnableForm(true, this); if (newobj != null) { vw.SetDbObject(newobj); if (itemAddedHandler != null) { itemAddedHandler(vw, null); } else { //Will be obsoleted soon parentItemsSource.Insert(0, vw); } return(true); } //Error here 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.UpdateAccountDoc(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); }