/// <summary> /// Persist SOAP Result in DataBase /// </summary> /// <param name="SoapResult"></param> public bool PersistResult(ServicesATSoapResult pSoapResult) { bool result = false; try { //Always Add to SYS_SystemAuditAT Log SystemAuditATWSType systemAuditATWSType = (!_wayBillMode) ? SystemAuditATWSType.Document : SystemAuditATWSType.DocumentWayBill; var systemAuditATWS = new SYS_SystemAuditAT(GlobalFramework.SessionXpo) { Date = DateTime.Now, Type = systemAuditATWSType, PostData = _postData, ReturnCode = Convert.ToInt16(pSoapResult.ReturnCode), ReturnMessage = pSoapResult.ReturnMessage, ReturnRaw = pSoapResult.ReturnRaw, DocumentNumber = _documentMaster.DocumentNumber, ATDocCodeID = pSoapResult.ATDocCodeID, DocumentMaster = _documentMaster }; systemAuditATWS.Save(); //Always Add to FIN_DocumentFinanceMaster ATAudit _documentMaster.ATAudit.Add(systemAuditATWS); _documentMaster.Save(); //Assign OK Result if (pSoapResult.ReturnCode == "0") { //Assign to ATValidResult to Document Master _documentMaster.ATValidAuditResult = systemAuditATWS; //Assign ATDocCodeID if (_wayBillMode) { _documentMaster.ATDocCodeID = pSoapResult.ATDocCodeID; } //Disable Resend if Enabled (Used when document is Cancelled) if (_documentMaster.ATResendDocument) { _documentMaster.ATResendDocument = false; } //Override Default Document Date _documentMaster.MovementStartTime = _movementStartTime; _documentMaster.Save(); //Assign True to Result result = true; } } catch (Exception ex) { _log.Error(ex.Message, ex); } return(result); }
//5.3: FT: Cancel Invoice void buttonCancelInvoice_Clicked(object sender, EventArgs e) { string dateTimeFormatCombinedDateTime = SettingsApp.DateTimeFormatCombinedDateTime; Guid documentMasterGuid = new Guid("81fcf207-ff59-4971-90cb-80d2cbdb87dc");//Document To Cancel FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), documentMasterGuid); //Cancel Document documentFinanceMaster.DocumentStatusStatus = "A"; documentFinanceMaster.DocumentStatusDate = FrameworkUtils.CurrentDateTimeAtomic().ToString(dateTimeFormatCombinedDateTime); documentFinanceMaster.DocumentStatusReason = "Erro ao Inserir Artigos"; documentFinanceMaster.Save(); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //Invoices /// <summary> /// Increase DocumentNumber, used to Fake It, to always be valid /// </summary> /// <param name="DocumentNumber"></param> /// <returns></returns> public static string IncreaseDocumentNumber(FIN_DocumentFinanceMaster pDocumentMaster) { string result = string.Empty; try { string documentNumber = pDocumentMaster.DocumentNumber; string[] split = documentNumber.Split('/'); int number = Convert.ToInt16(split[1]) + 1; pDocumentMaster.DocumentNumber = string.Format("{0}/{1}", split[0], number); pDocumentMaster.Save(); } catch (Exception ex) { throw (ex); } return(result); }