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

            if (rowsCount > 0)
            {
                jdgl_res_head_app.Model.Qyqskyd_ydzlzmx model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new jdgl_res_head_app.Model.Qyqskyd_ydzlzmx();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["yydh"] != null && dt.Rows[n]["yydh"].ToString() != "")
                    {
                        model.yydh = dt.Rows[n]["yydh"].ToString();
                    }
                    if (dt.Rows[n]["qymc"] != null && dt.Rows[n]["qymc"].ToString() != "")
                    {
                        model.qymc = dt.Rows[n]["qymc"].ToString();
                    }
                    if (dt.Rows[n]["lsbh"] != null && dt.Rows[n]["lsbh"].ToString() != "")
                    {
                        model.lsbh = dt.Rows[n]["lsbh"].ToString();
                    }
                    if (dt.Rows[n]["fjrb"] != null && dt.Rows[n]["fjrb"].ToString() != "")
                    {
                        model.fjrb = dt.Rows[n]["fjrb"].ToString();
                    }
                    if (dt.Rows[n]["fjbh"] != null && dt.Rows[n]["fjbh"].ToString() != "")
                    {
                        model.fjbh = dt.Rows[n]["fjbh"].ToString();
                    }
                    if (dt.Rows[n]["sjjg"] != null && dt.Rows[n]["sjjg"].ToString() != "")
                    {
                        model.sjjg = decimal.Parse(dt.Rows[n]["sjjg"].ToString());
                    }
                    if (dt.Rows[n]["ddsj"] != null && dt.Rows[n]["ddsj"].ToString() != "")
                    {
                        model.ddsj = DateTime.Parse(dt.Rows[n]["ddsj"].ToString());
                    }
                    if (dt.Rows[n]["lksj"] != null && dt.Rows[n]["lksj"].ToString() != "")
                    {
                        model.lksj = DateTime.Parse(dt.Rows[n]["lksj"].ToString());
                    }
                    if (dt.Rows[n]["ddrq"] != null && dt.Rows[n]["ddrq"].ToString() != "")
                    {
                        model.ddrq = DateTime.Parse(dt.Rows[n]["ddrq"].ToString());
                    }
                    if (dt.Rows[n]["lkrq"] != null && dt.Rows[n]["lkrq"].ToString() != "")
                    {
                        model.lkrq = DateTime.Parse(dt.Rows[n]["lkrq"].ToString());
                    }
                    if (dt.Rows[n]["lzrx"] != null && dt.Rows[n]["lzrx"].ToString() != "")
                    {
                        model.lzrx = dt.Rows[n]["lzrx"].ToString();
                    }
                    if (dt.Rows[n]["lzfs"] != null && dt.Rows[n]["lzfs"].ToString() != "")
                    {
                        model.lzfs = decimal.Parse(dt.Rows[n]["lzfs"].ToString());
                    }
                    if (dt.Rows[n]["shsc"] != null && dt.Rows[n]["shsc"].ToString() != "")
                    {
                        if ((dt.Rows[n]["shsc"].ToString() == "1") || (dt.Rows[n]["shsc"].ToString().ToLower() == "true"))
                        {
                            model.shsc = true;
                        }
                        else
                        {
                            model.shsc = false;
                        }
                    }
                    if (dt.Rows[n]["scsj"] != null && dt.Rows[n]["scsj"].ToString() != "")
                    {
                        model.scsj = DateTime.Parse(dt.Rows[n]["scsj"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }