当前位置: 首页>>代码示例>>C#>>正文


C# UnitOfWork.UnitOfWork类代码示例

本文整理汇总了C#中IMES.Infrastructure.UnitOfWork.UnitOfWork的典型用法代码示例。如果您正苦于以下问题:C# UnitOfWork类的具体用法?C# UnitOfWork怎么用?C# UnitOfWork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UnitOfWork类属于IMES.Infrastructure.UnitOfWork命名空间,在下文中一共展示了UnitOfWork类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteRegion

 public void DeleteRegion(string region)
 {
     UnitOfWork unit = new UnitOfWork();
     modelRepository.DeleteModelInfoNameByRegionDefered(unit, region);
     partRepository.DeleteRegionByNameDefered(unit, region);
     unit.Commit();
 }
开发者ID:wra222,项目名称:testgit,代码行数:7,代码来源:RegionManager.cs

示例2: 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;
     }
 }
开发者ID:wra222,项目名称:testgit,代码行数:32,代码来源:DefectMaintainManager.cs

示例3: 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);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:35,代码来源:UpdateConsolidate.cs

示例4: UpDN

 /// <summary>
 /// 更改Delivery表相关信息
 /// </summary>
 /// <param name="dn">dn</param>
 /// <param name="dnDate">dnDate</param>
 /// <param name="editor">editor</param>
 public void UpDN(string dn, string dnDate, string editor)
 { 
     logger.Debug("(_UpdateShipDate)UpDN start.");
     DNUpdateCondition myCondition = new DNUpdateCondition();
     myCondition.DeliveryNo = dn;
     myCondition.ShipDate = DateTime.Parse(dnDate);
     try
     {
         UnitOfWork uow = new UnitOfWork();
         //currentRepository.UpdateDNByCondition( myCondition,  editor);
         currentRepository.UpdateDNByConditionDefered(uow, myCondition, editor);
         currentRepository.updateEDIPAKComnShipDateDefered(uow, dn, myCondition.ShipDate.ToString("yyyyMMdd"));
         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.Debug("(_UpdateShipDate)UpDN end.");
     }
 }
开发者ID:wra222,项目名称:testgit,代码行数:35,代码来源:UpdateShipDate.cs

示例5: 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);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:32,代码来源:FAIModelRule.cs

示例6: 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;
            }

        }
开发者ID:wra222,项目名称:testgit,代码行数:27,代码来源:CommonImpl.cs

示例7: 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();
 }
开发者ID:wra222,项目名称:testgit,代码行数:14,代码来源:ShipTypeManager.cs

示例8: 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;
     }
 }
开发者ID:wra222,项目名称:testgit,代码行数:19,代码来源:COAReceivingManager.cs

示例9: ChangePriority

 public void ChangePriority(RulesetInfoDataMaintain highPriority, RulesetInfoDataMaintain lowPriority)
 {
     highPriority.Priority = highPriority.Priority + 1;
     lowPriority.Priority = lowPriority.Priority - 1;
     UnitOfWork uow = new UnitOfWork();
     ProcessRuleSet ruleset1 = new ProcessRuleSet();
     ruleset1.Cdt = highPriority.Cdt;
     ruleset1.Condition1 = highPriority.Condition1;
     ruleset1.Condition2 = highPriority.Condition2;
     ruleset1.Condition3 = highPriority.Condition3;
     ruleset1.Condition4 = highPriority.Condition4;
     ruleset1.Condition5 = highPriority.Condition5;
     ruleset1.Condition6 = highPriority.Condition6;
     ruleset1.Editor = highPriority.Editor;
     ruleset1.ID = highPriority.Id;
     ruleset1.Priority = highPriority.Priority;
     ruleset1.Udt = highPriority.Udt;
     ProcessRuleSet ruleset2 = new ProcessRuleSet();
     ruleset2.Cdt = lowPriority.Cdt;
     ruleset2.Condition1 = lowPriority.Condition1;
     ruleset2.Condition2 = lowPriority.Condition2;
     ruleset2.Condition3 = lowPriority.Condition3;
     ruleset2.Condition4 = lowPriority.Condition4;
     ruleset2.Condition5 = lowPriority.Condition5;
     ruleset2.Condition6 = lowPriority.Condition6;
     ruleset2.Editor = lowPriority.Editor;
     ruleset2.ID = lowPriority.Id;
     ruleset2.Priority = lowPriority.Priority;
     ruleset2.Udt = lowPriority.Udt;
     //若有应用Rule Set List表格中的当前选项或其上一个选项的Rule存在,则删除Model_Process数据表中的所有记录。
     if ((processRepository.GetAllRuleByRuleSetID(highPriority.Id) != null && processRepository.GetAllRuleByRuleSetID(highPriority.Id).Count > 0)
         || (processRepository.GetAllRuleByRuleSetID(lowPriority.Id) != null && processRepository.GetAllRuleByRuleSetID(lowPriority.Id).Count > 0))
     {
         processRepository.DeleteAllModelProcessDefered(uow);
     }
     ProcessRuleSet tempRuleSet1 = processRepository.GetRuleSetById(ruleset1.ID);
     ProcessRuleSet tempRuleSet2 = processRepository.GetRuleSetById(ruleset2.ID);
     ruleset1.Priority = tempRuleSet2.Priority;
     ruleset2.Priority = tempRuleSet1.Priority;
     processRepository.UpdateRuleSetPriorityDefered(uow, ruleset1);
     processRepository.UpdateRuleSetPriorityDefered(uow, ruleset2);
     uow.Commit();
 }
开发者ID:wra222,项目名称:testgit,代码行数:43,代码来源:ModelProcessManager.cs

示例10: 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 ");
            }
        
        }
开发者ID:wra222,项目名称:testgit,代码行数:42,代码来源:CollectionMaterialLot.cs

示例11: 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);
            }

        }
开发者ID:wra222,项目名称:testgit,代码行数:42,代码来源:SAInputXRay.cs

示例12: SavePartForbidden

        //add/save partforbidden
        public int SavePartForbidden(PartForbiddenMaintainInfo infoPartForbidden)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                PartForbidden partForbiddenObj = null;
                if (infoPartForbidden.Id != 0)
                {
                    partForbiddenObj = partRepository.GetPartForbidden(infoPartForbidden.Id);
                }
                if (partForbiddenObj == null)
                {
                    //检查是否已存在相同的PartForbidden
                    int count = partRepository.CheckExistedPartForbidden(infoPartForbidden.Model, infoPartForbidden.Descr, infoPartForbidden.PartNo, infoPartForbidden.AssemblyCode, infoPartForbidden.Family);
                    if (count > 0)
                    {
                        ex = new FisException("DMT039", paraError);
                        throw ex;
                    }

                    partForbiddenObj = new PartForbidden();
                    partForbiddenObj = convertToObjFromMaintainInfo(partForbiddenObj, infoPartForbidden);

                    IUnitOfWork work = new UnitOfWork();
                    partRepository.AddPartForbiddenDefered(work, partForbiddenObj);
                    work.Commit();

                }
                else
                {

                    partForbiddenObj = convertToObjFromMaintainInfo(partForbiddenObj, infoPartForbidden);

                    IUnitOfWork work = new UnitOfWork();

                    partRepository.SavePartForbiddenDefered(work, partForbiddenObj);

                    work.Commit();
                }

                return partForbiddenObj.ID;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:56,代码来源:PartForbiddenManager.cs

示例13: DeletePartForbidden

 public void DeletePartForbidden(int partForbiddenId)
 {
     try
     {
         PartForbidden objPartForbidden = partRepository.GetPartForbidden(partForbiddenId);
         IUnitOfWork work = new UnitOfWork();
         partRepository.DeletePartForbiddenDefered(work, objPartForbidden);
         work.Commit();
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }
开发者ID:wra222,项目名称:testgit,代码行数:20,代码来源:PartForbiddenManager.cs

示例14: 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
                        {
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:AcquireIMEI.cs

示例15: 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);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:51,代码来源:PCAOQCInput.cs


注:本文中的IMES.Infrastructure.UnitOfWork.UnitOfWork类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。