public List <Chain.Model.EmailLog> DataTableToList(DataTable dt) { List <Chain.Model.EmailLog> modelList = new List <Chain.Model.EmailLog>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.EmailLog model = new Chain.Model.EmailLog(); if (dt.Rows[i]["EmailID"] != null && dt.Rows[i]["EmailID"].ToString() != "") { model.EmailID = int.Parse(dt.Rows[i]["EmailID"].ToString()); } if (dt.Rows[i]["EmailAdress"] != null && dt.Rows[i]["EmailAdress"].ToString() != "") { model.EmailAdress = dt.Rows[i]["EmailAdress"].ToString(); } if (dt.Rows[i]["EmailTitle"] != null && dt.Rows[i]["EmailTitle"].ToString() != "") { model.EmailTitle = dt.Rows[i]["EmailTitle"].ToString(); } if (dt.Rows[i]["EmailContent"] != null && dt.Rows[i]["EmailContent"].ToString() != "") { model.EmailContent = dt.Rows[i]["EmailContent"].ToString(); } if (dt.Rows[i]["EmailState"] != null && dt.Rows[i]["EmailState"].ToString() != "") { model.EmailState = int.Parse(dt.Rows[i]["EmailState"].ToString()); } if (dt.Rows[i]["EmailSendTime"] != null && dt.Rows[i]["EmailSendTime"].ToString() != "") { model.EmailSendTime = DateTime.Parse(dt.Rows[i]["EmailSendTime"].ToString()); } if (dt.Rows[i]["EmailShopID"] != null && dt.Rows[i]["EmailShopID"].ToString() != "") { model.EmailShopID = int.Parse(dt.Rows[i]["EmailShopID"].ToString()); } if (dt.Rows[i]["EmailUserID"] != null && dt.Rows[i]["EmailUserID"].ToString() != "") { model.EmailUserID = int.Parse(dt.Rows[i]["EmailUserID"].ToString()); } if (dt.Rows[i]["EmailCount"] != null && dt.Rows[i]["EmailCount"].ToString() != "") { model.EmailCount = int.Parse(dt.Rows[i]["EmailCount"].ToString()); } modelList.Add(model); } } return(modelList); }
public bool Update(Chain.Model.EmailLog model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.EmailLog model) { return(this.dal.Add(model)); }