本文整理汇总了C#中IMES.Infrastructure.UnitOfWork.UnitOfWork.RegisterSetterBetween方法的典型用法代码示例。如果您正苦于以下问题:C# UnitOfWork.RegisterSetterBetween方法的具体用法?C# UnitOfWork.RegisterSetterBetween怎么用?C# UnitOfWork.RegisterSetterBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMES.Infrastructure.UnitOfWork.UnitOfWork
的用法示例。
在下文中一共展示了UnitOfWork.RegisterSetterBetween方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRework
/// <summary>
/// 创建Rework,检查Product List中所有Product是否可以做Rework,若不可以,则提示用户,放弃后续操作。
/// </summary>
/// <returns></returns>
public string CreateRework(IList<string> productIDList,string editor)
{
string userKey = Guid.NewGuid().ToString();
//string reworkCode;
Rework rework = new Rework();
try
{
//insert ProductIDListForRework(UserKey,ProductID) values(?,?)
productRepository.CreateTempProductIDList(productIDList, userKey);
//select count(1)
//from IMES_GetData.dbo.TempProductID a
// join IMES_FA.dbo.Rework_Product b on a.ProductID = b.ProductID
// join IMES_FA.dbo.Rework c on b.ReworkCode=c.ReworkCode
//where Rework.Status<>3 and a.UserKey=?
int count1 = productRepository.GetUnitExistsCountByUserKey(userKey);
//select count(1)
//from IMES_GetData.dbo.TempProductID a
// join IMES_FA.dbo.ProductStatus b on a.ProductID = b.ProductID
// join IMES_GetData.dbo.ReworkRejectStation c on b.Station =c.Station and b.Status=c.Status
//where a.UserKey=?
int count2 = productRepository.GetInvalidUnitCountByUserKey(userKey);
List<string> erpara = new List<string>();
if (count1 > 0)
{
//存在Unit存在Rework_Product表且ReworkCode对应的Rework.Status<>3
FisException ex1 = new FisException("DMT023", erpara);
throw ex1;
}
if (count2 > 0)
{
//存在unit的Product.Station and Status存在于ReworkRejectStation表
FisException ex2 = new FisException("DMT024", erpara);
throw ex2;
}
rework.Status = "0";
rework.Editor = editor;
rework.Cdt = DateTime.Now;
rework.Udt = DateTime.Now;
UnitOfWork uow = new UnitOfWork();
//创建Rework记录,Rework.Status=0(Create)
productRepository.CreateReworkDefered(uow, rework);
//将对应ProductStatus表中的ReworkCode栏位设置为新产生的Rework Code。
ReworkObj rwkObj = new ReworkObj();
SetterBetween stbt = new SetterBetween(rework, "ReworkCodeProperty", rwkObj, "ReworkCodeProperty");
uow.RegisterSetterBetween(stbt);
productRepository.UpdateProductStatusReworkCodeByUserKeyDefered(uow, userKey, rwkObj);
uow.Commit();
}
catch (Exception e)
{
logger.Debug(e.Message);
throw e;
}
finally
{
//delete ProductIDListForRework where UserKey=?
productRepository.DeleteProductIDListByUserKey(userKey);
}
return rework.ReworkCode;
}