Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<DTcms.Model.CheckCost> DataTableToList(DataTable dt)
        {
            List<DTcms.Model.CheckCost> modelList = new List<DTcms.Model.CheckCost>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                DTcms.Model.CheckCost model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DTcms.Model.CheckCost();
                    if (dt.Rows[n]["CheckRecordId"].ToString() != "")
                    {
                        model.CheckRecordId = int.Parse(dt.Rows[n]["CheckRecordId"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["Count"].ToString() != "")
                    {
                        model.Count = decimal.Parse(dt.Rows[n]["Count"].ToString());
                    }
                    if (dt.Rows[n]["UnitPrice"].ToString() != "")
                    {
                        model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString());
                    }
                    if (dt.Rows[n]["TotalPrice"].ToString() != "")
                    {
                        model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString());
                    }
                    if (dt.Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
                    }
                    if (dt.Rows[n]["PaidTime"].ToString() != "")
                    {
                        model.PaidTime = DateTime.Parse(dt.Rows[n]["PaidTime"].ToString());
                    }
                    model.Admin = dt.Rows[n]["Admin"].ToString();
                    model.Customer = dt.Rows[n]["Customer"].ToString();
                    if (dt.Rows[n]["HasBeenInvoiced"].ToString() != "")
                    {
                        if ((dt.Rows[n]["HasBeenInvoiced"].ToString() == "1") || (dt.Rows[n]["HasBeenInvoiced"].ToString().ToLower() == "true"))
                        {
                            model.HasBeenInvoiced = true;
                        }
                        else
                        {
                            model.HasBeenInvoiced = false;
                        }
                    }
                    if (dt.Rows[n]["InvoicedTime"].ToString() != "")
                    {
                        model.InvoicedTime = DateTime.Parse(dt.Rows[n]["InvoicedTime"].ToString());
                    }
                    model.InvoicedOperator = dt.Rows[n]["InvoicedOperator"].ToString();
                    model.Remark = dt.Rows[n]["Remark"].ToString();

                    modelList.Add(model);
                }
            }
            return modelList;
        }
Exemple #2
0
 public void AddCheckCost(CheckCost checkCost)
 {
     _checkCosts.Add(checkCost);
 }
Exemple #3
0
 public bool Update(DTcms.Model.CheckCost model, int id)
 {
     return(dal.Update(model, id));
 }
Exemple #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(DTcms.Model.CheckCost model)
 {
     dal.Add(model);
 }
Exemple #5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DTcms.Model.CheckCost> DataTableToList(DataTable dt)
        {
            List <DTcms.Model.CheckCost> modelList = new List <DTcms.Model.CheckCost>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DTcms.Model.CheckCost model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DTcms.Model.CheckCost();
                    if (dt.Rows[n]["CheckRecordId"].ToString() != "")
                    {
                        model.CheckRecordId = int.Parse(dt.Rows[n]["CheckRecordId"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["Count"].ToString() != "")
                    {
                        model.Count = decimal.Parse(dt.Rows[n]["Count"].ToString());
                    }
                    if (dt.Rows[n]["UnitPrice"].ToString() != "")
                    {
                        model.UnitPrice = decimal.Parse(dt.Rows[n]["UnitPrice"].ToString());
                    }
                    if (dt.Rows[n]["TotalPrice"].ToString() != "")
                    {
                        model.TotalPrice = decimal.Parse(dt.Rows[n]["TotalPrice"].ToString());
                    }
                    if (dt.Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
                    }
                    if (dt.Rows[n]["PaidTime"].ToString() != "")
                    {
                        model.PaidTime = DateTime.Parse(dt.Rows[n]["PaidTime"].ToString());
                    }
                    model.Admin    = dt.Rows[n]["Admin"].ToString();
                    model.Customer = dt.Rows[n]["Customer"].ToString();
                    if (dt.Rows[n]["HasBeenInvoiced"].ToString() != "")
                    {
                        if ((dt.Rows[n]["HasBeenInvoiced"].ToString() == "1") || (dt.Rows[n]["HasBeenInvoiced"].ToString().ToLower() == "true"))
                        {
                            model.HasBeenInvoiced = true;
                        }
                        else
                        {
                            model.HasBeenInvoiced = false;
                        }
                    }
                    if (dt.Rows[n]["InvoicedTime"].ToString() != "")
                    {
                        model.InvoicedTime = DateTime.Parse(dt.Rows[n]["InvoicedTime"].ToString());
                    }
                    model.InvoicedOperator = dt.Rows[n]["InvoicedOperator"].ToString();
                    model.Remark           = dt.Rows[n]["Remark"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }