private string SaveResponseSuccess(string message, string kindOfMessage) { Embarque embarque = new EmbarqueDao().FindBySbeln(RESPONSE.TGTESHK_N.SBELN, kindOfMessage); ConfigStatus.SaveStatus(RESPONSE.STATUS, embarque); TGTESHK_NDao dao = new TGTESHK_NDao(); IList <TGTESHK_N> list = dao.FindByIdEmbarqueLazy(embarque.ID); if (list.Count > 0) { dao.DeleteAll(list); } RESPONSE.TGTESHK_N.TGTESHP_N = RESPONSE.TGTESHP_N; RESPONSE.TGTESHK_N.TGTERES = RESPONSE.TGTERES; RESPONSE.TGTESHK_N.TGTEPRD = RESPONSE.TGTEPRD; RESPONSE.TGTESHK_N.SHP_TEXT = RESPONSE.SHP_TEXT; RESPONSE.TGTESHK_N.TGTEDUEK = RESPONSE.TGTEDUEK; RESPONSE.TGTESHK_N.TGTEDUEP = RESPONSE.TGTEDUEP; RESPONSE.TGTESHK_N.Embarque = embarque; RESPONSE.TGTESHK_N.TGTESHP_N.ForEach(t => t.Embarque = embarque); RESPONSE.TGTESHK_N.TGTERES.ForEach(t => t.Embarque = embarque); RESPONSE.TGTESHK_N.TGTEPRD.ForEach(t => t.Embarque = embarque); RESPONSE.TGTESHK_N.SHP_TEXT.ForEach(t => t.Embarque = embarque); RESPONSE.TGTESHK_N.TGTEDUEK.ForEach(t => t.Embarque = embarque); RESPONSE.TGTESHK_N.TGTEDUEP.ForEach(t => t.Embarque = embarque); dao.Save(RESPONSE.TGTESHK_N); return(MessagesOfReturn.ProcessMessageSuccess(message, embarque.SBELN)); }
private RequestMessage3Exportation GetObject(Embarque embarque, Cabecalho cabecalho, DadosBroker broker) { TGTESHK_N tgteshkn = new TGTESHK_NDao().FindByIdEmbarqueEager(embarque.ID).FirstOrDefault(); RequesExportationtMsg3 request = new RequesExportationtMsg3(); request.Type = cabecalho.RequestType; request.ACAO = cabecalho.ACAO; request.IDBR = broker.IDBR; request.IDCL = broker.IDCL; request.SHKEY = broker.SHKEY; request.STR = new STR(broker); request.TGTESHK_N = tgteshkn; if (request.TGTESHK_N != null) { request.TGTESHK_N.SBELN = embarque.SBELN; } request.TGTESHP_N = tgteshkn.TGTESHP_N; if (request.TGTESHP_N != null) { foreach (var tgteshpn in request.TGTESHP_N) { tgteshpn.SBELN = embarque.SBELN; } } request.TGTERES = tgteshkn.TGTERES; if (request.TGTERES != null) { foreach (var tgteres in request.TGTERES) { tgteres.SBELN = embarque.SBELN; } } request.TGTEPRD = tgteshkn.TGTEPRD; request.SHP_TEXT = tgteshkn.SHP_TEXT; request.TGTEDUEK = tgteshkn.TGTEDUEK; request.TGTEDUEP = tgteshkn.TGTEDUEP; RequestMessage3Exportation requestMessage3 = new RequestMessage3Exportation(); requestMessage3.EDX = cabecalho.MensagemEDX; requestMessage3.REQUEST = request; return(requestMessage3); }