本文整理汇总了C#中IMES.Infrastructure.UnitOfWork.UnitOfWork.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# UnitOfWork.Commit方法的具体用法?C# UnitOfWork.Commit怎么用?C# UnitOfWork.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMES.Infrastructure.UnitOfWork.UnitOfWork
的用法示例。
在下文中一共展示了UnitOfWork.Commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public ArrayList Update(string pdline, string station, string editor, string customer, string consolidate, string actqty)
{
try
{
ArrayList ret = new ArrayList();
string newConsolidate = String.Empty;
if (actqty.TrimEnd().Length == 1)
{
newConsolidate = consolidate.TrimEnd() + "/ " + actqty.TrimEnd();
}
else
{
newConsolidate = consolidate.TrimEnd() + "/" + actqty.TrimEnd();
}
IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
UnitOfWork uow = new UnitOfWork();
DeliveryRepository.InsertDeliveryAttrLogDefered(uow, newConsolidate, editor, consolidate);
DeliveryRepository.UpdateDeliveryInfoValueByInfoTypeAndInfoValuePrefixDefered(uow, newConsolidate, "Consolidated", consolidate, editor);
DeliveryRepository.UpdateConsolidateQtyInDeliveryExDefered(uow, consolidate, int.Parse(actqty.Trim()), editor);
uow.Commit();
return ret;
}
catch (FisException e)
{
throw e;
}
catch (Exception e)
{
throw new SystemException(e.Message);
}
}
示例2: DeleteRegion
public void DeleteRegion(string region)
{
UnitOfWork unit = new UnitOfWork();
modelRepository.DeleteModelInfoNameByRegionDefered(unit, region);
partRepository.DeleteRegionByNameDefered(unit, region);
unit.Commit();
}
示例3: DeleteDefectCode
/// <summary>
/// 根据type,defect删除一条数据
/// </summary>
/// <param name="type"></param>
/// <param name="defect"></param>
public void DeleteDefectCode(string type, string defect)
{
try
{
IDefectRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IDefectRepository>();
int count = itemRepository.CheckExistsRecord(defect);
if (count <= 0)
{
//已经不存在具有相同的defectCode记录
List<string> erpara = new List<string>();
FisException ex;
ex = new FisException("DMT119", erpara);
throw ex;
}
else
{
IUnitOfWork unitWork = new UnitOfWork();
Defect defectInfo = itemRepository.Find(defect);
itemRepository.Remove(defectInfo, unitWork);
unitWork.Commit();
}
}
catch (Exception)
{
throw;
}
}
示例4: Delete
public void Delete(string idFamilyInfo, string editor)
{
string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
logger.DebugFormat("BEGIN: {0}(idFamilyInfo={1})", methodName, idFamilyInfo);
try
{
IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
FamilyInfoDef cond = new FamilyInfoDef();
cond.id = int.Parse(idFamilyInfo);
IUnitOfWork uow = new UnitOfWork();
familyRep.RemoveFamilyInfoDefered(uow, cond);
uow.Commit();
}
catch (FisException e)
{
logger.Error(e.mErrmsg, e);
throw new Exception(e.mErrmsg);
}
catch (Exception e)
{
logger.Error(e.Message, e);
throw new SystemException(e.Message);
}
finally
{
logger.DebugFormat("END: {0}()", methodName);
}
}
示例5: AddCustomer
public void AddCustomer(CustomerInfo customerInfo)
{
FisException ex;
List<string> paraError = new List<string>();
try
{
IMiscRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>();
if (itemRepository.GetCustomerInfo(customerInfo.customer) == null)
{
UnitOfWork uow = new UnitOfWork();
itemRepository.AddCustomerDefered(uow, customerInfo);
uow.Commit();
}
else
{
ex = new FisException("DMT056", paraError);
throw ex;
}
}
catch (Exception)
{
throw;
}
}
示例6: UpdateShipType
//更新ShipType
public void UpdateShipType(ShipTypeMaintain shipType, string oldShipType)
{
ShipType fisObject = new ShipType();
fisObject.shipType = shipType.shipType;
fisObject.Description = shipType.Description;
fisObject.Editor = shipType.Editor;
fisObject.Cdt = DateTime.Now;
fisObject.Udt = DateTime.Now;
UnitOfWork uow = new UnitOfWork();
modelRepository.DeleteShipTypeByKeyDefered(uow, oldShipType);
modelRepository.InsertShipTypeDefered(uow, fisObject);
uow.Commit();
}
示例7: SaveTXTIntoTmpTable
public void SaveTXTIntoTmpTable(IList<IMES.DataModel.COAReceivingDef> dataLst)
{
try
{
IUnitOfWork ow = new UnitOfWork();
if(dataLst.Count>0)
{
COAReceivingDef def = dataLst[0];
itemRepository.RemoveTmpTableItemDefered(ow,def.pc.Trim());
IList<TmpTableInfo> voLst=PO2VO(dataLst);
itemRepository.SaveTXTIntoTmpTableDefered(ow,voLst);
ow.Commit();
}
}
catch(Exception)
{
throw;
}
}
示例8: UpdateMaterialByCtList
public void UpdateMaterialByCtList(IList<string> ctList,string stage,string editor,string station,string action,string line)
{
try
{
IMaterialRepository MaterialRepository = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository, Material>();
IUnitOfWork uow = new UnitOfWork();
foreach (string ct in ctList) // For Mantis0000539
{
Material m=MaterialRepository.Find(ct);
MaterialLog mLog = new MaterialLog();
mLog.Status="Collect";
mLog.Line="";
mLog.Stage=stage;
mLog.Editor=editor;
mLog.PreStatus = m.Status;
mLog.Action = "Combine Lot";
m.AddMaterialLog(mLog);
MaterialRepository.Update(m, uow);
}
//MaterialRepository.AddMultiMaterialCurStatusLogDefered
// (uow, ctList, action, stage, line, station, "", editor);
MaterialRepository.UpdateMultiMaterialCurStatusDefered(uow, ctList, station, editor);
uow.Commit();
}
catch (FisException e)
{
logger.Error(e.mErrmsg);
throw e;
}
catch (Exception e)
{
logger.Error(e.Message);
throw e;
}
finally
{
logger.Debug("(CollectionMaterialLot)UpdateMaterialByCtList ");
}
}
示例9: Save
public void Save(string input, string pdline, string model, string location, string obligation,string remark,string state, string customer, string editor)
{
logger.Debug("Save start, MBSno:" + input);
try
{
var materialRep = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository>();
IUnitOfWork uof = new UnitOfWork();
Material material = new Material();
material.MaterialCT = input;
material.MaterialType = "XRay";
material.Model = model;
material.Line = pdline;
material.DeliveryNo = state;
material.PalletNo = location;
material.CartonSN = obligation;
material.PreStatus = "XRay";
material.Status = "1";
material.ShipMode = remark;
material.Editor = editor;
material.Cdt = DateTime.Now;
material.Udt = DateTime.Now;
materialRep.Add(material, uof);
uof.Commit();
}
catch (FisException e)
{
logger.Error(e.mErrmsg, e);
throw new Exception(e.mErrmsg);
}
catch (Exception e)
{
logger.Error(e.Message, e);
throw new SystemException(e.Message);
}
finally
{
logger.Debug(" InputMB end, MBSno:" + input);
}
}
示例10: getIMEISeq
private IList<string> getIMEISeq(string model, string preFixCode, string custom, int qty)
{
string numType = "IMEI";
try
{
IList<string> ret = new List<string>();
if (qty == 1)
{
ret.Add(getIMEISeq(model, preFixCode, custom));
return ret;
}
SqlTransactionManager.Begin();
lock (_syncRoot_GetSeq)
{
INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
MACRange currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
if (currentRange == null)
{
throw new FisException("ICT014", new string[] { });
}
else
{
if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
{
throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
}
NumControl currentMaxNum = numCtrlRepository.GetMaxValue(numType, preFixCode);
if (currentMaxNum == null)
{
currentMaxNum = new NumControl();
currentMaxNum.NOName = preFixCode;
currentMaxNum.NOType = numType;
currentMaxNum.Value = currentRange.BegNo;
currentMaxNum.Customer = custom;
ret.Add(currentMaxNum.Value);
qty--;
IUnitOfWork uof = new UnitOfWork();
if (qty >0 && currentMaxNum.Value == currentRange.EndNo) //check Last Range
{
numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
if (currentRange == null)
{
throw new FisException("ICT014", new string[] { });
}
}
int remainingCount = qty;
for (int j = 0; j < qty; j++)
{
remainingCount--;
int curNum = int.Parse(currentMaxNum.Value) + 1;
currentMaxNum.Value = curNum.ToString("D12");
if (remainingCount >0 && currentMaxNum.Value == currentRange.EndNo) //check Last Range
{
numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
if (currentRange == null)
{
throw new FisException("ICT014", new string[] { });
}
if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
{
throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
}
if (currentMaxNum.Value == currentRange.BegNo || currentMaxNum.Value == currentRange.EndNo)
{
throw new FisException("ICT018", new string[] { currentMaxNum.Value });
}
}
ret.Add(currentMaxNum.Value);
}
if (int.Parse(currentMaxNum.Value) > int.Parse(currentRange.EndNo))
{
throw new FisException("GEN022", new string[] { currentMaxNum.Value + ">" + currentRange.EndNo });
}
if (currentMaxNum.Value == currentRange.EndNo)
{
numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
}
else
{
numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Active);
}
numCtrlRepository.InsertNumControlDefered(uof, currentMaxNum);
uof.Commit();
SqlTransactionManager.Commit();
return ret;
}
else
{
//.........这里部分代码省略.........
示例11: saveMB
public string saveMB(string Inputstring, string editor, string station, string customer)
{
logger.Debug("(PCAOQCInputImpl)saveMB start Input:" + Inputstring + "editor:" + editor + "station:" + station + "customer:" + customer);
//FisException ex;
List<string> erpara = new List<string>();
ArrayList retLst = new ArrayList();
IMBRepository iMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
ArrayList lstRet = new ArrayList();
UnitOfWork uow = new UnitOfWork();
string returnstring = "OK";
try
{
IMB mb = iMBRepository.Find(Inputstring);
if (mb != null)
{
string preStation = mb.MBStatus.Station;
string status = (string)mb.MBStatus.Status.ToString();
string line = mb.MBStatus.Line;
if (preStation != "15")
{
string[] param = { Inputstring, status, preStation };
throw new FisException("SFC009", param);
}
mb.MBStatus.Station = "31A";
mb.MBStatus.Status = MBStatusEnum.Pass;
mb.MBStatus.Editor = editor;
mb.MBStatus.Udt = DateTime.Now;
//记录MB Log
MBLog mb_log = new MBLog(0, mb.Sn, mb.Model, "31A", (int)MBStatusEnum.Pass, line, editor, new DateTime());
mb.AddLog(mb_log);
iMBRepository.Update(mb, uow);
}
uow.Commit();
return returnstring;
}
catch (FisException e)
{
logger.Error(e.mErrmsg);
throw e;
}
catch (Exception e)
{
logger.Error(e.Message);
throw e;
}
finally
{
logger.Debug("(PCAOQCInputImpl)saveMB End Input:" + Inputstring + "editor:" + editor + "station:" + station + "customer:" + customer);
}
}
示例12: inputMBSnoORLotNo
//.........这里部分代码省略.........
//Update PCBStatus:Station=’31A’Status=’1’
//Insert PCBLog
//Insert PCBLog:Station=’31A’Status=’1’
PcblotInfo conPcblot4 = new PcblotInfo();
//conPcblot = new PcblotInfo();
conPcblot4.lotNo= LotNO;
conPcblot4.status = "1";
IList<PcblotInfo>pcblotLst4 = new List<PcblotInfo>();
pcblotLst4 = iMBRepository.GetPcblotInfoList(conPcblot4);
if ((pcblotLst4 == null) || (pcblotLst4.Count == 0))
{
}
else
{
for (int i = 0; i < pcblotLst4.Count; i++)
{
IMB mb = iMBRepository.Find(pcblotLst4[i].pcbno);
if (mb != null)
{
mb.MBStatus.Station = "31A";
mb.MBStatus.Status = MBStatusEnum.Pass;
mb.MBStatus.Editor = editor;
mb.MBStatus.Udt = DateTime.Now;
//记录MB Log
MBLog mb_log = new MBLog(0, mb.Sn, mb.Model, "31A", (int) MBStatusEnum.Pass,
getLotInfo[0].line, editor, new DateTime());
mb.AddLog(mb_log);
iMBRepository.Update(mb, uow);
}
}
}
}
uow.Commit();
//5、重新获取Lot信息,并显示LotNo Line[Line.Descr] Type PCS = Qty Status[2:OQC In;3:Locked]
conLotInfo = new LotInfo();
conLotInfo.lotNo = LotNO;
IList<LotInfo> ReturnLotInfo = iMBRepository.GetlotInfoList(conLotInfo);
ILineRepository lineRepository = RepositoryFactory.GetInstance().GetRepository<ILineRepository, Line>();
Line lineInfo = lineRepository.Find(ReturnLotInfo[0].line);
if (lineInfo == null)
{
erpara.Add(sessionKey);
ex = new FisException("CHK317", erpara); //该PCB %1 没有PdLine,请确认!
throw ex;
}
string lotLineinfo = ReturnLotInfo[0].line.Trim() + "[" +lineInfo.Descr.Trim() + "]";
string strStatus="";
if (ReturnLotInfo[0].status == "2")
{
strStatus = "OQC In";
}
else if (ReturnLotInfo[0].status == "3")
{
strStatus = "Locked";
}
//Old--获取PCBLot信息,并显示PCBLot.PCBNo where [email protected] and Status=1
//PcblotInfo RtnconPcblot = new PcblotInfo();
//RtnconPcblot.lotNo = ReturnLotInfo[0].lotNo;
//RtnconPcblot.status = "1";
//IList<PcblotInfo> rtnpcblotLst = new List<PcblotInfo>();
//rtnpcblotLst = iMBRepository.GetPcblotInfoList(RtnconPcblot);
//IList<string> mbsnList = new List<string>();
//foreach (PcblotInfo pcblotnode in rtnpcblotLst)
//{
示例13: RemovePallet
/// <summary>
/// RemovePallet
/// </summary>
/// <param name="plt">plt</param>
/// <param name="editor">editor</param>
public void RemovePallet(string plt, string editor)
{
try
{
palletRepository.UpdatePakWhLocByPltForClearPlt1AndPlt2(plt);
WhPltMasInfo newMasInfo = new WhPltMasInfo();
newMasInfo.plt = plt;
newMasInfo.editor = editor;
newMasInfo.wc = "RW";
newMasInfo.udt = DateTime.Now;
palletRepository.UpdateWhPltMas(newMasInfo, plt);
WhPltLogInfo newLog = new WhPltLogInfo();
newLog.plt = plt;
newLog.editor = editor;
newLog.wc = "RW";
newLog.cdt = DateTime.Now;
palletRepository.InsertWhPltLog(newLog);
Pallet curPallet = palletRepository.Find(plt);
if (null != curPallet)
{
curPallet.Station = "RW";
curPallet.Editor = editor;
curPallet.Udt = DateTime.Now;
PalletLog newPalletLog = new PalletLog();
newPalletLog.Editor = editor;
newPalletLog.Line = "";
newPalletLog.Station = "RW";
newPalletLog.Cdt = DateTime.Now;
curPallet.AddLog(newPalletLog);
IUnitOfWork uow = new UnitOfWork();
palletRepository.Update(curPallet, uow);
uow.Commit();
}
}
catch (FisException e)
{
logger.Error(e.mErrmsg, e);
throw new Exception(e.mErrmsg);
}
catch (Exception e)
{
logger.Error(e.Message, e);
throw new SystemException(e.Message);
}
}
示例14: SaveECRVersion
public void SaveECRVersion(EcrVersionInfo info)
{
logger.Debug("(ECRVersionManager)SaveECRVersion start, [info]:" + info);
IEcrVersionRepository ier = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository, EcrVersion>();
IUnitOfWork work = new UnitOfWork();
IList<EcrVersion> lstEcrVersion = null;
try
{
lstEcrVersion = ier.GetECRVersionByFamilyMBCodeAndECR(info.Family, info.MBCode, info.ECR);
if (lstEcrVersion == null || lstEcrVersion.Count == 0)
{
ier.Add(GetEcrVersion(info), work);
}
else
{
if (lstEcrVersion[0].ID == info.ID)
{
ConvertEcrVersionForUpdate(lstEcrVersion[0], info);
// ier.Update(lstEcrVersion[0], work);
ier.UpdateEcrVersionMaintainDefered(work, lstEcrVersion[0],info.Family,info.MBCode,info.ECR);
}
else
{
List<string> param = new List<string>();
throw new FisException("DMT137", param);
}
}
work.Commit();
}
catch (FisException e)
{
logger.Error(e.mErrmsg);
throw e;
}
catch (Exception e)
{
logger.Error(e.Message);
throw;
}
finally
{
logger.Debug("(ECRVersionManager)SaveECRVersion end, [info]:" + info);
}
}
示例15: InsertFAIModel
private void InsertFAIModel(string model, string editor)
{
string OnlyNeedOQCApprove = CommonImpl.GetInstance().GetValueFromSysSetting("OnlyNeedOQCApprove");
string FAIFAQty = CommonImpl.GetInstance().GetValueFromSysSetting("FAIFAQty");
string FAIPAKQty = CommonImpl.GetInstance().GetValueFromSysSetting("FAIPAKQty");
string modelType = GetModelType(model);
string FAState = "";
// 新增ApprovalStatus
if ("Y" == OnlyNeedOQCApprove)
{
string strSQL = @"insert into ApprovalStatus(
ApprovalItemID, ModuleKeyValue,
Status, Editor, Cdt, Udt)
select
a.ID, @AddModel as ModuleKeyValue,
case when IsNeedApprove='Y'
then 'Waiting'
else 'Option'
end as [Status], @CurrentUser,
GETDATE() as Cdt, GETDATE() as Udt
from ApprovalItem a
where
a.Module= @ModelType and
a.Department = 'OQC'";
SqlParameter[] paramsArray = new SqlParameter[3];
paramsArray[0] = new SqlParameter("@CurrentUser", SqlDbType.VarChar);
paramsArray[0].Value = editor;
paramsArray[1] = new SqlParameter("@AddModel", SqlDbType.VarChar);
paramsArray[1].Value = model;
paramsArray[2] = new SqlParameter("@ModelType", SqlDbType.VarChar);
paramsArray[2].Value = "FAI" + modelType;
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString_FA,
System.Data.CommandType.Text,
strSQL,
paramsArray);
FAState = "Approval";
}
else if (string.IsNullOrEmpty(OnlyNeedOQCApprove) || "N" == OnlyNeedOQCApprove)
{
string strSQL = @"insert into ApprovalStatus(
ApprovalItemID, ModuleKeyValue,
Status, Editor, Cdt, Udt)
select a.ID, @AddModel as ModuleKeyValue,
case when IsNeedApprove='Y'
then 'Waiting'
else 'Option'
end as [Status], @CurrentUser, GETDATE() as Cdt, GETDATE() as Udt
from ApprovalItem a
where
a.Module= @ModelType
";
SqlParameter[] paramsArray = new SqlParameter[3];
paramsArray[0] = new SqlParameter("@CurrentUser", SqlDbType.VarChar);
paramsArray[0].Value = editor;
paramsArray[1] = new SqlParameter("@AddModel", SqlDbType.VarChar);
paramsArray[1].Value = model;
paramsArray[2] = new SqlParameter("@ModelType", SqlDbType.VarChar);
paramsArray[2].Value = "FAI" + modelType;
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString_FA,
System.Data.CommandType.Text,
strSQL,
paramsArray);
FAState = "Waiting";
}
DateTime now = DateTime.Now;
FAIModelInfo itemFai = new FAIModelInfo()
{
Model = model,
ModelType = modelType,
PlanInputDate = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, 0),
FAQty = int.Parse(FAIFAQty),
inFAQty = 0,
PAKQty = int.Parse(FAIPAKQty),
inPAKQty = 0,
PAKStartDate = now,
FAState = FAState,
PAKState = "Hold",
Remark = "KeyIn",
Editor = editor,
Cdt = now,
Udt = now
};
IUnitOfWork uow = new UnitOfWork();
iModelRepository.InsertFAIModelDefered(uow, itemFai);
uow.Commit();
}