コード例 #1
0
ファイル: DeliverLineService.cs プロジェクト: tw0r2/wms_rfid
        public bool Add(DeliverLine deliverLine, out string strResult)
        {
            strResult = string.Empty;
            bool result       = false;
            var  deliver_line = new DeliverLine();

            if (deliverLine != null)
            {
                try
                {
                    deliver_line.DeliverLineCode = deliverLine.DeliverLineCode;
                    deliver_line.CustomCode      = deliverLine.CustomCode;
                    deliver_line.DeliverLineName = deliverLine.DeliverLineName;
                    deliver_line.DistCode        = deliverLine.DistCode;
                    deliver_line.DeliverOrder    = deliverLine.DeliverOrder;
                    deliver_line.Description     = deliverLine.Description;
                    deliver_line.IsActive        = deliverLine.IsActive;
                    deliver_line.UpdateTime      = DateTime.Now;

                    DeliverLineRepository.Add(deliver_line);
                    DeliverLineRepository.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    strResult = "原因:" + ex.InnerException;
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: DeliverLineService.cs プロジェクト: tw0r2/wms_rfid
        public bool Delete(string DeliverLineCode)
        {
            var deliver_Line = DeliverLineRepository.GetQueryable()
                               .FirstOrDefault(i => i.DeliverLineCode == DeliverLineCode);

            if (DeliverLineCode != null)
            {
                DeliverLineRepository.Delete(deliver_Line);
                DeliverLineRepository.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #3
0
ファイル: DeliverLineService.cs プロジェクト: tw0r2/wms_rfid
 public bool Edit(DeliverLine deliverLine, out string strResult)
 {
     strResult = string.Empty;
     try
     {
         var deliver_line = DeliverLineRepository.GetQueryable().FirstOrDefault(i => i.DeliverLineCode == deliverLine.DeliverLineCode);
         deliver_line.DeliverLineCode = deliverLine.DeliverLineCode;
         deliver_line.CustomCode      = deliverLine.CustomCode;
         deliver_line.DeliverLineName = deliverLine.DeliverLineName;
         deliver_line.DistCode        = deliverLine.DistCode;
         deliver_line.DeliverOrder    = deliverLine.DeliverOrder;
         deliver_line.Description     = deliverLine.Description;
         deliver_line.IsActive        = deliverLine.IsActive;
         deliver_line.UpdateTime      = DateTime.Now;
         DeliverLineRepository.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         strResult = "原因:" + ex.InnerException;
         return(false);
     }
 }
コード例 #4
0
ファイル: DeliverLineService.cs プロジェクト: tw0r2/wms_rfid
        public bool DownDeliverLine(out string errorInfo)
        {
            errorInfo = string.Empty;
            bool result = false;

            try
            {
                var    deliverLineCodes = DeliverLineRepository.GetQueryable().Where(d => d.DeliverLineCode == d.DeliverLineCode).Select(s => new { s.DeliverLineCode }).ToArray();
                string deliverStrs      = "";
                for (int i = 0; i < deliverLineCodes.Length; i++)
                {
                    deliverStrs += deliverLineCodes[i].DeliverLineCode + ",";
                }
                DeliverLine[] deliverLines = DeliverLineDownService.GetDeliverLine(deliverStrs);
                foreach (var item in deliverLines)
                {
                    var deliverLine = new DeliverLine();
                    deliverLine.DeliverLineCode = item.DeliverLineCode;
                    deliverLine.DeliverLineName = item.DeliverLineName;
                    deliverLine.DeliverOrder    = item.DeliverOrder;
                    deliverLine.Description     = item.Description;
                    deliverLine.DistCode        = item.DistCode;
                    deliverLine.CustomCode      = item.CustomCode;
                    deliverLine.IsActive        = item.IsActive;
                    deliverLine.UpdateTime      = item.UpdateTime;
                    DeliverLineRepository.Add(deliverLine);
                }
                DeliverLineRepository.SaveChanges();
                result = true;
            }
            catch (Exception e)
            {
                errorInfo = "出错,原因:" + e.Message;
            }
            return(result);
        }