本文整理汇总了C#中Vendor类的典型用法代码示例。如果您正苦于以下问题:C# Vendor类的具体用法?C# Vendor怎么用?C# Vendor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vendor类属于命名空间,在下文中一共展示了Vendor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Step_01_Insert_Generated
/// <summary>
/// Inserts a mock Vendor entity into the database.
/// </summary>
private void Step_01_Insert_Generated()
{
using (TransactionManager tm = CreateTransaction())
{
mock = CreateMockInstance(tm);
Assert.IsTrue(DataRepository.VendorProvider.Insert(tm, mock), "Insert failed");
System.Console.WriteLine("DataRepository.VendorProvider.Insert(mock):");
System.Console.WriteLine(mock);
//normally one would commit here
//tm.Commit();
//IDisposable will Rollback Transaction since it's left uncommitted
}
}
开发者ID:netTiers,项目名称:netTiers,代码行数:18,代码来源:VendorTest.generated.cs
示例17: AddVendor
public int AddVendor(Vendor newVendor)
{
Vendor existingObj = GetVendorByName(newVendor);
if (existingObj == null)
{
base.DataContext.Vendors.InsertOnSubmit(newVendor);
base.DataContext.SubmitChanges();
return newVendor.VendorId;
}
else
{
return existingObj.VendorId;
}
}
开发者ID:conwetlab,项目名称:fast,代码行数:15,代码来源:DAVendor.cs
示例18: Retrieve
/// <summary>
/// Retrieve one vendor.
/// </summary>
/// <param name="vendorId">Id of the vendor to retrieve.</param>
public Vendor Retrieve(int vendorId)
{
// Create the instance of the Vendor class
Vendor vendor = new Vendor();
// Code that retrieves the defined customer
// Temporary hard coded values to return
if (vendorId == 1)
{
vendor.VendorId = 1;
vendor.CompanyName = "ABC Corp";
vendor.Email = "[email protected]";
}
return vendor;
}
开发者ID:ToMissTheMarc,项目名称:CSharpBP-Collections,代码行数:20,代码来源:VendorRepository.cs
示例19: AddVendor
public static Boolean AddVendor(Vendor vendor, SqlConnection myConnection)
{
myConnection = myConnection ?? GetInventoryDbConnection();
try
{
SqlCommand mySqlCommand = new SqlCommand("proc_InsertIntoVendor", myConnection);
mySqlCommand.CommandType = CommandType.StoredProcedure;
mySqlCommand.Parameters.AddWithValue("@Name", vendor.Name);
mySqlCommand.Parameters.AddWithValue("@Address", vendor.Address);
mySqlCommand.Parameters.AddWithValue("@City", vendor.City);
mySqlCommand.Parameters.AddWithValue("@State", vendor.State);
mySqlCommand.Parameters.AddWithValue("@Country", vendor.Country);
mySqlCommand.Parameters.AddWithValue("@Zip", vendor.Zip);
mySqlCommand.Parameters.AddWithValue("@Phone", vendor.Phone);
mySqlCommand.Parameters.AddWithValue("@Contact", vendor.Contact);
mySqlCommand.Parameters.AddWithValue("@ContactEmail", vendor.ContactEmail);
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,代码行数:45,代码来源:VendorDAL.cs
示例20: OpenCLMiner
public OpenCLMiner(OpenCLManager OCLMan, Vendor vendor, int deviceIndex, bool shouldUseVectors)
{
this.vendor = vendor;
this.deviceIndex = deviceIndex;
this.OCLMan = OCLMan;
Device device = OCLMan.Context.Devices[deviceIndex];
Name = device.Vendor + ":" + device.Name + " (" + deviceIndex + ")";
OCLMan.Defines += "\r\n#define OUTPUT_SIZE 256";
OCLMan.Defines += "\r\n#define OUTPUT_MASK 255";
if (device.Extensions.Contains("cl_amd_media_ops"))
{
OCLMan.Defines += "\r\n#define BITALIGN 1";
// note: defining BFI_INT resulted in invalid calculations on my Barts (8760)
//if (Array.IndexOf(AMD_Devices, device.Name) != -1)
// OCLMan.Defines += "\r\n#define BFI_INT 1";
}
if (shouldUseVectors)
OCLMan.Defines += "\r\n#define VECTORS 1";
_shouldUseVectors = shouldUseVectors;
searchKernel = OCLMan.CompileFile("General.cl").CreateKernel("search");
unsafe
{
IntPtr size = (IntPtr)8;
long[] values = new long[1];
long[] sizeTest = new long[1];
fixed (long* valuep = &values[0])
{
IntPtr sizeOuts;
OpenCL.GetKernelWorkGroupInfo(searchKernel.KernelID, device.DeviceID, KernelWorkGroupInfo.WORK_GROUP_SIZE, size, (void*)valuep, out sizeOuts);
workGroupSize = (uint)values[0];
}
}
unit = workGroupSize * 256u;
globalThreads = (uint)(unit * 10);
Initialized = true;
}
开发者ID:pointgaming,项目名称:point-gaming-desktop,代码行数:44,代码来源:OpenCLMiner.cs
注:本文中的Vendor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论