Ejemplo n.º 1
0
        /// <summary>
        /// 获取包裹列表
        /// </summary>
        /// <returns></returns>
        public List <Package> GetPackages()
        {
            DataTable   table = null;
            LoggingData data  = new LoggingData(ip, username, password, database);

            table = data.GetPackage();
            if (table == null)
            {
                CLog4net.LogError("快递表初始化错误");
                return(null);
            }

            List <Package> packages = new List <Package>();

            foreach (System.Data.DataRow d in table.Rows)
            {
                Package p = new Package();

                /**
                 * 从数据库中读取未被取走的快递
                 * */
                p.Courier     = new Courier(Convert.ToString(d[TbPackage.courierCode]));
                p.CreatedTime = Convert.ToDateTime(d[TbPackage.createdTime]);
                if (d[TbPackage.deletedTime].ToString() != "")
                {
                    p.DeletedTime = Convert.ToDateTime(d[TbPackage.deletedTime]);
                }
                p.Place = BoxsManager.GetInstance().Find(Convert.ToInt32(d[TbPackage.boxCode]));
                if (d[TbPackage.receiverIdentity].ToString() != "")
                {
                    p.ReceiverIdentity = Convert.ToByte(d[TbPackage.receiverIdentity]);
                }
                p.ReceiverTelNum = Convert.ToString(d[TbPackage.receiverTelNum]);
                p.RemarkInfo     = Convert.ToString(d[TbPackage.remark]);
                p.SN             = Convert.ToString(d[TbPackage.packageCode]);
                p.Taken          = Convert.ToBoolean(d[TbPackage.taken]);

                packages.Add(p);
            }

            return(packages);
        }