コード例 #1
0
 public HrUnitOfWork(IContextFactory <DbContext> contextFactory) // , int companyId, string culture
     : base(contextFactory)
 {
     // Initialize
     CompanyRepository          = new CompanyRepository(Context); // , companyId, culture
     PagesRepository            = new PagesRepository(Context);
     MenuRepository             = new MenuRepository(Context);
     PageEditorRepository       = new PageEditorRepository(Context);
     LookUpRepository           = new LookUpRepoitory(Context);
     CompanyStructureRepository = new CompanyStructureRepository(Context);
     JobRepository           = new JobRepository(Context);
     PeopleRepository        = new PeopleRepository(Context);
     PositionRepository      = new PositionRepository(Context);
     BudgetRepository        = new BudgetRepository(Context);
     QualificationRepository = new QualificationRepository(Context);
     LeaveRepository         = new LeaveRepository(Context);
     EmployeeRepository      = new EmployeeRepository(Context);
     CustodyRepository       = new CustodyRepository(Context);
     TrainingRepository      = new TrainingRepository(Context);
     BenefitsRepository      = new BenefitsRepository(Context);
     AudiTrialRepository     = new AudiTrialRepository(Context);
     TerminationRepository   = new TerminationRepository(Context);
     DisciplineRepository    = new DisciplineRepository(Context);
     CheckListRepository     = new CheckListRepository(Context);
     ComplaintRepository     = new ComplaintRepository(Context);
     MessageRepository       = new MessageRepository(Context);
     MedicalRepository       = new MedicalRepository(Context);
     HrLettersRepository     = new HRLettersRepository(Context);
     PayrollRepository       = new PayrollRepository(Context);
     SalaryDesignRepository  = new SalaryDesignRepository(Context);
     NotificationRepository  = new NotificationRepository(Context);
     MissionRepository       = new MissionRepository(Context);
     MeetingRepository       = new MeetingRepository(Context);
 }
コード例 #2
0
        public object GetDetails(int page, int rows, Position positions)
        {
            IQueryable <Position> positionQuery = PositionRepository.GetQueryable();
            IQueryable <Region>   regionQuery   = RegionRepository.GetQueryable();

            var positionDetail = positionQuery.Join(regionQuery,
                                                    p => p.RegionID,
                                                    r => r.ID,
                                                    (p, r) => new
            {
                p.ID,
                p.PositionName,
                p.RegionID,
                r.RegionName,
                p.SRMName,
                p.PositionType,
                p.TravelPos,
                p.LiftPos,
                p.Extension,
                p.Description,
                p.HasGoods,
                p.AbleStockOut,
                p.AbleStockInPallet,
                p.TagAddress,
                p.CurrentTaskID,
                p.CurrentOperateQuantity,
                p.ChannelCode,
                p.State
            })
                                 .Where(p => p.PositionName.Contains(positions.PositionName) &&
                                        p.SRMName.Contains(positions.SRMName) &&
                                        p.State.Contains(positions.State) &&
                                        p.PositionType.Contains(positions.PositionType))
                                 .OrderBy(ul => ul.ID);
            int total           = positionDetail.Count();
            var positionDetails = positionDetail.Skip((page - 1) * rows).Take(rows);
            var position_Detail = positionDetails.ToArray().Select(p => new
            {
                p.ID,
                p.PositionName,
                PositionType = p.PositionType == "01" ? "正常位置" : (p.PositionType == "02" ? "大品种出库位" : (p.PositionType == "03" ? "小品种出库位" : (p.PositionType == "04" ? "异形烟出库位" : "空托盘出库位"))),
                p.RegionID,
                p.RegionName,
                p.SRMName,
                p.TravelPos,
                p.LiftPos,
                Extension = p.Extension == 0 ? "单右伸" : (p.Extension == 4 ? "双右伸" : (p.Extension == 8 ? "单左伸" : "双左伸")),
                p.Description,
                HasGoods          = p.HasGoods == true ? "是" : "否",
                AbleStockOut      = p.AbleStockOut == true ? "是" : "否",
                AbleStockInPallet = p.AbleStockInPallet == true ? "是" : "否",
                p.TagAddress,
                p.CurrentTaskID,
                p.CurrentOperateQuantity,
                p.ChannelCode,
                State = p.State == "01" ? "可用" : "不可用",
            });

            return(new { total, rows = position_Detail.ToArray() });
        }
コード例 #3
0
        /// <summary>
        /// 根据模具号获得模具基本信息
        /// </summary>
        /// <param name="moldNR">模具号</param>
        /// <returns>模具基本信息</returns>
        public MoldBaseInfo GetMoldBaseInfoByNR(string moldNR)
        {
            using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
            {
                IMoldRepository       moldRepostitory = new MoldRepository(unitwork);
                IAttachmentRepository attachRep       = new AttachmentRepository(unitwork);
                IPositionRepository   posiRep         = new PositionRepository(unitwork);

                MoldView m = moldRepostitory.GetMoldViewByMoldNR(moldNR);
                if (m != null)
                {
                    MoldBaseInfo mb = new MoldBaseInfo()
                    {
                        MoldNR      = m.MoldNR,
                        Name        = m.Name,
                        Type        = m.TypeName,
                        Position    = posiRep.GetByFacilictyNR(moldNR).PositionNR,
                        Producer    = m.Producer,
                        Material    = m.Material,
                        Weight      = m.Weight == null ? string.Empty : m.Weight.ToString(),
                        State       = m.State,
                        StateCN     = m.StateCN,
                        ProjectId   = m.ProjectID,
                        ProjectName = m.ProjectName,
                        Attach      = attachRep.GetByMasterNR(moldNR)
                    };
                    return(mb);
                }
                return(null);
            }
        }
コード例 #4
0
 public WorkerData()
 {
     InitializeComponent();
     _worker   = new WorkerRepository();
     _position = new PositionRepository();
     _company  = new CompanyRepository();
 }
