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

            if (rowsCount > 0)
            {
                Garfield.Model.CRM_receive model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Garfield.Model.CRM_receive();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["Customer_id"] != null && dt.Rows[n]["Customer_id"].ToString() != "")
                    {
                        model.Customer_id = int.Parse(dt.Rows[n]["Customer_id"].ToString());
                    }
                    if (dt.Rows[n]["Customer_name"] != null && dt.Rows[n]["Customer_name"].ToString() != "")
                    {
                        model.Customer_name = dt.Rows[n]["Customer_name"].ToString();
                    }
                    if (dt.Rows[n]["Receive_num"] != null && dt.Rows[n]["Receive_num"].ToString() != "")
                    {
                        model.Receive_num = dt.Rows[n]["Receive_num"].ToString();
                    }
                    if (dt.Rows[n]["Pay_type_id"] != null && dt.Rows[n]["Pay_type_id"].ToString() != "")
                    {
                        model.Pay_type_id = int.Parse(dt.Rows[n]["Pay_type_id"].ToString());
                    }
                    if (dt.Rows[n]["Pay_type"] != null && dt.Rows[n]["Pay_type"].ToString() != "")
                    {
                        model.Pay_type = dt.Rows[n]["Pay_type"].ToString();
                    }
                    if (dt.Rows[n]["Receive_amount"] != null && dt.Rows[n]["Receive_amount"].ToString() != "")
                    {
                        model.Receive_amount = decimal.Parse(dt.Rows[n]["Receive_amount"].ToString());
                    }
                    if (dt.Rows[n]["Receive_date"] != null && dt.Rows[n]["Receive_date"].ToString() != "")
                    {
                        model.Receive_date = DateTime.Parse(dt.Rows[n]["Receive_date"].ToString());
                    }
                    if (dt.Rows[n]["C_depid"] != null && dt.Rows[n]["C_depid"].ToString() != "")
                    {
                        model.C_depid = int.Parse(dt.Rows[n]["C_depid"].ToString());
                    }
                    if (dt.Rows[n]["C_depname"] != null && dt.Rows[n]["C_depname"].ToString() != "")
                    {
                        model.C_depname = dt.Rows[n]["C_depname"].ToString();
                    }
                    if (dt.Rows[n]["C_empid"] != null && dt.Rows[n]["C_empid"].ToString() != "")
                    {
                        model.C_empid = int.Parse(dt.Rows[n]["C_empid"].ToString());
                    }
                    if (dt.Rows[n]["C_empname"] != null && dt.Rows[n]["C_empname"].ToString() != "")
                    {
                        model.C_empname = dt.Rows[n]["C_empname"].ToString();
                    }
                    if (dt.Rows[n]["create_id"] != null && dt.Rows[n]["create_id"].ToString() != "")
                    {
                        model.create_id = int.Parse(dt.Rows[n]["create_id"].ToString());
                    }
                    if (dt.Rows[n]["create_name"] != null && dt.Rows[n]["create_name"].ToString() != "")
                    {
                        model.create_name = dt.Rows[n]["create_name"].ToString();
                    }
                    if (dt.Rows[n]["create_date"] != null && dt.Rows[n]["create_date"].ToString() != "")
                    {
                        model.create_date = DateTime.Parse(dt.Rows[n]["create_date"].ToString());
                    }
                    if (dt.Rows[n]["companyid"] != null && dt.Rows[n]["companyid"].ToString() != "")
                    {
                        model.companyid = int.Parse(dt.Rows[n]["companyid"].ToString());
                    }
                    if (dt.Rows[n]["order_id"] != null && dt.Rows[n]["order_id"].ToString() != "")
                    {
                        model.order_id = int.Parse(dt.Rows[n]["order_id"].ToString());
                    }
                    if (dt.Rows[n]["remarks"] != null && dt.Rows[n]["remarks"].ToString() != "")
                    {
                        model.remarks = dt.Rows[n]["remarks"].ToString();
                    }
                    if (dt.Rows[n]["isDelete"] != null && dt.Rows[n]["isDelete"].ToString() != "")
                    {
                        model.isDelete = int.Parse(dt.Rows[n]["isDelete"].ToString());
                    }
                    if (dt.Rows[n]["Delete_time"] != null && dt.Rows[n]["Delete_time"].ToString() != "")
                    {
                        model.Delete_time = DateTime.Parse(dt.Rows[n]["Delete_time"].ToString());
                    }
                    if (dt.Rows[n]["receive_direction_id"] != null && dt.Rows[n]["receive_direction_id"].ToString() != "")
                    {
                        model.receive_direction_id = int.Parse(dt.Rows[n]["receive_direction_id"].ToString());
                    }
                    if (dt.Rows[n]["receive_direction_name"] != null && dt.Rows[n]["receive_direction_name"].ToString() != "")
                    {
                        model.receive_direction_name = dt.Rows[n]["receive_direction_name"].ToString();
                    }
                    if (dt.Rows[n]["receive_type_id"] != null && dt.Rows[n]["receive_type_id"].ToString() != "")
                    {
                        model.receive_type_id = int.Parse(dt.Rows[n]["receive_type_id"].ToString());
                    }
                    if (dt.Rows[n]["receive_type_name"] != null && dt.Rows[n]["receive_type_name"].ToString() != "")
                    {
                        model.receive_type_name = dt.Rows[n]["receive_type_name"].ToString();
                    }
                    if (dt.Rows[n]["receive_real"] != null && dt.Rows[n]["receive_real"].ToString() != "")
                    {
                        model.receive_real = decimal.Parse(dt.Rows[n]["receive_real"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }