Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.Template_Rules> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.Template_Rules> modelList = new List <LPWeb.Model.Template_Rules>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.Template_Rules model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.Template_Rules();
                    if (dt.Rows[n]["RuleId"].ToString() != "")
                    {
                        model.RuleId = int.Parse(dt.Rows[n]["RuleId"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    model.desc = dt.Rows[n]["desc"].ToString();
                    if (dt.Rows[n]["Enabled"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Enabled"].ToString() == "1") || (dt.Rows[n]["Enabled"].ToString().ToLower() == "true"))
                        {
                            model.Enabled = true;
                        }
                        else
                        {
                            model.Enabled = false;
                        }
                    }
                    if (dt.Rows[n]["AlertEmailTemplId"].ToString() != "")
                    {
                        model.AlertEmailTemplId = int.Parse(dt.Rows[n]["AlertEmailTemplId"].ToString());
                    }
                    if (dt.Rows[n]["AckReq"].ToString() != "")
                    {
                        if ((dt.Rows[n]["AckReq"].ToString() == "1") || (dt.Rows[n]["AckReq"].ToString().ToLower() == "true"))
                        {
                            model.AckReq = true;
                        }
                        else
                        {
                            model.AckReq = false;
                        }
                    }
                    if (dt.Rows[n]["RecomEmailTemplid"].ToString() != "")
                    {
                        model.RecomEmailTemplid = int.Parse(dt.Rows[n]["RecomEmailTemplid"].ToString());
                    }
                    model.AdvFormula = dt.Rows[n]["AdvFormula"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.Template_Rules model)
 {
     dal.Update(model);
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(LPWeb.Model.Template_Rules model)
 {
     return(dal.Add(model));
 }