コード例 #5
0
ファイル: TaskService.cs プロジェクト: radtek/wms_rfid_mdj
        public bool CreateNewTaskForEmptyPalletSupply(int positionID)
        {
            string palletCode   = "";
            var    storageQuery = StorageRepository.GetQueryable()
                                  .Where(i => i.ProductCode == palletCode &&
                                         i.Quantity - i.OutFrozenQuantity > 0)
                                  .OrderBy(i => i.StorageTime);

            var storage  = storageQuery.FirstOrDefault();
            var position = PositionRepository.GetQueryable()
                           .Where(i => i.ID == positionID).FirstOrDefault();

            var positionCell = CellPositionRepository.GetQueryable()
                               .Where(i => i.StockInPositionID == positionID).FirstOrDefault();

            if (storage != null && position != null && positionCell != null)
            {
                var cellPosition = CellPositionRepository.GetQueryable()
                                   .Where(cp => cp.CellCode == storage.CellCode).FirstOrDefault();

                if (cellPosition != null)
                {
                    var path = PathRepository.GetQueryable()
                               .Where(p => p.OriginRegion == cellPosition.StockOutPosition.Region &&
                                      p.TargetRegion == position.Region)
                               .FirstOrDefault();
                    if (path != null)
                    {
                        var quantity = storage.Quantity - storage.OutFrozenQuantity;
                        storage.OutFrozenQuantity += quantity;

                        var newTask = new Task();
                        newTask.TaskType             = "01";
                        newTask.TaskLevel            = 0;
                        newTask.PathID               = path.ID;
                        newTask.ProductCode          = palletCode;
                        newTask.ProductName          = "空托盘";
                        newTask.OriginStorageCode    = storage.CellCode;
                        newTask.TargetStorageCode    = positionCell.CellCode;
                        newTask.OriginPositionID     = cellPosition.StockOutPositionID;
                        newTask.TargetPositionID     = positionID;
                        newTask.CurrentPositionID    = cellPosition.StockOutPositionID;
                        newTask.CurrentPositionState = "02";
                        newTask.State           = "01";
                        newTask.TagState        = "01";//拟不使用
                        newTask.Quantity        = Convert.ToInt32(storage.Quantity);
                        newTask.TaskQuantity    = Convert.ToInt32(quantity);
                        newTask.OperateQuantity = 0;
                        //newTask.OrderID = inItem.BillNo;
                        //newTask.OrderType = "01";
                        //newTask.AllotID = inItem.ID;
                        newTask.DownloadState = "1";
                        TaskRepository.Add(newTask);
                        TaskRepository.SaveChanges();
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #6
0
        public bool Add(Position position)
        {
            var post = new Position();

            try
            {
                var region = RegionRepository.GetQueryable().FirstOrDefault(r => r.ID == position.RegionID);
                post.ID                     = position.ID;
                post.PositionName           = position.PositionName;
                post.PositionType           = position.PositionType;
                post.RegionID               = position.RegionID;
                post.SRMName                = position.SRMName;
                post.TravelPos              = position.TravelPos;
                post.LiftPos                = position.LiftPos;
                post.Extension              = position.Extension;
                post.Description            = position.Description;
                post.HasGoods               = position.HasGoods;
                post.AbleStockOut           = position.AbleStockOut;
                post.AbleStockInPallet      = position.AbleStockInPallet;
                post.TagAddress             = position.TagAddress;
                post.CurrentOperateQuantity = position.CurrentOperateQuantity;
                post.CurrentTaskID          = position.CurrentTaskID;
                post.ChannelCode            = position.ChannelCode;
                post.State                  = position.State;

                PositionRepository.Add(post);
                PositionRepository.SaveChanges();
            }
            catch (Exception e) { }

            return(true);
        }
コード例 #7
0
 public StaffController()
 {
     _Employee_PositionRepository  = new Employee_PositionRepository();
     _EmploymentContractRepository = new EmploymentContractRepository();
     _EmployeeRepository           = new EmployeeRepository();
     _positionRepository           = new PositionRepository();
 }
コード例 #8
0
        public bool Delete(int positionId, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  pos    = PositionRepository.GetQueryable().FirstOrDefault(p => p.ID == positionId);

            if (pos != null)
            {
                try
                {
                    PositionRepository.Delete(pos);
                    PositionRepository.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    strResult = "原因:已在使用";
                }
            }
            else
            {
                strResult = "原因:未找到当前需要删除的数据!";
            }
            return(result);
        }
コード例 #9
0
ファイル: PositionService.cs プロジェクト: tw0r2/wms_rfid
        public bool Add(Position position)
        {
            var post = new Position();

            post.ID                     = position.ID;
            post.PositionName           = position.PositionName;
            post.PositionType           = position.PositionType;
            post.RegionID               = position.RegionID;
            post.SRMName                = position.SRMName;
            post.TravelPos              = position.TravelPos;
            post.LiftPos                = position.LiftPos;
            post.Extension              = position.Extension;
            post.Description            = position.Description;
            post.HasGoods               = position.HasGoods;
            post.AbleStockOut           = position.AbleStockOut;
            post.AbleStockInPallet      = position.AbleStockInPallet;
            post.TagAddress             = position.TagAddress;
            post.CurrentOperateQuantity = position.CurrentOperateQuantity;
            post.CurrentTaskID          = position.CurrentTaskID;
            post.ChannelCode            = position.ChannelCode;
            post.State                  = position.State;

            PositionRepository.Add(post);
            PositionRepository.SaveChanges();

            return(true);
        }
コード例 #10
0
ファイル: DataManager.cs プロジェクト: IlyaPershin/RManager
 public DataManager()
 {
     cont                       = new ModelContainer();
     branchRepository           = new BranchRepository(cont);
     categoryRepository         = new CategoryRepository(cont);
     checkDishRepository        = new CheckDishRepository(cont);
     checkMerchandiseRepository = new CheckMerchandiseRepository(cont);
     clientRepository           = new ClientRepository(cont);
     companyOwnerRepository     = new CompanyOwnerRepository(cont);
     companyRepository          = new CompanyRepository(cont);
     contactPersonRepository    = new ContactPersonRepository(cont);
     dishRepository             = new DishRepository(cont);
     documentRepository         = new DocumentRepository(cont);
     ejectionRepository         = new EjectionRepository(cont);
     employeeRepository         = new EmployeeRepository(cont);
     encashmentRepository       = new EncashmentRepository(cont);
     landlordRepository         = new LandlordRepository(cont);
     orderRepository            = new OrderRepository(cont);
     personRepository           = new PersonRepository(cont);
     positionRepository         = new PositionRepository(cont);
     prepackRepository          = new PrepackRepository(cont);
     productRepository          = new ProductRepository(cont);
     purchaseRepository         = new PurchaseRepository(cont);
     recipeDishIngrRepository   = new RecipeDishIngrRepository(cont);
     recipeDishPrepRepository   = new RecipeDishPrepRepository(cont);
     recipePrepIngrRepository   = new RecipePrepIngrRepository(cont);
     recipePrepPrepRepository   = new RecipePrepPrepRepository(cont);
     roomRepository             = new RoomRepository(cont);
     shiftRepository            = new ShiftRepository(cont);
     tableRepository            = new TableRepository(cont);
     warehouseRepository        = new WarehouseRepository(cont);
 }
コード例 #11
0
 //Return All
 public List <PositionViewModel> ReturnAllPositions(string searchCriteria = null)
 {
     using (var repository = new PositionRepository())
     {
         return(repository.GetAllPositions(searchCriteria).Select(x => x.ToModel()).ToList());
     }
 }
コード例 #12
0
 //Return
 public PositionViewModel ReturnPosition(int Id)
 {
     using (var repository = new PositionRepository())
     {
         return(repository.FindPosition(Id)?.ToModel());
     }
 }
コード例 #13
0
        public void SetState(short mode, int id)
        {
            var obj = Get(id);

            obj.Status = mode == 1;
            PositionRepository.SaveChanges();
        }
コード例 #14
0
ファイル: PathNodeService.cs プロジェクト: tw0r2/wms_rfid
        public object GetDetails(int page, int rows, PathNode pathNode)
        {
            //引入表
            IQueryable <PathNode> pathNodeQuery = PathNodeRepository.GetQueryable();
            IQueryable <Path>     pathQuery     = PathRepository.GetQueryable();
            IQueryable <Position> positionQuery = PositionRepository.GetQueryable();
            //关联表
            var pathNodeDetail = pathNodeQuery.Join(pathQuery,
                                                    pn => pn.PathID,
                                                    p => p.ID,
                                                    (pn, p) => new { pn.ID, pn.PathID, pn.PositionID, pn.PathNodeOrder, p.PathName })
                                 .Join(positionQuery,
                                       pn => pn.PositionID,
                                       p => p.ID,
                                       (pn, p) => new { pn.ID, pn.PathID, pn.PositionID, pn.PathNodeOrder, pn.PathName, p.PositionName })
                                 //.Where(p => p.PathName.Contains(PathName) && p.PositionName.Contains(PositionName))
                                 .OrderBy(p => p.ID);
            int total           = pathNodeDetail.Count();
            var pathNodeDetails = pathNodeDetail.Skip((page - 1) * rows).Take(rows);
            var pathNode_Detail = pathNodeDetails.ToArray().Select(p => new
            {
                p.ID,
                p.PathID,
                p.PathName,
                p.PositionID,
                p.PositionName,
                p.PathNodeOrder,
            });

            return(new { total, rows = pathNode_Detail.ToArray() });
        }
コード例 #15
0
        public OpResult Deletes(int[] ids)
        {
            var list = PositionRepository.GetQuery(o => ids.Contains(o.Id)).ToList();

            PositionRepository.RemoveRange(list);
            return(OpResult.Success());
        }
コード例 #16
0
        static void Main(string[] args)
        {
            ConfigureLogging();
            var positionRepo = new PositionRepository($"position-test", "PositionUpdated",
                                                      BuildEsConnection, new NLogLogger(LogManager.GetCurrentClassLogger()));

            positionRepo.Start().Wait();
            Log.Info($"Initial position is {positionRepo.Get()}");
            using (var connection = BuildEsConnection())
            {
                connection.ConnectAsync().Wait();
                var position = connection.AppendToStreamAsync("tests", ExpectedVersion.Any,
                                                              new List <EventData>
                {
                    new EventData(Guid.NewGuid(), "EventTested", true, Encoding.ASCII.GetBytes("abc"), null)
                })
                               .Result.LogPosition;
                positionRepo.Set(position);
            }
            Thread.Sleep(1500);
            Log.Info($"Event saved. Current position is {positionRepo.Get()}");
            Log.Info("Press enter to exit the program");
            Console.ReadLine();

            IEventStoreConnection BuildEsConnection()
            {
                return(EventStoreConnection.Create(
                           ConnectionSettings.Create().SetDefaultUserCredentials(new UserCredentials("admin", "changeit")),
                           new Uri("tcp://localhost:1113")));
            }
        }
コード例 #17
0
        public object GetDetails(int page, int rows, string CellCode, string StockInPosition, string StockOutPosition)
        {
            IQueryable <CellPosition> cellPositionQuery = CellPositionRepository.GetQueryable();
            IQueryable <Position>     positionQuery     = PositionRepository.GetQueryable();
            var cellPosition = cellPositionQuery.Join(positionQuery,
                                                      c => c.StockInPositionID,
                                                      p1 => p1.ID,
                                                      (c, p1) => new { c.ID, c.CellCode, c.StockInPositionID, c.StockOutPositionID, InName = p1.PositionName })
                               .Join(positionQuery,
                                     c => c.StockOutPositionID,
                                     p2 => p2.ID,
                                     (c, p2) => new { c.ID, c.CellCode, c.StockInPositionID, c.StockOutPositionID, c.InName, OutName = p2.PositionName })
                               .Where(p => p.CellCode.Contains(CellCode) && p.InName.Contains(StockInPosition) && p.OutName.Contains(StockOutPosition))
                               .OrderBy(p => p.ID).AsEnumerable()
                               .Select(p => new
            {
                p.ID,
                p.CellCode,
                p.StockInPositionID,
                p.InName,
                p.StockOutPositionID,
                p.OutName
            });

            int total = cellPosition.Count();

            cellPosition = cellPosition.Skip((page - 1) * rows).Take(rows);
            return(new { total, rows = cellPosition.ToArray() });
        }
コード例 #18
0
 public DictionaryController(ISessionContext sessionContext, BranchContext branchContext,
                             GroupRepository groupRepository, RoleRepository roleRepository,
                             BankRepository bankRepository, CarRepository carRepository,
                             ClientRepository clientRepository, PositionRepository positionRepository,
                             CategoryRepository categoryRepository, AccountRepository accountRepository,
                             UserRepository userRepository, PurityRepository purityRepository,
                             ExpenseGroupRepository expenseGroupRepository, ExpenseTypeRepository expenseTypeRepository,
                             MachineryRepository machineryRepository, OrganizationRepository organizationRepository,
                             ClientBlackListReasonRepository clientBlackListReasonRepository, InnerNotificationRepository innerNotificationRepository)
 {
     _sessionContext                  = sessionContext;
     _branchContext                   = branchContext;
     _groupRepository                 = groupRepository;
     _roleRepository                  = roleRepository;
     _bankRepository                  = bankRepository;
     _carRepository                   = carRepository;
     _clientRepository                = clientRepository;
     _positionRepository              = positionRepository;
     _categoryRepository              = categoryRepository;
     _accountRepository               = accountRepository;
     _userRepository                  = userRepository;
     _purityRepository                = purityRepository;
     _expenseGroupRepository          = expenseGroupRepository;
     _expenseTypeRepository           = expenseTypeRepository;
     _machineryRepository             = machineryRepository;
     _organizationRepository          = organizationRepository;
     _clientBlackListReasonRepository = clientBlackListReasonRepository;
     _innerNotificationRepository     = innerNotificationRepository;
 }
コード例 #19
0
        public void GetPositionTest()
        {
            var repo = new PositionRepository();

            var bundle = new FilterBundle <ReturnType>
            {
                FilterExpression = new List <FilterExpression>
                {
                    new FilterExpression
                    {
                        FilterOperation = FilterOperations.NotEqual,
                        Value           = null,
                        ColumnName      = "Email"
                    },
                    new FilterExpression
                    {
                        FilterOperation = FilterOperations.Contains,
                        Value           = "Tam",
                        ColumnName      = "Name"
                    }
                }
            };

            bundle.Orders.Add(new Order {
                ColumnName = "Name", Dir = OrderDirection.Desc
            });
            bundle.Orders.Add(new Order {
                ColumnName = "Salary", Dir = OrderDirection.Asc
            });
            var data = repo.GetPostions(bundle);

            Assert.IsNotNull(data);
        }
コード例 #20
0
ファイル: TaskService.cs プロジェクト: radtek/HNXC_WMS
        /// <summary>
        /// 移库但觉作业
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="errInfo">错误消息</param>
        /// <returns></returns>
        public bool MoveBIllTask(string billNo, out string errInfo)
        {
            bool result = true;

            errInfo = string.Empty;
            var moveQuery = MoveBillDetailRepository.GetQueryable().Where(i => i.BillNo == billNo);

            try
            {
                if (moveQuery.Any())
                {
                    foreach (var moveItem in moveQuery.ToArray())
                    {
                        //根据移出货位查找起始位置信息
                        var originCellPosition = CellPositionRepository.GetQueryable().FirstOrDefault(c => c.CellCode == moveItem.OutCellCode);
                        //根据移入货位查找目标位置信息
                        var targetCellPosition = CellPositionRepository.GetQueryable().FirstOrDefault(c => c.CellCode == moveItem.InCellCode);
                        //根据移出位置ID去找起始区域ID信息
                        var originPosition = PositionRepository.GetQueryable().FirstOrDefault(p => p.ID == originCellPosition.StockOutPositionID);
                        //根据移入位置ID去找目标区域ID信息
                        var targetPosition = PositionRepository.GetQueryable().FirstOrDefault(p => p.ID == targetCellPosition.StockInPositionID);
                        //根据入库的目标区域和起始位置区域去找路径信息
                        var path     = PathRepository.GetQueryable().FirstOrDefault(p => p.OriginRegionID == originPosition.RegionID && p.TargetRegionID == targetPosition.RegionID);
                        var moveTask = new Task();
                        moveTask.TaskType             = "01";
                        moveTask.TaskLevel            = 0;
                        moveTask.PathID               = path.ID;
                        moveTask.ProductCode          = moveItem.Product.ProductCode;
                        moveTask.ProductName          = moveItem.Product.ProductName;
                        moveTask.OriginStorageCode    = moveItem.OutCellCode;
                        moveTask.TargetStorageCode    = moveItem.InCellCode;
                        moveTask.OriginPositionID     = originPosition.ID;
                        moveTask.TargetPositionID     = targetPosition.ID;
                        moveTask.CurrentPositionID    = originPosition.ID;
                        moveTask.CurrentPositionState = "01";
                        moveTask.State           = "01";
                        moveTask.TagState        = "01";
                        moveTask.Quantity        = Convert.ToInt32(moveItem.RealQuantity);
                        moveTask.TaskQuantity    = Convert.ToInt32(moveItem.RealQuantity);
                        moveTask.OperateQuantity = Convert.ToInt32(moveItem.RealQuantity);
                        moveTask.OrderID         = moveItem.BillNo;
                        moveTask.OrderType       = "02";
                        moveTask.AllotID         = moveItem.ID;
                        TaskRepository.Add(moveTask);
                    }
                    TaskRepository.SaveChanges();
                }
                else
                {
                    errInfo = "当前选择订单没有移库细表数据,请重新选择!";
                }
            }
            catch (Exception e)
            {
                result  = false;
                errInfo = e.Message;
            }
            return(result);
        }
コード例 #21
0
 public int Update(IPositionModel businessModel)
 {
     using (Repository = new PositionRepository())
     {
         Message = UpdateSuccessMessage;
         return(Repository.Update(businessModel));
     }
 }
コード例 #22
0
 public UnitOfWork()
 {
     this.context            = new EmployeeManagementContext();
     this.positionRepository = new PositionRepository(context);
     this.employeeRepository = new EmployeeRepository(context);
     this.careerRepository   = new CareerRepository(context);
     this.disposed           = false;
 }
コード例 #23
0
 public int Delete(int id)
 {
     using (Repository = new PositionRepository())
     {
         Message = DeleteSuccessMessage;
         return(Repository.Delete(id));
     }
 }
コード例 #24
0
 public IEnumerable <T> Get <T>(params IListParameter[] parameter) where  T : IPositionModel
 {
     using (Repository = new PositionRepository())
     {
         var data = Repository.Get <T>(parameter);
         return(data);
     }
 }
コード例 #25
0
 public override IEnumerable <T> Get <T>(int start, int limit, string sort, string dir, out int totalCount, params IListParameter[] parameter)
 {
     using (Repository = new PositionRepository())
     {
         var data = Repository.Get <IPositionModel>(start, limit, sort, dir, out totalCount, parameter);
         return(data as IEnumerable <T>);
     }
 }
コード例 #26
0
 /// <summary>
 /// 根据库存号判断库存是否存在
 /// </summary>
 /// <param name="posiNr">库存号</param>
 /// <returns>判断结果</returns>
 public bool PositionExist(string posiNr)
 {
     using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
     {
         IPositionRepository posiRep = new PositionRepository(unitwork);
       return  posiRep.PositionExsit(posiNr);
     }
 }
コード例 #27
0
 public int Save(IPositionModel businessModel)
 {
     using (Repository = new PositionRepository())
     {
         Message = SaveSuccessMessage;
         return(Repository.Save(businessModel));
     }
 }
コード例 #28
0
    void Awake()
    {
        Instance = this;

        positionRepository = new PositionRepository();
        LoadAndSetPosition(LoginManager.Instance.LoggedPlayerID);
        LoadAndSetRotation(LoginManager.Instance.LoggedPlayerID);
    }
コード例 #29
0
 /// <summary>
 /// 根据模具号获得库位
 /// </summary>
 /// <param name="moldNR">模具号</param>
 /// <returns>库位</returns>
 public Position GetMoldPositionByNr(string moldNR)
 {
     using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
     {
         IPositionRepository posiRep = new PositionRepository(unitwork);
         return(posiRep.GetByFacilictyNR(moldNR));
     }
 }
コード例 #30
0
 public PositionTransformer(ApplicationDbContext context, ResManager resManager, HttpContext httpContext = null) : base(context, resManager)
 {
     positionRepository = new PositionRepository(context, resManager);
     if (httpContext != null)
     {
         currentUser = httpContext.GetCurrentUser(context);
     }
 }
コード例 #31
0
        public void Integration_GetCurrentPosition_ShouldReturnEnumerableOfPositions()
        {
            var screenScrapper = new ScreenScapper();
            var context = new InvestmentDbContextProvider();
            var positionRepository = new PositionRepository(context);
            var sut = new PositionService(positionRepository, screenScrapper);

            var actual = sut.GetCurrentPosition();

            Assert.AreEqual(17, actual.ToList().Count);
        }
コード例 #32
0
        public void Can_remove_existing_Position()
        {
            var Position = new Position() { Id = "1B" };
            IPositionRepository repository = new PositionRepository();
            repository.Delete(Position);

            using (ISession session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<Position>(Position.Id);
                Assert.IsNull(fromDb);
            }
        }
コード例 #33
0
        public void Can_update_existing_Position()
        {
            IPositionRepository repository = new PositionRepository();
            var Position = new Position() { Id = "1B", Type = PositionType.P };
            repository.Save(Position);

            // use session to try to load the product
            using (ISession session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<Position>(Position.Id);
                Assert.AreEqual(Position.Type, fromDb.Type);
            }
        }
コード例 #34
0
        public void Can_add_new_Position()
        {
            var Position = new Position { Id = "3B", Name = "Third Base" };
            IPositionRepository repository = new PositionRepository();
            repository.Save(Position);

            // use session to try to load the product
            using (ISession session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<Position>(Position.Id);
                // Test that the product was successfully inserted
                Assert.IsNotNull(fromDb);
                Assert.AreNotSame(Position, fromDb);
                Assert.AreEqual(Position.Name, fromDb.Name);
            }
        }
コード例 #35
0
 public void Can_get_existing_Position_by_id()
 {
     IPositionRepository repository = new PositionRepository();
     var fromDb = repository.GetById("1B");
     Assert.IsNotNull(fromDb);
     Assert.AreEqual("First Base", fromDb.Name);
 }