Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JY.Model.ReceiptAddress> DataTableToList(DataTable dt)
        {
            List <JY.Model.ReceiptAddress> modelList = new List <JY.Model.ReceiptAddress>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JY.Model.ReceiptAddress model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JY.Model.ReceiptAddress();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = long.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["MemberId"] != null && dt.Rows[n]["MemberId"].ToString() != "")
                    {
                        model.MemberId = int.Parse(dt.Rows[n]["MemberId"].ToString());
                    }
                    if (dt.Rows[n]["Consignee"] != null && dt.Rows[n]["Consignee"].ToString() != "")
                    {
                        model.Consignee = dt.Rows[n]["Consignee"].ToString();
                    }
                    if (dt.Rows[n]["LiveAdderss"] != null && dt.Rows[n]["LiveAdderss"].ToString() != "")
                    {
                        model.LiveAdderss = dt.Rows[n]["LiveAdderss"].ToString();
                    }
                    if (dt.Rows[n]["Phone"] != null && dt.Rows[n]["Phone"].ToString() != "")
                    {
                        model.Phone = dt.Rows[n]["Phone"].ToString();
                    }
                    if (dt.Rows[n]["ZipCode"] != null && dt.Rows[n]["ZipCode"].ToString() != "")
                    {
                        model.ZipCode = dt.Rows[n]["ZipCode"].ToString();
                    }
                    if (dt.Rows[n]["CreateDate"] != null && dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    if (dt.Rows[n]["Sort"] != null && dt.Rows[n]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(dt.Rows[n]["Sort"].ToString());
                    }
                    if (dt.Rows[n]["IsDelete"] != null && dt.Rows[n]["IsDelete"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsDelete"].ToString() == "1") || (dt.Rows[n]["IsDelete"].ToString().ToLower() == "true"))
                        {
                            model.IsDelete = true;
                        }
                        else
                        {
                            model.IsDelete = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JY.Model.ReceiptAddress model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(JY.Model.ReceiptAddress model)
 {
     return(dal.Add(model));
 }