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

            if (rowsCount > 0)
            {
                DNSABC.Model.DNSABC_Invoice model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DNSABC.Model.DNSABC_Invoice();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["InvoiceName"] != null && dt.Rows[n]["InvoiceName"].ToString() != "")
                    {
                        model.InvoiceName = dt.Rows[n]["InvoiceName"].ToString();
                    }
                    if (dt.Rows[n]["Price"] != null && dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = int.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    if (dt.Rows[n]["PostType"] != null && dt.Rows[n]["PostType"].ToString() != "")
                    {
                        model.PostType = int.Parse(dt.Rows[n]["PostType"].ToString());
                    }
                    if (dt.Rows[n]["RealName"] != null && dt.Rows[n]["RealName"].ToString() != "")
                    {
                        model.RealName = dt.Rows[n]["RealName"].ToString();
                    }
                    if (dt.Rows[n]["Tel"] != null && dt.Rows[n]["Tel"].ToString() != "")
                    {
                        model.Tel = dt.Rows[n]["Tel"].ToString();
                    }
                    if (dt.Rows[n]["Mobil"] != null && dt.Rows[n]["Mobil"].ToString() != "")
                    {
                        model.Mobil = dt.Rows[n]["Mobil"].ToString();
                    }
                    if (dt.Rows[n]["Address"] != null && dt.Rows[n]["Address"].ToString() != "")
                    {
                        model.Address = dt.Rows[n]["Address"].ToString();
                    }
                    if (dt.Rows[n]["PostCode"] != null && dt.Rows[n]["PostCode"].ToString() != "")
                    {
                        model.PostCode = dt.Rows[n]["PostCode"].ToString();
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
                    {
                        model.State = int.Parse(dt.Rows[n]["State"].ToString());
                    }
                    if (dt.Rows[n]["AdminRemark"] != null && dt.Rows[n]["AdminRemark"].ToString() != "")
                    {
                        model.AdminRemark = dt.Rows[n]["AdminRemark"].ToString();
                    }
                    if (dt.Rows[n]["CreateTime"] != null && dt.Rows[n]["CreateTime"].ToString() != "")
                    {
                        model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }