예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(Maticsoft.Model.ClientLevel model)
        {
            DataTable dt = dal.GetList().Tables[0];

            for (int i = 1; i < int.MaxValue; i++)
            {
                if (dt.Select("Code='" + i.ToString() + "'").Length == 0)
                {
                    model.Code = i.ToString();
                    break;
                }
            }
            return(dal.Add(model));
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.ClientLevel model)
 {
     return(dal.Update(model));
 }
예제 #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Maticsoft.Model.ClientLevel> DataTableToList(DataTable dt)
        {
            List <Maticsoft.Model.ClientLevel> modelList = new List <Maticsoft.Model.ClientLevel>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Maticsoft.Model.ClientLevel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.ClientLevel();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = long.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["Code"] != null && dt.Rows[n]["Code"].ToString() != "")
                    {
                        model.Code = dt.Rows[n]["Code"].ToString();
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    if (dt.Rows[n]["ReferencePrice"] != null && dt.Rows[n]["ReferencePrice"].ToString() != "")
                    {
                        model.ReferencePrice = int.Parse(dt.Rows[n]["ReferencePrice"].ToString());
                    }
                    if (dt.Rows[n]["Percentage"] != null && dt.Rows[n]["Percentage"].ToString() != "")
                    {
                        model.Percentage = decimal.Parse(dt.Rows[n]["Percentage"].ToString());
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    if (dt.Rows[n]["Value1"] != null && dt.Rows[n]["Value1"].ToString() != "")
                    {
                        model.Value1 = dt.Rows[n]["Value1"].ToString();
                    }
                    if (dt.Rows[n]["Value2"] != null && dt.Rows[n]["Value2"].ToString() != "")
                    {
                        model.Value2 = dt.Rows[n]["Value2"].ToString();
                    }
                    if (dt.Rows[n]["Value3"] != null && dt.Rows[n]["Value3"].ToString() != "")
                    {
                        model.Value3 = dt.Rows[n]["Value3"].ToString();
                    }
                    if (dt.Rows[n]["Value4"] != null && dt.Rows[n]["Value4"].ToString() != "")
                    {
                        model.Value4 = dt.Rows[n]["Value4"].ToString();
                    }
                    if (dt.Rows[n]["Value5"] != null && dt.Rows[n]["Value5"].ToString() != "")
                    {
                        model.Value5 = dt.Rows[n]["Value5"].ToString();
                    }
                    if (dt.Rows[n]["Value6"] != null && dt.Rows[n]["Value6"].ToString() != "")
                    {
                        model.Value6 = dt.Rows[n]["Value6"].ToString();
                    }
                    if (dt.Rows[n]["Value7"] != null && dt.Rows[n]["Value7"].ToString() != "")
                    {
                        model.Value7 = dt.Rows[n]["Value7"].ToString();
                    }
                    if (dt.Rows[n]["Value8"] != null && dt.Rows[n]["Value8"].ToString() != "")
                    {
                        model.Value8 = dt.Rows[n]["Value8"].ToString();
                    }
                    if (dt.Rows[n]["Value9"] != null && dt.Rows[n]["Value9"].ToString() != "")
                    {
                        model.Value9 = dt.Rows[n]["Value9"].ToString();
                    }
                    if (dt.Rows[n]["CreateUser"] != null && dt.Rows[n]["CreateUser"].ToString() != "")
                    {
                        model.CreateUser = long.Parse(dt.Rows[n]["CreateUser"].ToString());
                    }
                    if (dt.Rows[n]["CreateDate"] != null && dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    if (dt.Rows[n]["UpdateUser"] != null && dt.Rows[n]["UpdateUser"].ToString() != "")
                    {
                        model.UpdateUser = long.Parse(dt.Rows[n]["UpdateUser"].ToString());
                    }
                    if (dt.Rows[n]["UpdateDate"] != null && dt.Rows[n]["UpdateDate"].ToString() != "")
                    {
                        model.UpdateDate = DateTime.Parse(dt.Rows[n]["UpdateDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }