Example #1
0
        public bool Save(CellPosition CellPosition, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  c      = CellPositionRepository.GetQueryable().FirstOrDefault(s => s.ID == CellPosition.ID);

            if (c != null)
            {
                try
                {
                    c.CellCode           = CellPosition.CellCode;
                    c.StockInPositionID  = CellPosition.StockInPositionID;
                    c.StockOutPositionID = CellPosition.StockOutPositionID;

                    CellPositionRepository.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    strResult = "原因:" + ex.Message;
                }
            }
            else
            {
                strResult = "原因:未找到当前需要修改的数据!";
            }
            return(result);
        }
Example #2
0
        public bool Add(CellPosition cellPosition, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  c      = new CellPosition();

            if (c != null)
            {
                try
                {
                    c.CellCode           = cellPosition.CellCode;
                    c.StockInPositionID  = cellPosition.StockInPositionID;
                    c.StockOutPositionID = cellPosition.StockOutPositionID;

                    CellPositionRepository.Add(c);
                    CellPositionRepository.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    strResult = "原因:" + ex.Message;
                }
            }
            else
            {
                strResult = "原因:找不到当前登陆用户!请重新登陆!";
            }
            return(result);
        }
Example #3
0
        public bool Delete(int cellPositionId, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  c      = CellPositionRepository.GetQueryable().FirstOrDefault(s => s.ID == cellPositionId);

            if (c != null)
            {
                try
                {
                    CellPositionRepository.Delete(c);
                    CellPositionRepository.SaveChanges();
                    result = true;
                }
                catch (Exception)
                {
                    strResult = "原因:已在使用";
                }
            }
            else
            {
                strResult = "原因:未找到当前需要删除的数据!";
            }
            return(result);
        }
Example #4
0
        public bool Add(CellPosition cellPosition)
        {
            var cp = new CellPosition();

            cp.ID                 = cellPosition.ID;
            cp.CellCode           = cellPosition.CellCode;
            cp.StockInPositionID  = cellPosition.StockInPositionID;
            cp.StockOutPositionID = cellPosition.StockOutPositionID;
            CellPositionRepository.Add(cp);
            CellPositionRepository.SaveChanges();
            return(true);
        }
Example #5
0
        public bool Delete(int cellPositionId)
        {
            var cp = CellPositionRepository.GetQueryable().FirstOrDefault(s => s.ID == cellPositionId);

            if (cp != null)
            {
                CellPositionRepository.Delete(cp);
                CellPositionRepository.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Example #6
0
        public bool Save(CellPosition cellPosition)
        {
            IQueryable <Cell>     cellQuery     = CellRepository.GetQueryable();
            IQueryable <Position> positionQuery = PositionRepository.GetQueryable();
            var cell = cellQuery.FirstOrDefault(p => p.CellCode == cellPosition.CellCode);
            var c    = CellPositionRepository.GetQueryable().FirstOrDefault(s => s.ID == cellPosition.ID);

            //var position = positionQuery.FirstOrDefault(po => po.ID == cellPosition.ID);
            if (c != null)
            {
                c.ID                 = cellPosition.ID;
                c.CellCode           = cellPosition.CellCode;
                c.StockInPositionID  = cellPosition.StockInPositionID;
                c.StockOutPositionID = cellPosition.StockOutPositionID;
                CellPositionRepository.SaveChanges();
            }

            return(true);
        }