Exemple #1
0
        /// <summary>
        /// Interface method
        /// </summary>
        public void retrieveRequests()
        {
            // retrieve card order requests from db into @m_req002
            var pomList = m_cardnetDAL.getCardnetDB().C____REQ008.OrderByDescending(o => o.CREATION_DATETIME).ToList();

            m_req008 = new List <CardTransferRequest>();

            foreach (var item in pomList)
            {
                CardTransferRequest ctr = new CardTransferRequest();
                try
                {
                    ctr.BalanceTransfer       = item.BALANCE_TRANSFER == true ? "YES" : "NO";
                    ctr.BonusTransfer         = item.BONUS_TRANSFER == true ? "YES" : "NO";
                    ctr.CardnoFrom            = item.CARDNO_FROM;
                    ctr.CardnoFromFinalStatus = m_cardnetDAL.getConstantUniversals().Where(c => c.ConstantName == "cardno_from_final_status" && c.ConstantValue == item.CARDNO_FROM_FINAL_STATUS).Select(c => c.ConstantDescription).FirstOrDefault();
                    ctr.CardnoTo         = item.CARDNO_TO;
                    ctr.Content          = item.CONTENT;
                    ctr.CreationDateTime = item.CREATION_DATETIME;
                    ctr.ID               = item.ID;
                    ctr.IsProcessing     = item.IS_PROCESSING;
                    ctr.LastUpdateDate   = item.LAST_UPDATE;
                    ctr.PartnerId        = item.PARTNER_ID;
                    ctr.PartnerName      = m_cardnetDAL.getPartners().Where(p => p.ID == item.PARTNER_ID).Select(p => p.OrganizationName).First();
                    ctr.PartnerRequestId = item.PARTNER_REQUEST_ID;
                    ctr.RequestId        = item.REQUEST_ID;

                    var pomRequestStatus = "";
                    if (item.REQUEST_STATUS == 1)
                    {
                        pomRequestStatus = "SUCCEEDED";
                    }
                    else if (item.REQUEST_STATUS == 0)
                    {
                        pomRequestStatus = "DECLINED";
                    }
                    else
                    {
                        pomRequestStatus = "null"; // nemalo by sa stat nikdy
                    }
                    ctr.RequestStatus          = pomRequestStatus;
                    ctr.SlaDeadline            = item.SLA_DEADLINE;
                    ctr.Succesfull             = item.SUCCESSFULL;
                    ctr.TransferCase           = m_cardnetDAL.getConstantUniversals().Where(c => c.ConstantName == "transfer_case" && c.ConstantValue == item.TRANSFER_CASE).Select(c => c.ConstantDescription).First();
                    ctr.TransferType           = m_cardnetDAL.getConstantUniversals().Where(c => c.ConstantName == "transfer_type" && c.ConstantValue == item.TRANSFER_TYPE).Select(c => c.AdditionalValue).First();
                    ctr.AccountTypeId          = item.ACCOUNT_TYPE_ID;
                    ctr.AccountTypefinalStatus = item.ACCOUNT_TYPE_FINAL_STATUS;

                    var pom = m_cardnetDAL.getConstantPartner().Where(p => p.PartnerName == ctr.PartnerName && p.ConstantName == "AccountTypeId" && p.ConstantValue.Substring(12) == item.ACCOUNT_TYPE_ID.ToString()).Select(p => p.ConstantDescription).FirstOrDefault();
                    ctr.AccountTypeIdName = pom == null ? "ERROR" : pom;

                    m_req008.Add(ctr);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Exemple #2
0
        // interface method
        public void retrieveRequests()
        {
            // retrieve card order requests from db into @m_req002
            var pomList = m_cardnetDAL.getCardnetDB().C____REQ003.OrderByDescending(o => o.creation_datetime).ToList();

            m_req003 = new List <CreditOrderRequest>();

            foreach (var item in pomList)
            {
                CreditOrderRequest cror = new CreditOrderRequest();

                cror.AnswerDateTime   = item.answer_datetime;
                cror.CreationDateTime = item.creation_datetime;
                cror.ExternalCardId   = item.external_card_id;
                cror.ID               = item.id;
                cror.PartnerName      = m_cardnetDAL.getPartners().Where(p => p.ID == item.partner_id).Select(p => p.OrganizationName).First() /* item.partner_id*/;
                cror.PartnerRequestId = item.partner_request_id;

                var pomRequestStatus = "";
                if (item.request_status == true)
                {
                    pomRequestStatus = "SUCCEEDED";
                }
                else if (item.request_status == false)
                {
                    pomRequestStatus = "DECLINED";
                }
                else
                {
                    pomRequestStatus = "null"; // nemalo by sa stat nikdy
                }
                cror.RequestStatus     = pomRequestStatus;
                cror.TransactionAmount = item.transaction_amount;
                cror.TransactionType   = m_cardnetDAL.getConstantUniversals().Where(cst => cst.ConstantName == "transaction_type" && cst.ConstantValue == item.transaction_type).Select(cst => cst.ConstantDescription).First();
                cror.RequestId         = item.request_id;
                cror.AccountTypeId     = item.ACCOUNT_TYPE_ID;

                var pom = m_cardnetDAL.getConstantPartner().Where(p => p.PartnerName == cror.PartnerName && p.ConstantName == "AccountTypeId" && p.ConstantValue.Substring(12) == item.ACCOUNT_TYPE_ID.ToString()).Select(p => p.ConstantDescription).FirstOrDefault();
                cror.AccountTypeIdName = pom == null ? "ERROR" : pom;

                m_req003.Add(cror);
            }
        }
Exemple #3
0
        public CardOrderViewModel createAndReturnNewCardOrderViewModel(short?cardTypeId, string content, DateTime?creationDateTime, long id, string message, int?partnerId, string partnerRequestId,
                                                                       long?requestId, int?cardCount, string carrierTypeId1, string envelopeTypeId, string plasticTypeId, string attachementId, string packageAttachementId, int?requestStatus, DateTime?lastUpdate, string slaDeadLine, bool?statusFinal, string validTo,
                                                                       bool?isProcessing, string validStatusDate, string receivedStatusDate, string declinedStatusDate, string sentStatusDate, string successfullyCanceledStatusDate, string unsuccessfullyCanceledStatusDate, string rowColor, string orderType, string deliveryListId)
        {
            CardOrderViewModel covm = new CardOrderViewModel();

            covm.CardTypeId = cardTypeId;

            var pomCardType = rwEngine.getRewardoDAL().getCardProductsFromRW().Where(ct => ct.CardProductID == cardTypeId).Select(ct => ct.CardProductName).FirstOrDefault();

            covm.CardTypeName     = pomCardType == null ? "DOESN'T EXIST (" + cardTypeId.ToString() + ")" : pomCardType;
            covm.Content          = content;
            covm.CreationDateTime = creationDateTime;
            covm.ID = id;
            var pom1 = (from item1 in m_cardnetDAL.getCardOrderAnswers() where item1.PartnerId == partnerId && item1.RequestId == requestId select item1.Message).LastOrDefault();

            covm.Message          = pom1 == null ? "" : pom1.ToString();
            covm.PartnerId        = partnerId;
            covm.PartnerName      = m_cardnetDAL.getPartners().Where(p => p.ID == partnerId).Select(p => p.OrganizationName).First(); // TODO
            covm.PartnerRequestId = partnerRequestId;
            covm.RequestID        = requestId;
            covm.CardCount        = cardCount;

            covm.CarrierTypeId        = carrierTypeId1 == null ? "NULL" : m_cardnetDAL.getConstantPartner().Where(c => c.PartnerId == partnerId && c.ConstantName == "CarrierTypeId" && c.ConstantValue == carrierTypeId1).Select(c => c.ConstantDescription).First();                    // TODO
            covm.EnvelopeTypeId       = envelopeTypeId == null ? "NULL" : m_cardnetDAL.getConstantPartner().Where(c => c.PartnerId == partnerId && c.ConstantName == "EnvelopeTypeId" && c.ConstantValue == envelopeTypeId).Select(c => c.ConstantDescription).First();                   // TODO;
            covm.PlasticTypeId        = plasticTypeId == null ? "NULL" : m_cardnetDAL.getConstantPartner().Where(c => c.PartnerId == partnerId && c.ConstantName == "PlasticTypeId" && c.ConstantValue == plasticTypeId).Select(c => c.ConstantDescription).First();                      // TODO;
            covm.AttachementId        = attachementId == null ? "NULL" : m_cardnetDAL.getConstantPartner().Where(c => c.PartnerId == partnerId && c.ConstantName == "AttachementId" && c.ConstantValue == attachementId).Select(c => c.ConstantDescription).First();                      // TODO;
            covm.PackageAttachementId = packageAttachementId == null ? "NULL" : m_cardnetDAL.getConstantPartner().Where(c => c.PartnerId == partnerId && c.ConstantName == "PackageAttachementId" && c.ConstantValue == packageAttachementId).Select(c => c.ConstantDescription).First(); // TODO;

            covm.CarrierTypeIdConstantValue        = carrierTypeId1;
            covm.EnvelopeTypeIdConstantValue       = envelopeTypeId;
            covm.PlasticTypeIdConstantValue        = plasticTypeId;
            covm.AttachementIdConstantValue        = attachementId;
            covm.PackageAttachementIdConstantValue = packageAttachementId;
            covm.DeliveryListIdConstantValue       = deliveryListId;

            covm.OrderType            = orderType.Substring(0, 3) == "CAN" ? partnerRequestId : "normal";
            covm.RequestStatus        = requestStatus;
            covm.RequestStatusName    = requestStatus == null ? "INSERTED" : m_cardnetDAL.getConstantUniversals().Where(c => c.ConstantName == "card_order_state" && c.ConstantValue == requestStatus).Select(c => c.ConstantDescription).First(); // TODO
            covm.LastUpdate           = lastUpdate;
            covm.SlaDeadLine          = slaDeadLine;
            covm.StatusFinal          = statusFinal;
            covm.ValidTo              = validTo;
            covm.isProcessing         = true;
            covm.TriggerOnLoad        = false;
            covm.TriggerOnLoadMessage = "";

            var pomValidStatusDate = (from answer in m_cardnetDAL.getCardOrderAnswers()
                                      where answer.PartnerId == partnerId && answer.RequestId == requestId && answer.RequestStatus == 4
                                      select answer.ChangeDateTime).FirstOrDefault();

            covm.ValidStatusDate = pomValidStatusDate == null ? "todo" : pomValidStatusDate.ToString();


            var pomReceivedStatusDate = (from answer in m_cardnetDAL.getCardOrderAnswers()
                                         where answer.PartnerId == partnerId && answer.RequestId == requestId && answer.RequestStatus == 1
                                         select answer.ChangeDateTime).FirstOrDefault();

            covm.ReceivedStatusDate = pomReceivedStatusDate == null ? "todo" : pomReceivedStatusDate.ToString();

            var pomDeclinedStatusDate = (from answer in m_cardnetDAL.getCardOrderAnswers()
                                         where answer.PartnerId == partnerId && answer.RequestId == requestId && answer.RequestStatus == 3
                                         select answer.ChangeDateTime).FirstOrDefault();

            covm.DeclinedStatusDate = pomDeclinedStatusDate == null ? "todo" : pomDeclinedStatusDate.ToString();

            var pomSendStatusDate = (from answer in m_cardnetDAL.getCardOrderAnswers()
                                     where answer.PartnerId == partnerId && answer.RequestId == requestId && answer.RequestStatus == 2
                                     select answer.ChangeDateTime).FirstOrDefault();

            covm.SentStatusDate = pomSendStatusDate == null ? "todo" : pomSendStatusDate.ToString();

            // TODO cancel
            var pomsuccessfullyCanceledStatusDate = (from answer in m_cardnetDAL.getCardOrderAnswers()
                                                     where answer.PartnerId == partnerId && answer.RequestId == requestId && answer.RequestStatus == 5
                                                     select answer.ChangeDateTime).FirstOrDefault();

            covm.CanceledStatusDate = pomsuccessfullyCanceledStatusDate == null ? "todo" : pomsuccessfullyCanceledStatusDate.ToString();

            var pomunsuccessfullyCanceledStatusDate = (from answer in m_cardnetDAL.getCardOrderAnswers()
                                                       where answer.PartnerId == partnerId && answer.RequestId == requestId && answer.RequestStatus == 6
                                                       select answer.ChangeDateTime).FirstOrDefault();

            covm.CancelDeclinedStatusDate = pomunsuccessfullyCanceledStatusDate == null ? "todo" : pomunsuccessfullyCanceledStatusDate.ToString();

            covm.RowColor = rowColor;

            if (orderType.Substring(0, 3) != "CAN" && covm.RequestStatusName == "CANCEL RECEIVED")
            {
                covm.RequestStatusName = "CANCELED";
            }

            covm.DeliveryListId = deliveryListId == null ? "NULL" : m_cardnetDAL.getConstantPartner().Where(c => c.PartnerId == partnerId && c.ConstantName == "DeliveryListId" && c.ConstantValue == deliveryListId).Select(c => c.ConstantDescription).First();

            covm.CardOrderDetailsPhotoGallery.AddPhotoNameToList(carrierTypeId1);
            covm.CardOrderDetailsPhotoGallery.AddPhotoNameToList(envelopeTypeId);
            covm.CardOrderDetailsPhotoGallery.AddPhotoNameToList(attachementId);
            covm.CardOrderDetailsPhotoGallery.AddPhotoNameToList(packageAttachementId);
            covm.CardOrderDetailsPhotoGallery.AddPhotoNameToList(deliveryListId);
            covm.CardOrderDetailsPhotoGallery.AddPhotoNameToList(plasticTypeId);

            return(covm);
        }