protected override List <BaseIntegrationObject> ReadPack() { var pack = new List <BaseIntegrationObject>(); lock (_lock) { using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(_selectQuery, packSize)) { while (reader != null && reader.Read()) { pack.Add(new SMS() { ContactId = reader.GetValue("ContactId", String.Empty), ContactPhone = reader.GetValue("ContactPhone", String.Empty), MessageStatus = reader.GetValue("MessageStatus", String.Empty), SentDate = reader.GetValue("SentDate", String.Empty), ERPId = reader.GetValue("ERPId", String.Empty), Text = reader.GetValue("Text", String.Empty), Id = Guid.NewGuid(), }); } } } if (pack.Count > 0) { DBConnectionProvider.ExecuteNonQuery(String.Format("Update {1} Set Status = 3 Where ERPId in ({0})", String.Join(",", pack.Select(p => String.Format("'{0}'", p.CorrectERPId))), _tableName)); } } return(pack); }
protected override List <BaseIntegrationObject> ReadPack() { var pack = new List <BaseIntegrationObject>(); lock (_lock) { using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(_selectQuery, packSize)) { while (reader != null && reader.Read()) { pack.Add(new ProductCategory() { Name = reader.GetValue("name", String.Empty), ERPId = reader.GetValue("ERPId", String.Empty), Direction = reader.GetValue("Direction", String.Empty), Id = Guid.NewGuid(), }); } } } if (pack.Count > 0) { DBConnectionProvider.ExecuteNonQuery(String.Format("Update {1} Set Status = 3 Where ERPId in ({0})", String.Join(",", pack.Select(p => String.Format("'{0}'", p.CorrectERPId))), _tableName)); } } return(pack); }
protected override List <BaseIntegrationObject> ReadPack() { var pack = new List <BaseIntegrationObject>(); lock (_lock) { using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(_selectContact, packSize)) { while (reader != null && reader.Read()) { pack.Add(new Contact() { Address = reader.GetValue("address", String.Empty), City = reader.GetValue("City", String.Empty), Country = reader.GetValue("Country", String.Empty), ContactStatus = reader.GetValue("contactStatus", String.Empty), Email = reader.GetValue("email", String.Empty), ErrorMessage = reader.GetValue("errorMessage", String.Empty), FirstName = reader.GetValue("FirstName", String.Empty), MiddleName = reader.GetValue("MiddleName", String.Empty), Phone = reader.GetValue("Phone", String.Empty), RegistrationDate = reader.GetValue("RegistrationDate", String.Empty), CreatedOn = reader.GetValue("CreatedOn", String.Empty), BirthDay = reader.GetValue("birthday", String.Empty), ERPId = reader.GetValue("ERPId", String.Empty), Id = Guid.NewGuid(), Surname = reader.GetValue("Surname", String.Empty), ShopCode = reader.GetValue("ShopCode", String.Empty), SmrNearestMetroStation = reader.GetValue("SmrNearestMetroStation", String.Empty), BonusBalance = reader.GetValue("bonusBalance", 0m), IsMan = reader.GetValue("gender", false), PersDataProcAgreement = reader.GetValue("PersDataProcAgreement", false), RequiresCorrection = reader.GetValue("RequiresCorrection", false), ThereAreEmptyFields = reader.GetValue("ThereAreEmptyFields", String.Empty), Type = reader.GetValue("type", -1), }); } } } if (pack.Count > 0) { DBConnectionProvider.ExecuteNonQuery(String.Format("Update ContactGate Set Status = 3 Where ERPId in ({0})", String.Join(",", pack.Select(p => String.Format("'{0}'", p.CorrectERPId))))); } } return(pack); }
protected override List <BaseIntegrationObject> ReadPack() { var pack = new List <BaseIntegrationObject>(); lock (_lock) { using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(_selectQuery, packSize)) { while (reader != null && reader.Read()) { pack.Add(new Product() { Name = reader.GetValue("name", String.Empty), ERPId = reader.GetValue("ERPId", String.Empty), Category = reader.GetValue("category", String.Empty), Brand = reader.GetValue("Brand", String.Empty), BrandType = reader.GetValue("BrandType", String.Empty), Code = reader.GetValue("Code", String.Empty), Direction = reader.GetValue("Direction", String.Empty), Group = reader.GetValue("Group", String.Empty), Provider = reader.GetValue("Provider", String.Empty), Size = reader.GetValue("Size", String.Empty), SubCategory = reader.GetValue("SubCategory", String.Empty), IsArchived = reader.GetValue("IsArchived", false), RecommendedRetailPrice = reader.GetValue("RecommendedRetailPrice", 0m), Id = Guid.NewGuid(), }); } } } if (pack.Count > 0) { DBConnectionProvider.ExecuteNonQuery(String.Format("Update {1} Set Status = 3 Where ERPId in ({0})", String.Join(",", pack.Select(p => String.Format("'{0}'", p.CorrectERPId))), _tableName)); } } return(pack); }
private List <PaymentInPurchase> ReadPayments(string erpId) { var res = new List <PaymentInPurchase>(); using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(@"Select Type, Amount from PaymentsInPurchaseGate WITH(NOLOCK) Where PurchaseId = '{0}'", erpId)) { while (reader != null && reader.Read()) { res.Add(new PaymentInPurchase() { Amount = reader.GetValue("Amount", 0m), Type = reader.GetValue("Type", String.Empty), }); } } } return(res); }
protected override List <BaseIntegrationObject> ReadPack() { var pack = new List <BaseIntegrationObject>(); lock (_lock) { using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(_selectQuery, packSize)) { while (reader != null && reader.Read()) { pack.Add(new Purchase() { Number = reader.GetValue("Number", String.Empty), ERPId = reader.GetValue("ERPId", String.Empty), CardNumber = reader.GetValue("CardNumber", String.Empty), Amount = reader.GetValue("Amount", 0m), CashDeskCode = reader.GetValue("CashDeskCode", String.Empty), ContactId = reader.GetValue("ContactId", String.Empty), CreatedOn = reader.GetValue("CreatedOn", String.Empty), PaymentForm = reader.GetValue("PaymentForm", String.Empty), Phone = reader.GetValue("Phone", String.Empty), PurchaseDate = reader.GetValue("purchaseDateStr", String.Empty), PDate = reader.GetValue("purchaseDate", DateTime.MinValue), ShopCode = reader.GetValue("ShopCode", String.Empty), Id = Guid.NewGuid(), }); } } } if (pack.Count > 0) { DBConnectionProvider.ExecuteNonQuery(String.Format("Update {1} Set Status = 3 Where ERPId in ({0})", String.Join(",", pack.Select(p => String.Format("'{0}'", p.CorrectERPId))), _tableName)); } } return(pack); }
protected override List <BaseIntegrationObject> ReadPack() { var pack = new List <BaseIntegrationObject>(); lock (_lock) { using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(_selectContact, packSize)) { while (reader != null && reader.Read()) { pack.Add(new Card() { ActivationDate = reader.GetValue("activationDate", String.Empty), BlockedOn = reader.GetValue("blockedOn", String.Empty), BlockingReason = reader.GetValue("blockingReason", String.Empty), CardStatus = reader.GetValue("cardStatus", String.Empty), ContactId = reader.GetValue("contactId", String.Empty), ErrorMessage = reader.GetValue("errorMessage", String.Empty), IsMain = reader.GetValue("isMain", false), Number = reader.GetValue("number", String.Empty), CreatedOn = reader.GetValue("CreatedOn", String.Empty), ERPId = reader.GetValue("ERPId", String.Empty), Id = Guid.NewGuid() }); } } } if (pack.Count > 0) { DBConnectionProvider.ExecuteNonQuery(String.Format("Update {1} Set Status = 3 Where ERPId in ({0})", String.Join(",", pack.Select(p => String.Format("'{0}'", p.CorrectERPId))), _tableName)); } } return(pack); }
private List <ProductInPurchase> ReadProducts(string erpId) { var res = new List <ProductInPurchase>(); using (var provider = new DBConnectionProvider()) { using (var reader = provider.Execute(@"Select ProductCode, Price, Quantity, Amount from ProductsInPurchaseGate WITH(NOLOCK) Where PurchaseId = '{0}'", erpId)) { while (reader != null && reader.Read()) { res.Add(new ProductInPurchase() { Amount = reader.GetValue("Amount", 0m), Price = reader.GetValue("Price", 0m), Quantity = reader.GetValue("Quantity", 0), ProductCode = reader.GetValue("ProductCode", String.Empty), }); } } } return(res); }