/// <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; } } }
private string getRequestedStateIDDescription(string partnerName, short?requestedStateId) { if (m_cardnetDAL.getConstantPartner() == null) { m_cardnetDAL.retrieveConstantPartners(); } var pomPartnerCode = m_cardnetDAL.getPartners().Where(p => p.OrganizationName == partnerName).First().Code; var requestedStateIdConstantValue = m_cardnetDAL.getConstantPartner().Where(c => c.PartnerName == partnerName && c.ConstantName == "CardStatusUpdateRequestedStateId" && c.ConstantValue == pomPartnerCode + "_CSU" + requestedStateId).First().ConstantDescription; // z CONSTANT_PARTNER ziskaj na zaklade partnername a requestedStateid danu hodnotu return(requestedStateIdConstantValue); }
// interface method public void retrieveRequests() { // retrieve card order requests from db into @m_req002 var pomList = m_cardnetDAL.getCardnetDB().C____REQ001.OrderByDescending(o => o.creation_datetime).ToList(); m_req001 = new List <PosAcceptanceRequest>(); foreach (var item in pomList) { PosAcceptanceRequest posrVM = new PosAcceptanceRequest(); try { posrVM.AnswerDateTime = item.answer_datetime; posrVM.CreationDateTime = item.creation_datetime; posrVM.ExternalTerminalId = item.external_terminal_id; posrVM.ID = item.id; posrVM.NewAcceptState = item.new_accept_state == true ? "ACTIVE" : "PASSIVE"; posrVM.PartnerName = m_cardnetDAL.getPartners().Where(p => p.ID == item.partner_id).Select(p => p.OrganizationName).First() /* item.partner_id*/; posrVM.PartnerRequestId = item.partner_request_id; posrVM.RequestId = item.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 } posrVM.RequestStatus = pomRequestStatus; posrVM.TerminalTypeId = item.terminal_type_id; posrVM.AccountTypeId = item.ACCOUNT_TYPE_ID; var pom = m_cardnetDAL.getConstantPartner().Where(p => p.PartnerName == posrVM.PartnerName && p.ConstantName == "AccountTypeId" && p.ConstantValue.Substring(12) == item.ACCOUNT_TYPE_ID.ToString()).Select(p => p.ConstantDescription).FirstOrDefault(); posrVM.AccountTypeIdNAME = pom == null ? "ERROR" : pom; m_req001.Add(posrVM); } catch (Exception ex) { throw; } } }
public void markAsSent(long id) { var cardOrderRequest = (from item in m_cardnetDAL.getCardOrderRequests() where item.ID == id select item).First(); initWebConfigFileMembers(); var pomRequestId = cardOrderRequest.RequestID; var pomPartnerId = cardOrderRequest.PartnerId; // 1. // SELECT code // FROM m_partners // WHERE id == pomPartnerId var pomPartnerCode = m_cardnetDAL.getPartners().Where(x => x.ID == pomPartnerId).Select(x => x.Code).First(); // 2. // var pomTableName = ANS+code+002 // INSERT INTO pomTableName (request_id, change_time, request_status) // VALUES (pomRequestId, DateTime.Now, 2) var pomTableName = "[dbo].[ANS" + pomPartnerCode.ToUpper() + "002]"; var pomDatetime = DateTime.Now; string queryString = String.Format("INSERT INTO {0} (request_id, request_status) VALUES ({1}, 2)", pomTableName, pomRequestId); string connectionString = "Server=" + m_cnServerIP + ";Database=" + m_cnDbName + ";User Id=" + m_cnDbUsername + ";Password="******";"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Parameters.AddWithValue("@pomRequestId", pomRequestId); command.Parameters.AddWithValue("@pomDatetime", pomDatetime); connection.Open(); command.ExecuteNonQuery(); } // WAREHOUSING EXCEL FILE GENERATION ExcelEngine excelEngine = new ExcelEngine(); var lastExcelFileName = "";//excelEngine.GetLastExcelFileName(WebConfigurationManager.AppSettings["warehousing_folder"]+DateTime.Now.Year); var destinationPath = WebConfigurationManager.AppSettings["warehousing_folder"]; var fileName = WebConfigurationManager.AppSettings["warehousing_file_prefix"] + id; excelEngine.CreateExcelFile(lastExcelFileName, destinationPath, fileName); // 1. ziskaj z danej objednavky vsetky potrebne materialy a k nim prislusne pocty // 2. uprav pocty materialov v novo vytvorenom excelovskom dokumente }
// 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); } }