本文整理汇总了C#中ProductType.Save方法的典型用法代码示例。如果您正苦于以下问题:C# ProductType.Save方法的具体用法?C# ProductType.Save怎么用?C# ProductType.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductType
的用法示例。
在下文中一共展示了ProductType.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveToDb
//数据持久化
internal static void SaveToDb(ProductTypeInfo pProductTypeInfo, ProductType pProductType,bool pIsNew)
{
pProductType.ProductTypeId = pProductTypeInfo.productTypeId;
pProductType.ProductName = pProductTypeInfo.productName;
pProductType.OfferPriceId = pProductTypeInfo.offerPriceId;
pProductType.Model = pProductTypeInfo.model;
pProductType.Unit = pProductTypeInfo.unit;
pProductType.Num = pProductTypeInfo.num;
pProductType.Price = pProductTypeInfo.price;
pProductType.Sums = pProductTypeInfo.sums;
pProductType.IsNew=pIsNew;
string UserName = SubsonicHelper.GetUserName();
try
{
pProductType.Save(UserName);
}
catch(Exception ex)
{
LogManager.getInstance().getLogger(typeof(ProductTypeInfo)).Error(ex);
if(ex.Message.Contains("插入重复键"))//违反了唯一键
{
throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
}
throw new AppException("保存失败");
}
pProductTypeInfo.productTypeId = pProductType.ProductTypeId;
//如果缓存存在,更新缓存
if (CachedEntityCommander.IsTypeRegistered(typeof(ProductTypeInfo)))
{
ResetCache();
}
}
示例2: Update
public void Update(int ProductTypeId,string Name,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
{
ProductType item = new ProductType();
item.ProductTypeId = ProductTypeId;
item.Name = Name;
item.CreatedBy = CreatedBy;
item.CreatedOn = CreatedOn;
item.ModifiedBy = ModifiedBy;
item.ModifiedOn = ModifiedOn;
item.MarkOld();
item.Save(UserName);
}
示例3: Insert
public void Insert(string Name,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
{
ProductType item = new ProductType();
item.Name = Name;
item.CreatedBy = CreatedBy;
item.CreatedOn = CreatedOn;
item.ModifiedBy = ModifiedBy;
item.ModifiedOn = ModifiedOn;
item.Save(UserName);
}
示例4: btnProductTypeAdd_Click
/// <summary>
/// Handles the Click event of the btnProductTypeAdd control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
protected void btnProductTypeAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtProductTypeAdd.Text)) {
ProductType productType = new ProductType();
productType.Name = txtProductTypeAdd.Text.Trim();
productType.Save(WebUtility.GetUserName());
txtProductTypeAdd.Text = string.Empty;
LoadProductType();
ddlProductType.SelectedIndex = ddlProductType.Items.Count - 1;
}
}