本文整理汇总了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());
}
示例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;
}
示例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;
}
示例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);
}
示例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!");
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}