public BATCH_ARTICLE BATCH_ARTICLE_NEW(AFN_LOTE_ARTICULOS lote_old) { var lote_new = new BATCH_ARTICLE(); lote_new.aproval_state_id = EstadoAprobacion.ByCode(lote_old.estado_aprov).id; lote_new.descrip = lote_old.descripcion; lote_new.purchase_date = (DateTime)lote_old.fecha_compra; lote_new.initial_price = (decimal)lote_old.precio_inicial; lote_new.initial_life_time = (int)lote_old.vida_util_inicial; lote_new.account_date = (DateTime)lote_old.fecha_ing; lote_new.origin_id = origenes.ByCode(lote_old.origen).id; lote_new.type_asset_id = Tipos.ByDescrip(lote_old.consistencia).id; //Analizo documento a migrar if (lote_old.num_doc != DOCUMENTS.defaultDocument) { var new_doc = DOCUMENT_NEW_PREV(lote_old); var new_rel = new DOCS_BATCH(); new_rel.DOCUMENT = new_doc; new_rel.BATCHS_ARTICLES = lote_new; _context.DOCS_BATCH.AddObject(new_rel); } else { //ingreso solo lote, sin documento asociado _context.BATCHS_ARTICLES.AddObject(lote_new); } _context.SaveChanges(); _load_batches_articles(); return(lote_new); }