Exemple #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(JY.Model.OrderForm model)
 {
     return(dal.Add(model));
 }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JY.Model.OrderForm model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JY.Model.OrderForm> DataTableToList(DataTable dt)
        {
            List <JY.Model.OrderForm> modelList = new List <JY.Model.OrderForm>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JY.Model.OrderForm model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JY.Model.OrderForm();
                    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 = long.Parse(dt.Rows[n]["MemberId"].ToString());
                    }
                    if (dt.Rows[n]["OrderFormNo"] != null && dt.Rows[n]["OrderFormNo"].ToString() != "")
                    {
                        model.OrderFormNo = dt.Rows[n]["OrderFormNo"].ToString();
                    }
                    if (dt.Rows[n]["ProductTotalPrice"] != null && dt.Rows[n]["ProductTotalPrice"].ToString() != "")
                    {
                        model.ProductTotalPrice = decimal.Parse(dt.Rows[n]["ProductTotalPrice"].ToString());
                    }
                    if (dt.Rows[n]["Purchaser"] != null && dt.Rows[n]["Purchaser"].ToString() != "")
                    {
                        model.Purchaser = dt.Rows[n]["Purchaser"].ToString();
                    }
                    if (dt.Rows[n]["Consignee"] != null && dt.Rows[n]["Consignee"].ToString() != "")
                    {
                        model.Consignee = dt.Rows[n]["Consignee"].ToString();
                    }
                    if (dt.Rows[n]["LiveAddress"] != null && dt.Rows[n]["LiveAddress"].ToString() != "")
                    {
                        model.LiveAddress = dt.Rows[n]["LiveAddress"].ToString();
                    }
                    if (dt.Rows[n]["ZipCode"] != null && dt.Rows[n]["ZipCode"].ToString() != "")
                    {
                        model.ZipCode = dt.Rows[n]["ZipCode"].ToString();
                    }
                    if (dt.Rows[n]["Phone"] != null && dt.Rows[n]["Phone"].ToString() != "")
                    {
                        model.Phone = dt.Rows[n]["Phone"].ToString();
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    if (dt.Rows[n]["CreatDate"] != null && dt.Rows[n]["CreatDate"].ToString() != "")
                    {
                        model.CreatDate = DateTime.Parse(dt.Rows[n]["CreatDate"].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);
        }