Ejemplo n.º 1
0
        public int Create(string sourceConnectionString, string destinationConnectionString, string vocabularyConnectionString, Vendors vendor)
        {
            using (var connection = SqlConnectionHelper.OpenConnection(connectionString))
             {
            const string query = "INSERT INTO [dbo].[BuildingSettings] " +
                                 "([SourceConnectionString] " +
                                 ",[DestinationConnectionString] " +
                                 ",[VocabularyConnectionString] " +
                                 ",[Vendor]) " +
                                 "VALUES " +
                                 "(@sourceConnectionString " +
                                 ",@destinationConnectionString " +
                                 ",@vocabularyConnectionString " +
                                 ",@vendor);Select Scope_Identity();";

            using (var cmd = new SqlCommand(query, connection))
            {
               cmd.Parameters.Add("@sourceConnectionString", SqlDbType.VarChar);
               cmd.Parameters["@sourceConnectionString"].Value = sourceConnectionString;

               cmd.Parameters.Add("@destinationConnectionString", SqlDbType.VarChar);
               cmd.Parameters["@destinationConnectionString"].Value = destinationConnectionString;

               cmd.Parameters.Add("@vocabularyConnectionString", SqlDbType.VarChar);
               cmd.Parameters["@vocabularyConnectionString"].Value = vocabularyConnectionString;

               cmd.Parameters.Add("@vendor", SqlDbType.VarChar);
               cmd.Parameters["@vendor"].Value = vendor.ToString();

               cmd.CommandTimeout = 30000;
               return Convert.ToInt32(cmd.ExecuteScalar());
            }
             }
        }
Ejemplo n.º 2
0
        private static Type GetBuilderType(Vendors vendor)
        {
            switch (vendor)
             {
            case Vendors.Truven:
               return typeof(TruvenPersonBuilder);

            case Vendors.Optum:
               return typeof(OptumPersonBuilder);

            case Vendors.Cprd:
               return typeof(CprdPersonBuilder);

            case Vendors.Premier:
               return typeof(PremierPersonBuilder);

            case Vendors.DrugEra:
               return typeof(DrugEraPersonBuilder);

            case Vendors.Nhanes:
               return typeof(NhanesPersonBuilder);

             }

             return typeof(PersonBuilder);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new instance of <see cref="VendorUserControl"/>.
 /// </summary>
 public VendorUserControl()
 {
     InitializeComponent();
     m_dataContext = new Vendors(25);
     m_dataContext.PropertyChanged += ViewModel_PropertyChanged;
     this.DataContext = m_dataContext;
 }
Ejemplo n.º 4
0
 private void OnRemoveVendor(Vendor vendor)
 {
     try
     {
         Vendors.Remove(vendor);
         RemoveVendor(vendor);
     }
     catch (Exception ex)
     {
         WpfMessageBox.ShowDialog("Data Error", ex.Message, MessageBoxButton.OK, MessageIcon.Error);
     }
 }
        public async Task <IHttpActionResult> PostVendors(Vendors vendors)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Vendors.Add(vendors);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = vendors.Id }, vendors));
        }
Ejemplo n.º 6
0
 public void Update(DestinyFactionDefinition?other)
 {
     if (other is null)
     {
         return;
     }
     if (!DisplayProperties.DeepEquals(other.DisplayProperties))
     {
         DisplayProperties.Update(other.DisplayProperties);
         OnPropertyChanged(nameof(DisplayProperties));
     }
     if (ProgressionHash != other.ProgressionHash)
     {
         ProgressionHash = other.ProgressionHash;
         OnPropertyChanged(nameof(ProgressionHash));
     }
     if (!TokenValues.DeepEqualsDictionaryNaive(other.TokenValues))
     {
         TokenValues = other.TokenValues;
         OnPropertyChanged(nameof(TokenValues));
     }
     if (RewardItemHash != other.RewardItemHash)
     {
         RewardItemHash = other.RewardItemHash;
         OnPropertyChanged(nameof(RewardItemHash));
     }
     if (RewardVendorHash != other.RewardVendorHash)
     {
         RewardVendorHash = other.RewardVendorHash;
         OnPropertyChanged(nameof(RewardVendorHash));
     }
     if (!Vendors.DeepEqualsList(other.Vendors))
     {
         Vendors = other.Vendors;
         OnPropertyChanged(nameof(Vendors));
     }
     if (Hash != other.Hash)
     {
         Hash = other.Hash;
         OnPropertyChanged(nameof(Hash));
     }
     if (Index != other.Index)
     {
         Index = other.Index;
         OnPropertyChanged(nameof(Index));
     }
     if (Redacted != other.Redacted)
     {
         Redacted = other.Redacted;
         OnPropertyChanged(nameof(Redacted));
     }
 }
Ejemplo n.º 7
0
 public bool DeepEquals(DestinyFactionDefinition?other)
 {
     return(other is not null &&
            (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) &&
            ProgressionHash == other.ProgressionHash &&
            TokenValues.DeepEqualsDictionaryNaive(other.TokenValues) &&
            RewardItemHash == other.RewardItemHash &&
            RewardVendorHash == other.RewardVendorHash &&
            Vendors.DeepEqualsList(other.Vendors) &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Ejemplo n.º 8
0
        /**********************************************************************************************
         * Method: IActionIndex RegisterUser()
         *
         * Purpose: Register a user from form fields
         *          supplied by the user.
         *
         * Parameters: User user-> user information provided from request
         *             string companyName -> companyName of the vendor
         *
         * Returns: To Index once user has be registered and added to database.
         *
         * **********************************************************************************************/
        public IActionResult RegisterUser(Users user, string companyName)
        {
            _context.Users.Add(user);
            _context.SaveChanges();
            short   id     = (from u in _context.Users where u.user_name == user.user_name && u.first_name == user.first_name select u.id).FirstOrDefault();
            Vendors vendor = new Vendors();

            vendor.fk_user      = id;
            vendor.company_name = companyName;
            _context.Vendors.Add(vendor);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 9
0
        public ActionResult Create(int vendorId, string orderDescription, double orderPrice)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Vendors foundVendors = Vendors.Find(vendorId);
            Orders  newOrder     = new Orders(orderDescription, orderPrice);

            foundVendors.AddOrder(newOrder);
            List <Orders> vendorsOrders = foundVendors.Orders;

            model.Add("orders", vendorsOrders);
            model.Add("vendors", foundVendors);
            return(View("show", model));
        }
Ejemplo n.º 10
0
        public async Task<IActionResult> Edit(int Id, Vendors vendor)
        {
            if (Id != vendor.Id)
                return NotFound();

            if (ModelState.IsValid)
            {
                _db.Update(vendor);
                await _db.SaveChangesAsync();
                return RedirectToAction(nameof(Index));
            }
            return View(vendor);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Vendors the update dal.
 /// </summary>
 /// <param name="_Vendors">The vendors.</param>
 /// <returns>System.Int32.</returns>
 public int Vendors_UpdateDAL(Vendors _Vendors)
 {
     return(ExecuteScalarInt32Sp("TMS_CourseVendors_Update",
                                 ParamBuilder.Par("ID", _Vendors.ID),
                                 ParamBuilder.Par("PrimaryVendor", _Vendors.PrimaryVendor),
                                 ParamBuilder.Par("SecondaryVendor", _Vendors.SecondaryVendor),
                                 ParamBuilder.Par("PrimaryDetails", _Vendors.PrimaryDetails),
                                 ParamBuilder.Par("SecondaryDetails", _Vendors.SecondaryDetails),
                                 ParamBuilder.Par("Code", _Vendors.Code),
                                 ParamBuilder.Par("UpdatedBy", _Vendors.UpdatedBy),
                                 ParamBuilder.Par("UpdatedDate", _Vendors.UpdatedDate)
                                 ));
 }
Ejemplo n.º 12
0
        public string ToString(Type type, Vendors vendor)
        {
            string value = null;

            switch (this.value)
            {
            case Value.BorderBox:
                value = "border-box";
                break;

            case Value.PaddingBox:
                value = "padding-box";
                break;

            case Value.ContentBox:
                value = "content-box";
                break;
            }

            switch (type)
            {
            case Type.css:
                var prefix = string.Empty;
                switch (vendor)
                {
                case Vendors.w3c:
                    prefix = "-browser-";
                    break;

                case Vendors.webkit:
                    prefix = "-webkit-";
                    value  = value.Replace("-box", string.Empty);
                    break;

                case Vendors.moz:
                    prefix = "-moz-";
                    value  = value.Replace("-box", string.Empty);
                    break;
                }
                return(string.Format("{1}background-clip: {0};", value, prefix));

            case Type.scss:
                return(string.Format("@include background-clip({0});", value));

            case Type.sass:
                return(string.Format("+background-clip({0})", value));

            default:
                throw new NotSupportedException();
            }
        }
        protected override void Process()
        {
            foreach (Vendor vendor in Vendors.Where(x => ((VendorType)x.VendorType).Has(VendorType.Assortment) && x.IsActive))
            {
#if DEBUG
                if (vendor.VendorID != 260)
                {
                    continue;
                }
#endif

                try
                {
                    if (vendor.VendorSettings.GetValueByKey <int>("AssortmentImportID", 0) < 1)
                    {
                        continue;
                    }

                    log.DebugFormat("Start Assortment Import for Vendor '{0} ({1})'", vendor.Name, vendor.VendorID);

                    _retailStock    = false;//vendor.VendorSettings.GetValueByKey<bool>("RetailStock", false);
                    _auctionStock   = vendor.VendorSettings.GetValueByKey <bool>("AuctionStock", false);
                    _shopAssortment = vendor.VendorSettings.GetValueByKey <bool>("ShopAssortment", false);

                    var content = GetContent(vendor);

                    if (_auctionStock)
                    {
                        var bsv = new ProcessBSCStockAssortment();
                        bsv.Process(content, vendor, log, false);
                    }
                    else
                    {
                        var ass = new ProcessAssortment();
                        ass.Process(content, vendor, log);
                    }

                    //if (vendor.RetailStock)
                    //{
                    //  var rs = new ProcessRetailStock();
                    //  rs.Process(Content, VendorID, log);
                    //}

                    log.DebugFormat("Finished Assortment Import for vendor '{0} ({1})'", vendor.Name, vendor.VendorID);
                }
                catch (Exception ex)
                {
                    log.Error("Error import BAS assortment", ex);
                }
            }
        }
Ejemplo n.º 14
0
        public async Task <IHttpActionResult> DeleteVendors(int id)
        {
            Vendors vendors = await db.Vendors.FindAsync(id);

            if (vendors == null)
            {
                return(NotFound());
            }

            db.Vendors.Remove(vendors);
            await db.SaveChangesAsync();

            return(Ok(vendors));
        }
Ejemplo n.º 15
0
        public static async Task <bool> MailItems()
        {
            WoWPoint mboxLoc = BotPoi.Current.Location;
            var      mailbox = ObjectManager.GetObjectsOfType <WoWGameObject>().
                               FirstOrDefault(
                m => m.SubType == WoWGameObjectType.Mailbox &&
                m.Location.Distance(mboxLoc) < 10);

            if (mailbox == null)
            {
                if (Me.Location.DistanceSqr(BotPoi.Current.Location) > 4 * 4)
                {
                    Flightor.MoveTo(BotPoi.Current.Location);
                    return(true);
                }

                var profile = ProfileManager.CurrentOuterProfile;
                if (profile != null)
                {
                    profile.MailboxManager.Blacklist.Add(BotPoi.Current.AsMailbox);
                }

                BotPoi.Clear(string.Format("Unable to find mailbox @ {0}", BotPoi.Current.Location));
                return(false);
            }
            if (!mailbox.WithinInteractRange)
            {
                return(await FlyTo(BotPoi.Current.Location));
            }

            if (!mailbox.WithinInteractRange)
            {
                return(await FlyTo(mailbox.Location, mailbox.SafeName));
            }

            if (!MailFrame.Instance.IsVisible)
            {
                mailbox.Interact();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            await Vendors.MailAllItemsCoroutine();

            Vendor ven = ProfileManager.CurrentOuterProfile.VendorManager.GetClosestVendor();

            BotPoi.Current = ven != null ? new BotPoi(ven, PoiType.Repair) : new BotPoi(PoiType.None);
            return(true);
        }
 public bool DeepEquals(DestinyFactionDefinition other)
 {
     return(other != null &&
            DisplayProperties.DeepEquals(other.DisplayProperties) &&
            Progression.DeepEquals(other.Progression) &&
            RewardItem.DeepEquals(other.RewardItem) &&
            RewardVendor.DeepEquals(other.RewardVendor) &&
            TokenValues.DeepEqualsReadOnlyDictionaryWithDefinitionKeyAndSimpleValue(other.TokenValues) &&
            Vendors.DeepEqualsReadOnlyCollections(other.Vendors) &&
            Blacklisted == other.Blacklisted &&
            Hash == other.Hash &&
            Index == other.Index &&
            Redacted == other.Redacted);
 }
Ejemplo n.º 17
0
        void RunProductTest()
        {
            var conn = new Connection(@"localhost\sqlexpress", "PRSdb");

            conn.Open();
            Products.Connection = conn;
            Vendors.Connection  = conn;

            var PRODUCT = Products.GetByPartNbr("30372");

            //VendorId = Vendors.GetByCode("DNRUS").Id;
            Console.WriteLine(PRODUCT);

            //var product = new Products() {
            //    PartNbr = "38462", Name = "Refrosted Flakes", Price = 382, Unit = "40032", PhotoPath = null, VendorId = 1
            //};
            //try {
            //    //insert
            //    var success = Products.Insert(product);
            //    //update product.id
            //    var p = Products.GetByPK(1);
            //    p.Name = "Dino Bones";
            //    success = Products.Update(p);
            //}
            //catch (Exception ex) {
            //    Console.WriteLine($"Exception occured {ex.Message}");
            //}



            //var lemons = Products.GetByPK(7);
            //Console.WriteLine(lemons);

            //var products = Products.GetAll();
            //foreach(var p in products) {
            //    Console.WriteLine($"Product {p.Name} from Vendor {p.Vendor.Name} is priced at ${p.Price}");
            //}


            var VENDOR = Vendors.GetByCode("BGHTS");

            Console.WriteLine(VENDOR);

            var prodlist = Vendors.GetProducts("DNRUS");

            Console.WriteLine(prodlist);


            conn.Close();
        }
Ejemplo n.º 18
0
        public IHttpActionResult DeleteVendors(Guid id)
        {
            Vendors vendors = db.Vendors.Find(id);

            if (vendors == null)
            {
                return(NotFound());
            }

            db.Vendors.Remove(vendors);
            db.SaveChanges();

            return(Ok(vendors));
        }
Ejemplo n.º 19
0
        public void GetAll_ReturnsAllVendorsObjects_VendorList()
        {
            string         name01     = "Dill Rye the Sandwich Guy";
            string         name02     = "The Sand-Witch";
            Vendors        newVendor1 = new Vendors(name01);
            Vendors        newVendor2 = new Vendors(name02);
            List <Vendors> newList    = new List <Vendors> {
                newVendor1, newVendor2
            };

            List <Vendors> result = Vendors.GetAll();

            CollectionAssert.AreEqual(newList, result);
        }
Ejemplo n.º 20
0
 public bool DeepEquals(DestinyMilestone?other)
 {
     return(other is not null &&
            MilestoneHash == other.MilestoneHash &&
            AvailableQuests.DeepEqualsList(other.AvailableQuests) &&
            Activities.DeepEqualsList(other.Activities) &&
            Values.DeepEqualsDictionaryNaive(other.Values) &&
            VendorHashes.DeepEqualsListNaive(other.VendorHashes) &&
            Vendors.DeepEqualsList(other.Vendors) &&
            Rewards.DeepEqualsList(other.Rewards) &&
            StartDate == other.StartDate &&
            EndDate == other.EndDate &&
            Order == other.Order);
 }
        private void inventoryItemToDisplayItem(InventoryItem invItem, DisplayItem displayItem)
        {
            var invCat = invItem.InventoryCategoryId != null?InventoryCategories.FirstOrDefault(ic => ic.InventoryCategoryId == invItem.InventoryCategoryId) : null;

            var vendor = invItem.VendorId != null?Vendors.FirstOrDefault(v => v.VendorId == invItem.VendorId) : null;

            bool isNeeded = invItem.QuantityOnHand.GetValueOrDefault() < invItem.MinimumQuantity.GetValueOrDefault();

            displayItem.Line1 = invItem.InventoryItemName;
            displayItem.Line2 = (invCat == null ? "" : invCat.CategoryName) + (vendor == null ? "" : $" - {vendor.VendorName}");
            displayItem.Line3 = $"In Stock: {invItem.QuantityOnHand.GetValueOrDefault()} | Min Qty: {invItem.MinimumQuantity.GetValueOrDefault()} | Needed: {(isNeeded ? (invItem.MinimumQuantity.GetValueOrDefault() - invItem.QuantityOnHand.GetValueOrDefault()) : 0)}";
            displayItem.Tag   = invItem;
            displayItem.Tag2  = isNeeded ? Color.Red : Color.LightGray;
        }
Ejemplo n.º 22
0
 private void BuildModelsForVendor(XmlWriter writer, string vendorName)
 {
     if (Vendors.Count > 0)
     {
         Value vendor;
         if (Vendors.TryGetValue(vendorName, out vendor))
         {
             BuildInstructions(writer, DeviceExplorerModelsHtml);
             BuildBackButton(writer, "All Vendors", null, "List all Vendors");
             BuildModels(writer, "vendor", vendorName, vendor.Profiles, String.Format("Vendor '{0}'", vendorName));
             BuildBackButton(writer, "All Vendors", null, "List all Vendors");
         }
     }
 }
Ejemplo n.º 23
0
        public Vendors vendorById(int vendId)
        {
            Vendors venobj = new Vendors();

            try
            {
                venobj = context.Vendors.Find(vendId);
            }
            catch (Exception)
            {
                venobj = null;
            }
            return(venobj);
        }
Ejemplo n.º 24
0
        public bool Equals(DestinyMilestone input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     MilestoneHash == input.MilestoneHash ||
                     (MilestoneHash.Equals(input.MilestoneHash))
                     ) &&
                 (
                     AvailableQuests == input.AvailableQuests ||
                     (AvailableQuests != null && AvailableQuests.SequenceEqual(input.AvailableQuests))
                 ) &&
                 (
                     Activities == input.Activities ||
                     (Activities != null && Activities.SequenceEqual(input.Activities))
                 ) &&
                 (
                     Values == input.Values ||
                     (Values != null && Values.SequenceEqual(input.Values))
                 ) &&
                 (
                     VendorHashes == input.VendorHashes ||
                     (VendorHashes != null && VendorHashes.SequenceEqual(input.VendorHashes))
                 ) &&
                 (
                     Vendors == input.Vendors ||
                     (Vendors != null && Vendors.SequenceEqual(input.Vendors))
                 ) &&
                 (
                     Rewards == input.Rewards ||
                     (Rewards != null && Rewards.SequenceEqual(input.Rewards))
                 ) &&
                 (
                     StartDate == input.StartDate ||
                     (StartDate != null && StartDate.Equals(input.StartDate))
                 ) &&
                 (
                     EndDate == input.EndDate ||
                     (EndDate != null && EndDate.Equals(input.EndDate))
                 ) &&
                 (
                     Order == input.Order ||
                     (Order.Equals(input.Order))
                 ));
        }
Ejemplo n.º 25
0
        // /Vendors/Remove [POST]
        public ActionResult Remove([FromBody] Vendors vendor)
        {
            Vendors vendor2 = db.Vendors.Find(vendor.Id);

            db.Vendors.Remove(vendor2);
            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                return(Json(new JsonMessage("Failure", ex.Message), JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonMessage("Success", "Vendor was removed")));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Vendors the create dal.
        /// </summary>
        /// <param name="_Vendors">The vendors.</param>
        /// <returns>System.Int64.</returns>
        public long Vendors_CreateDAL(Vendors _Vendors)
        {
            var parameters = new[] { ParamBuilder.Par("ID", 0) };

            return(ExecuteInt64withOutPutparameterSp("TMS_CourseVendors_Create", parameters,
                                                     ParamBuilder.Par("PrimaryVendor", _Vendors.PrimaryVendor),
                                                     ParamBuilder.Par("SecondaryVendor", _Vendors.SecondaryVendor),
                                                     ParamBuilder.Par("PrimaryDetails", _Vendors.PrimaryDetails),
                                                     ParamBuilder.Par("SecondaryDetails", _Vendors.SecondaryDetails),
                                                     ParamBuilder.Par("OrganizationID", _Vendors.OrganizationID),
                                                     ParamBuilder.Par("Code", _Vendors.Code),
                                                     ParamBuilder.Par("CreatedBy", _Vendors.CreatedBy),
                                                     ParamBuilder.Par("CreatedDate", _Vendors.CreatedDate)
                                                     ));
        }
Ejemplo n.º 27
0
        public IActionResult EditVendoer(Vendors c)
        {
            Vendors cE = dbContext.Vendors.Where(db => db.VendorCode == c.VendorCode).FirstOrDefault();

            cE.VendorName = c.VendorName;
            cE.Area       = c.Area;
            cE.Cnic       = c.Cnic;

            cE.Mobile = c.Mobile;

            dbContext.Vendors.Update(cE);
            dbContext.SaveChanges();

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 28
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Vendors = await _context.Vendors.FirstOrDefaultAsync(m => m.VendorId == id);

            if (Vendors == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 29
0
        public static bool Delete(Vendors vendor)
        {
            if (vendor == null)
            {
                throw new Exception("Vendor not found");
            }
            var dbvendor = context.Vendors.Find(vendor.Id);

            if (dbvendor == null)
            {
                throw new Exception("Vendor not found");
            }
            context.Vendors.Remove(dbvendor);
            return(context.SaveChanges() == 1);
        }
Ejemplo n.º 30
0
 public void CreateVendorBounties(long[] hashes, DateTime date, Vendors vendor)
 {
     foreach (var hash in hashes)
     {
         var bountyDay = new BountyDay()
         {
             bountyinfoid = hash,
             day          = date.Day,
             month        = date.Month,
             year         = date.Year,
             vendor       = vendor.ToString()
         };
         db.BountyDays.Add(bountyDay);
     }
     db.SaveChanges();
 }
Ejemplo n.º 31
0
        public bool AddVendors(Vendors vendor)
        {
            bool status = false;

            try
            {
                _context.Vendors.Add(vendor);
                _context.SaveChanges();
                status = true;
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }
Ejemplo n.º 32
0
        public IActionResult UpdateEvent(string id, Vendors v)
        {
            var currVendor = _context.Vendors.FirstOrDefault(x => x.Id == id);

            currVendor.Name         = v.Name;
            currVendor.Offer        = v.Offer;
            currVendor.OfferCode    = v.OfferCode;
            currVendor.RedeemPoints = v.RedeemPoints;
            currVendor.Expiration   = v.Expiration;
            currVendor.Value        = v.Value;

            _context.Vendors.Update(currVendor);
            _context.SaveChanges();

            return(new JsonResult(v));
        }
Ejemplo n.º 33
0
        public void AddOrder_AssociatesOrderWithVendor_OrderList()
        {
            string        description = "Planet Shaped Bread";
            Orders        newOrder    = new Orders(description);
            List <Orders> newList     = new List <Orders> {
                newOrder
            };                                       // We create a new Order and add it to a List.
            string  name      = "Dill Rye the Sandwich Guy";
            Vendors newVendor = new Vendors(name);   // Then we create a new Vendors and call the soon-to-be-created AddOrder method upon it, passing in our sample Order.

            newVendor.AddOrder(newOrder);            // Next, we call newVendor.Orders, to retrieve the Orders saved in our Vendors.

            List <Orders> result = newVendor.Orders; // Finally, we assert that newVendor.Orders should return a List containing our single Order.

            CollectionAssert.AreEqual(newList, result);
        }
Ejemplo n.º 34
0
        public int? GetBuildingId(string sourceConnectionString, string destinationConnectionString, string vocabularyConnectionString, Vendors vendor)
        {
            const string query = "SELECT [BuildingId] FROM [dbo].[BuildingSettings] where [SourceConnectionString] = '{0}' and [DestinationConnectionString] = '{1}' and [VocabularyConnectionString] = '{2}' and [Vendor] = '{3}'";

             using (var connection = SqlConnectionHelper.OpenConnection(connectionString))
             {
            using (var cmd = new SqlCommand(string.Format(query, sourceConnectionString, destinationConnectionString, vocabularyConnectionString, vendor), connection))
            {
               using (var reader = cmd.ExecuteReader())
               {
                  while (reader.Read())
                  {
                     return reader.GetInt("BuildingId");
                  }
               }
            }
             }

             return null;
        }
Ejemplo n.º 35
0
        public void Update(int buildingId, string sourceConnectionString, string destinationConnectionString, string vocabularyConnectionString, Vendors vendor)
        {
            using (var connection = SqlConnectionHelper.OpenConnection(connectionString))
             {
            const string query = "UPDATE [dbo].[BuildingSettings] " +
                                 "SET [SourceConnectionString] = @sourceConnectionString " +
                                 ",[DestinationConnectionString] = @destinationConnectionString " +
                                 ",[VocabularyConnectionString] = @vocabularyConnectionString " +
                                 ",[Vendor] = @vendor " +
                                 "WHERE BuildingId = @buildingId";

            using (var cmd = new SqlCommand(query, connection))
            {
               cmd.Parameters.Add("@buildingId", SqlDbType.Int);
               cmd.Parameters["@buildingId"].Value = buildingId;

               cmd.Parameters.Add("@sourceConnectionString", SqlDbType.VarChar);
               cmd.Parameters["@sourceConnectionString"].Value = sourceConnectionString;

               cmd.Parameters.Add("@destinationConnectionString", SqlDbType.VarChar);
               cmd.Parameters["@destinationConnectionString"].Value = destinationConnectionString;

               cmd.Parameters.Add("@vocabularyConnectionString", SqlDbType.VarChar);
               cmd.Parameters["@vocabularyConnectionString"].Value = vocabularyConnectionString;

               cmd.Parameters.Add("@vendor", SqlDbType.VarChar);
               cmd.Parameters["@vendor"].Value = vendor.ToString();

               cmd.CommandTimeout = 30000;
               cmd.ExecuteScalar();
            }
             }
        }