示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <MobileSoft.Model.Charge.Tb_Charge_Receipt> DataTableToList(DataTable dt)
        {
            List <MobileSoft.Model.Charge.Tb_Charge_Receipt> modelList = new List <MobileSoft.Model.Charge.Tb_Charge_Receipt>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                MobileSoft.Model.Charge.Tb_Charge_Receipt model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model             = new MobileSoft.Model.Charge.Tb_Charge_Receipt();
                    model.ReceiptCode = dt.Rows[n]["ReceiptCode"].ToString();
                    model.BussId      = long.Parse(dt.Rows[n]["BussId"].ToString());
                    model.OrderId     = dt.Rows[n]["OrderId"].ToString();
                    model.ReceiptSign = dt.Rows[n]["ReceiptSign"].ToString();
                    if (dt.Rows[n]["Receivables"].ToString() != "")
                    {
                        model.Receivables = decimal.Parse(dt.Rows[n]["Receivables"].ToString());
                    }
                    model.Method         = dt.Rows[n]["Method"].ToString();
                    model.CardNum        = dt.Rows[n]["CardNum"].ToString();
                    model.MemberCardCode = dt.Rows[n]["MemberCardCode"].ToString();
                    model.CustCode       = dt.Rows[n]["CustCode"].ToString();
                    if (dt.Rows[n]["Balance"].ToString() != "")
                    {
                        model.Balance = decimal.Parse(dt.Rows[n]["Balance"].ToString());
                    }
                    if (dt.Rows[n]["Discount"].ToString() != "")
                    {
                        model.Discount = decimal.Parse(dt.Rows[n]["Discount"].ToString());
                    }
                    if (dt.Rows[n]["Amount"].ToString() != "")
                    {
                        model.Amount = decimal.Parse(dt.Rows[n]["Amount"].ToString());
                    }
                    model.ReceiptMemo = dt.Rows[n]["ReceiptMemo"].ToString();
                    model.ReceiptType = dt.Rows[n]["ReceiptType"].ToString();
                    if (dt.Rows[n]["ReceiptDate"].ToString() != "")
                    {
                        model.ReceiptDate = DateTime.Parse(dt.Rows[n]["ReceiptDate"].ToString());
                    }
                    if (dt.Rows[n]["IsDelete"].ToString() != "")
                    {
                        model.IsDelete = int.Parse(dt.Rows[n]["IsDelete"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(MobileSoft.Model.Charge.Tb_Charge_Receipt model)
 {
     dal.Update(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(MobileSoft.Model.Charge.Tb_Charge_Receipt model)
 {
     dal.Add(model);
 }