当前位置: 首页>>代码示例>>C#>>正文


C# Vendor类代码示例

本文整理汇总了C#中Vendor的典型用法代码示例。如果您正苦于以下问题:C# Vendor类的具体用法?C# Vendor怎么用?C# Vendor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Vendor类属于命名空间,在下文中一共展示了Vendor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XmlSerializationWithSingleObjectCompareTest

        public void XmlSerializationWithSingleObjectCompareTest()
        {
            Vendor vendor = new Vendor()
            {
                Code = "123",
                Description = "desc vendor 1",
                Name = "name vendor 1",
                VendorID = "vendorID1",
                CreateDate = DateTime.Now
            };

            Vendor newVendor = new Vendor()
            {
                Description = "desc vendor 2",
                Name = "name vendor 2",
                VendorID = "vendorID1",
                CreateDate = DateTime.Now.AddDays(-1)
            };

            ObjectCompareResult result = ObjectCompareHelper.CompareObject(vendor, newVendor);

            OutpuCompareResult(result);

            XElement root = result.ToXElement();

            ObjectCompareResult deserizlized = new ObjectCompareResult();

            deserizlized.FromXElement(root);

            Assert.AreEqual(root.ToString(), deserizlized.ToXElement().ToString());
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:31,代码来源:ObjectCompareTest.cs

示例2: Create

        public static WorkgroupVendorViewModel Create(IRepositoryWithTypedId<Vendor, string> vendorRepository, WorkgroupVendor workgroupVendor = null, Vendor vendor = null, VendorAddress vendorAddress = null, bool? newVendor = null)
        {
            Check.Require(vendorRepository != null, "Repository must be supplied");

            var addresses = vendor != null ? new MultiSelectList(vendor.VendorAddresses.Select(a => new { TypeCode = a.TypeCode, Name = string.Format("{0} ({1}, {2}, {3} {4})", a.Name, a.Line1, a.City, a.State, a.Zip) }).ToList(), "TypeCode", "Name") : new MultiSelectList(new List<VendorAddress>(), "TypeCode", "Name");

            var viewModel = new WorkgroupVendorViewModel
                                {
                                    WorkgroupVendor = workgroupVendor ?? new WorkgroupVendor(),
                                    Vendor = vendor,
                                    VendorAddress = vendorAddress,
                                    //Vendors = vendorRepository.Queryable.OrderBy(a => a.Name).ToList(),
                                    VendorAddresses = addresses,
                                    NewVendor = newVendor
                                };
            if(viewModel.WorkgroupVendor.VendorId != null && string.IsNullOrWhiteSpace(viewModel.WorkgroupVendor.Name))
            {
                var locVendor = vendorRepository.Queryable.First(a => a.Id == viewModel.WorkgroupVendor.VendorId);
                if(locVendor != null)
                {
                    viewModel.WorkgroupVendor.Name = locVendor.Name;
                }
            }
            return viewModel;
        }
开发者ID:ucdavis,项目名称:Purchasing,代码行数:25,代码来源:WorkgroupVendorViewModel.cs

示例3: DeactivateVendor

 public static bool DeactivateVendor(Vendor vendor, SqlConnection myConnection)
 {
     myConnection = myConnection ?? GetInventoryDbConnection();
     try
     {
         SqlCommand mySqlCommand = new SqlCommand("proc_DeactivateVendor", myConnection);
         mySqlCommand.CommandType = CommandType.StoredProcedure;
         mySqlCommand.Parameters.AddWithValue("@VendorID", vendor.Id);
         myConnection.Open();
         if (mySqlCommand.ExecuteNonQuery() == 1)
         {
             return true;
         }
     }
     catch (DataException ex)
     {
         Console.WriteLine(ex.Message);
         throw new ApplicationException(Messeges.GetMessage("DatabaseException"), ex);
     }
     catch (SqlException ex)
     {
         Console.WriteLine(ex.Message);
         throw new ApplicationException(Messeges.GetMessage("SqlException"), ex);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw new ApplicationException(Messeges.GetMessage("Exception"), ex);
     }
     finally
     {
         myConnection.Close();
     }
     return false;
 }
开发者ID:klwendel,项目名称:Capstone-2014,代码行数:35,代码来源:VendorDAL.cs

示例4: SingleObjectCompareTest

        public void SingleObjectCompareTest()
        {
            Vendor vendor = new Vendor()
            {
                Code = "123",
                Description = "desc vendor 1",
                Name = "name vendor 1",
                VendorID = "vendorID1",
                CreateDate = DateTime.Now
            };

            Vendor newVendor = new Vendor()
            {
                Description = "desc vendor 2",
                Name = "name vendor 2",
                VendorID = "vendorID1",
                CreateDate = DateTime.Now.AddDays(-1)
            };

            ObjectCompareResult result = ObjectCompareHelper.CompareObject(vendor, newVendor);

            OutpuCompareResult(result);

            //CreateDate不参与比较
            Assert.IsTrue(result.AreDifferent);
            Assert.AreEqual(3, result.Count);
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:27,代码来源:ObjectCompareTest.cs

示例5: ImportToMySql

        /// <summary>
        /// Imports Products to MySql.
        /// </summary>
        public static void ImportToMySql(IEnumerable<Product> products)
        {
            var mysqlManager = new MysqlDBManager();
            var mySqlContext = mysqlManager.MySqlContext;

            foreach (var product in products)
            {
                var vendorName = product.Vendor.Name;
                var vendor = mySqlContext.Vendors.FirstOrDefault(v => v.Name == vendorName);
                if (vendor == null)
                {
                    vendor = new Vendor()
                    {
                        Name = vendorName,
                        Expenses = new List<Expense>()
                    };
                }

                var mySqlProduct = DeepCopyProduct(product, vendor);
                mySqlContext.Products.AddOrUpdate(mySqlProduct);
                mySqlContext.SaveChanges();
            }

            Console.WriteLine("Data imported to MySQL!");
        }
开发者ID:Team-Sunflower-Sunbright,项目名称:DatabaseApps-Teamwork,代码行数:28,代码来源:MySqlImporter.cs

示例6: SendProductInquery

        public virtual int SendProductInquery(Product product,Vendor vendor,string from,string phone, string email,string msg, int languageId)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            var store = _storeContext.CurrentStore;
            languageId = EnsureLanguageIsActive(languageId, store.Id);

            var messageTemplate = GetActiveMessageTemplate("Product.Inqure", store.Id);
            if (messageTemplate == null)
                return 0;

            //email account
            var emailAccount = GetEmailAccountOfMessageTemplate(messageTemplate, languageId);

            //tokens
            var tokens = new List<Token>();
            _messageTokenProvider.AddStoreTokens(tokens, store, emailAccount);

            tokens.Add(new Token("Product.ProductUrl", store.Url + product.Name.Trim().Replace(" ", "-")));
            tokens.Add(new Token("Product.ProductName", product.Name));
            tokens.Add(new Token("From", from));
            tokens.Add(new Token("Phone", phone));
            tokens.Add(new Token("Email", email));
            tokens.Add(new Token("Msg", msg));

            //event notification
            _eventPublisher.MessageTokensAdded(messageTemplate, tokens);

            var toEmail = vendor.Email;
            var toName = vendor.Name;
            return SendNotification(messageTemplate, emailAccount,
                languageId, tokens,
                toEmail, toName);
        }
开发者ID:chamithdev,项目名称:AntiquesWeb,代码行数:35,代码来源:WorkflowMessageService.IB.cs

示例7: JobBuilder

 public JobBuilder(OrderModel order, UserModel userModel, IHRIDService hridService, Vendor vendor = null)
 {
     job = new Job(order, hridService.NextId("Job"));
     job.User = userModel;
     job.Vendor = vendor;
     job.ProfitShareResult = vendor?.Strategy?.Calculate(order.OrderCart.TotalToPay.Value);
 }
开发者ID:NerdCats,项目名称:TaskCat,代码行数:7,代码来源:JobBuilder.cs

示例8: DeepCopyProduct

        /// <summary>
        /// Makes deep copy of Product.
        /// Entity Framework cannot keep track of 1 item in 2 contexts, so in order to
        /// export something and import it in other database it needs deep copy of it.
        /// </summary>
        /// <param name="product">Product for copy.</param>
        /// <param name="vendor">Product's vendor.</param>
        /// <returns>Deep copy of the product</returns>
        private static Product DeepCopyProduct(Product product, Vendor vendor)
        {
            var incomes = product.Incomes
                .Select(income => new Income()
                {
                    Quantity = income.Quantity,
                    SalePrice = income.SalePrice
                })
                .ToList();

            var expenses = product.Vendor.Expenses
                .Select(expense => new Expense()
                {
                    Amount = expense.Amount,
                })
                .ToList();

            foreach (var expense in expenses)
            {
                vendor.Expenses.Add(expense);
            }

            var deepCopyProduct = new Product()
            {
                Name = product.Name,
                BuyingPrice = product.BuyingPrice,
                Incomes = incomes,
                Vendor = vendor
            };

            return deepCopyProduct;
        }
开发者ID:Team-Sunflower-Sunbright,项目名称:DatabaseApps-Teamwork,代码行数:40,代码来源:MySqlImporter.cs

示例9: FrmVendorAddUpdate

        public FrmVendorAddUpdate(AccessToken acctkn, Vendor vendor)
        {
            InitializeComponent();

            _myAccessToken = acctkn;
            _myVendor = vendor;

            this.Text = "Update Vendor: " + vendor.Name;
            btMorph.Text = "Update Vendor";

            PopulateStateCombo();
            PopulateCountryCombo();

            txtVendorID.Text = vendor.Id.ToString();
            txtVendorName.Text = vendor.Name;
            txtVendorAddress.Text = vendor.Address;
            txtVendorCity.Text = vendor.City;
            cbVendorState.Text = vendor.State;
            cbVendorCountry.Text = vendor.Country;
            txtVendorZipCode.Text = vendor.Zip;

            txtVendorContact.Text = vendor.Contact;
            txtVendorContactEmail.Text = vendor.ContactEmail;
            txtVendorContactPhone.Text = vendor.Phone;
            Instance = this;
        }
开发者ID:klwendel,项目名称:Capstone-2014,代码行数:26,代码来源:FrmVendorAddUpdate.cs

示例10: Save

        /// <summary>
        /// Save data for one vendor. disregard test
        /// </summary>
        /// <param name="vendor">Instance of the vendor to save.</param>
        /// <returns></returns>
        public bool Save(Vendor vendor)
        {
            var success = true;

            // Code that saves the vendor

            return success;
        }
开发者ID:ToMissTheMarc,项目名称:CSharpBP-Collections,代码行数:13,代码来源:VendorRepository.cs

示例11: AddEditVendorModel

        public AddEditVendorModel()
        {
            CompositionInitializer.SatisfyImports(this);

            mVendor = new Vendor{ SiteId = CMS.SelectedSiteId};

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:9,代码来源:AddEditVendorModel.cs

示例12: GetVendorByName

 public Vendor GetVendorByName(Vendor vendor)
 {
     //return base.DataContext.Vendors.SingleOrDefault<Vendor>(v => v.VendorName == vendorName);
     foreach (Vendor v in base.DataContext.Vendors)
     {
         if (v.Equals(vendor))
             return v;
     }
     return null;
 }
开发者ID:conwetlab,项目名称:fast,代码行数:10,代码来源:DAVendor.cs

示例13: Update

        public async Task<Vendor> Update(Vendor profile)
        {
            var user = (await accountManager.FindByIdAsync(profile.UserId) as EnterpriseUser);
            if (string.IsNullOrWhiteSpace(user.VendorId))
                throw new InvalidOperationException($"{user.Id} is not a vendor, please subscribe as a vendor first");

            var result = await Collection.FindOneAndReplaceAsync(x => x.UserId == profile.UserId && x.Id == profile.Id, profile);
            if (result == null)
                throw new EntityUpdateException(typeof(Vendor), profile.Id);
            return result;
        }
开发者ID:NerdCats,项目名称:TaskCat,代码行数:11,代码来源:VendorService.cs

示例14: Put

        // PUT api/awbuildversion/5
        public void Put(Vendor value)
        {
            var GetActionType = Request.Headers.Where(x => x.Key.Equals("ActionType")).FirstOrDefault();

            if (GetActionType.Key != null)
            {
                if (GetActionType.Value.ToList()[0].Equals("DELETE"))
                    adventureWorks_BC.VendorDelete(value);
                if (GetActionType.Value.ToList()[0].Equals("UPDATE"))
                    adventureWorks_BC.VendorUpdate(value);
            }
        }
开发者ID:oigbokwe73,项目名称:AdventureWorks,代码行数:13,代码来源:VendorController.cs

示例15: ToShopifyModel

        public static Vendor ToShopifyModel(this StorefrontModel.Vendor storefrontModel)
        {
            var shopifyModel = new Vendor();

            shopifyModel.InjectFrom<NullableAndEnumValueInjecter>(storefrontModel);

            var shopifyAddressModels = storefrontModel.Addresses.Select(a => a.ToShopifyModel());
            shopifyModel.Addresses = new MutablePagedList<Address>(shopifyAddressModels);
            shopifyModel.DynamicProperties = storefrontModel.DynamicProperties;

            return shopifyModel;
        }
开发者ID:sameerkattel,项目名称:vc-community,代码行数:12,代码来源:VendorConverter.cs


注:本文中的Vendor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。