• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnitOfWork.UnitOfWork类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddFamily

        /// <summary>
        /// 保存一条family的记录数据(Add)
        /// </summary>
        /// <param name="Object"></param>
        public void AddFamily(FamilyDef obj)
        {
            FamilyDef familyObj = obj;

            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                UnitOfWork uow = new UnitOfWork();
                Family item = new Family(obj.Family,obj.Descr,obj.CustomerID);
                item.FamilyName = obj.Family;
                item.Customer = obj.CustomerID;
                item.Description = obj.Descr;
                item.Editor = obj.Editor;
                item.Cdt = DateTime.Now;
                item.Udt = DateTime.Now;
                itemRepository.Add(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }


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


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


示例18: DoExecute

        /// <summary>
        /// 產生CustomerSN號相关逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        { 
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            //lock (_syncRoot_GetSeq)//用于防止同一段代码被同时执行,以前只有一个Service时有效,现在多个Service没有去掉,聊胜于无

            //var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //logger.InfoFormat("GenerateCustomerSnActivity: CurrentSession Hash: {0}; CurrentSession Key: {1}; CurrentSession Type: {2}", CurrentSession.GetHashCode().ToString(), CurrentSession.Key, CurrentSession.Type.ToString());
            //logger.InfoFormat("GenerateCustomerSnActivity: IProduct Hash: {0}; IProduct Key: {1}", product.GetHashCode().ToString(), product.Key);

            //need modify
            try
            {
                //CN(中try国代码)+U(Site Code)+年尾码+周别码+流水码
                string custSn = "";
                DateTime curDate = DateTime.Now;
               // string year = curDate.Year.ToString();
                string maxnum = "";
                string prestr = "";
                //求当前日期是一年的中第几周
                //int weeks = 0;
                DateTime dateTime = DateTime.Now;//new DateTime(2016,1,1);
                var ret = IMES.Infrastructure.Utility.Generates.WeekRuleEngine.Calculate("103", dateTime);
                string weekCode = ret.Week.ToString().PadLeft(2, '0');
                string year = ret.Year.ToString();//dateTime.Year.ToString();

                custSn = "CN" + "U" + custSn + year.Substring(year.Length - 1, 1) + weekCode;//weeks.ToString("d2");
                prestr = custSn;
                // 自己管理事务开始
                SqlTransactionManager.Begin();
                IUnitOfWork uof = new UnitOfWork();//使用自己的UnitOfWork


                //从NumControl中获取流水号
                //GetMaxNumber
                INumControlRepository numControl = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                bool addflag = false;
                maxnum = numControl.GetMaxNumber("CPQSNO", prestr + "{0}");
                if (string.IsNullOrEmpty(maxnum))
                {
                    maxnum = "Z000";    //起始值:Z000
                    addflag = true;
                }
                else
                {
                    //maxnum="CNU248000Y";
                    string temstr = "Z000"; //起始值:Z000
                    string numstr = maxnum.Substring(maxnum.Length - 4);
                    temstr = numstr;

                    if (numstr.ToUpper() == "YZZZ")
                    {
                        FisException fe = new FisException("CHK867", new string[] { });   //流水号已满!
                        throw fe;
                    }

                    string[] seqLst = new string[4];
                    seqLst[0] = temstr.Substring(0, 1);
                    seqLst[1] = temstr.Substring(1, 1);
                    seqLst[2] = temstr.Substring(2, 1);
                    seqLst[3] = temstr.Substring(3, 1);
                    
                    int[] idexLst = getSeqNum(seqLst);

                    if (idexLst[3] == 30)
                    {
                        if (idexLst[2] == 30)
                        {
                            if (idexLst[1] == 30)
                            {
                                if (idexLst[0] == 29)
                                {
                                    List<string> errpara = new List<string>();
                                    throw new FisException("CHK867", errpara);  //流水号已满!
                                }
                                else
                                {
                                    if (idexLst[0] == 30)
                                    {
                                        idexLst[0] = 28;
                                    }
                                    else if (idexLst[0] == 28)
                                    {
                                        idexLst[0] = 27;
                                    }
                                    else if (idexLst[0] == 27)
                                    {
                                        idexLst[0] = 29;
                                    }
                                    else
                                    {
                                        List<string> errpara = new List<string>();
                                        throw new FisException("CHK867", errpara);  //非合法的Z、X、W、Y,视为满
                                    }
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:GenerateCustomerSnForDocking.cs


示例19: UpdateMACRange

        /// <summary>
        /// 保存一条MACRang的记录数据(update)
        /// </summary>
        /// <param name="Object"></param>
        /// <returns></returns>
        public void UpdateMACRange(MACRangeDef obj, String oldMACRangeId)
        {
            try
            {
                INumControlRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository>();

                UnitOfWork uow = new UnitOfWork();
                MACRange item = itemRepository.GetMACRange(Int32.Parse(obj.id));
                //if (item.Status != "R" && (item.BegNo != obj.BegNo || item.EndNo != obj.EndNo))
                //{
                //    List<string> erpara = new List<string>();
                //    FisException ex;
                //    ex = new FisException("MDT001", erpara);
                //    throw ex;
                //}

                item.Code= obj.Code;
                item.BegNo=obj.BegNo;
                item.EndNo=obj.EndNo;
                //item.Status=obj.Status;
                item.Editor=obj.Editor;
                item.Udt= DateTime.Now;

                itemRepository.UpdateMACRange(item);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:36,代码来源:CommonImpl.cs


示例20: DeleteWarranty

        /// <summary>
        /// 删除一条Warranty数据
        /// </summary>
        /// <param name="?"></param>
        public void DeleteWarranty(String id)
        {
            try
            {
                IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
                UnitOfWork uow = new UnitOfWork();
                Warranty item = itemRepository.Find(Int32.Parse(id));
                               
                itemRepository.Remove(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Api.PetApi类代码示例发布时间:2022-05-26
下一篇:
C# DependencyAnalysis.ObjectDataBuilder类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap