private void createCardOrderRequestEntity(C____REQ002 item) { CardOrderRequest pomCor = new CardOrderRequest(); var pomSlaDeadLine = ""; if (item.request_status == 3) { pomSlaDeadLine = ""; } else if (item.request_status == 1 || item.request_status == 2) { pomSlaDeadLine = item.sla_deadline == null ? "todo" : item.sla_deadline.Value.Date.ToString("dd.MM.yyyy"); } else if (item.request_status == null || item.request_status == 4) { pomSlaDeadLine = "SLA NOT SET YET"; } pomCor.CardTypeId = item.card_type_id; pomCor.Content = item.content; pomCor.CardCount = item.card_count; pomCor.CarrierTypeId = item.carrier_type_id; pomCor.EnvelopeTypeId = item.envelope_type_id; pomCor.PlasticTypeId = item.plastic_type_id; pomCor.AttachementId = item.attachement_id; pomCor.PackageAttachementId = item.package_attachement_id; pomCor.ValidTo = item.valid_to.Value.Date.ToString("dd.MM.yyyy"); pomCor.CreationDateTime = item.creation_datetime; pomCor.ID = item.id; pomCor.LastUpdate = item.last_update; pomCor.PartnerId = item.partner_id; pomCor.PartnerRequestId = item.partner_request_id; pomCor.RequestID = item.request_id; pomCor.RequestStatus = item.request_status; pomCor.StatusFinal = item.status_final; pomCor.SlaDeadLine = pomSlaDeadLine; pomCor.IsProcessing = item.is_processing; pomCor.OrderType = item.partner_request_id; pomCor.DeliveryListId = item.delivery_list_id; m_req002.Add(pomCor); }
/// <summary> /// get the first <card_id> from from item.content /// get the creation_datetime from item.creation_datetime /// loop in rewardo [CARD] table where card.insert_date >= creation_datetime && card.crm_id == <card_id> /// </summary> /// <param name="item"></param> /// <returns></returns> private bool orderIsProcessing(CardOrderRequest item) { // initialization of [REWARDO].[CARD] table m_rewardoDAL = new RewardoDAL(); var pomRewardoCards = m_rewardoDAL.getCardsFromRW(); // get the first <card_id> from from item.content var xelement = XElement.Parse(item.Content); var firstXMLCardIdElementValue = Convert.ToInt64(xelement.Element("card").Element("card_id").Value); // get the creation_datetime from item.creation_datetime var creationDatetime = item.CreationDateTime; // loop in rewardo[CARD] table where card.insert_date >= creation_datetime && card.crm_id == < card_id > var pom = false; var i = 0; while (pom == false && i < pomRewardoCards.Count) { pom = pomRewardoCards.Where(x => x.InsertDate >= creationDatetime && x.CardCRMId == firstXMLCardIdElementValue).Select(x => x).FirstOrDefault() == null ? false : true; i += 1; } return(pom); }