public List <Chain.Model.Proposal> DataTableToList(DataTable dt) { List <Chain.Model.Proposal> modelList = new List <Chain.Model.Proposal>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.Proposal model = new Chain.Model.Proposal(); if (dt.Rows[i]["ProposalID"] != null && dt.Rows[i]["ProposalID"].ToString() != "") { model.ProposalID = int.Parse(dt.Rows[i]["ProposalID"].ToString()); } if (dt.Rows[i]["ProposalContent"] != null && dt.Rows[i]["ProposalContent"].ToString() != "") { model.ProposalContent = dt.Rows[i]["ProposalContent"].ToString(); } if (dt.Rows[i]["MemID"] != null && dt.Rows[i]["MemID"].ToString() != "") { model.MemID = new int?(int.Parse(dt.Rows[i]["MemID"].ToString())); } if (dt.Rows[i]["MemMobile"] != null && dt.Rows[i]["MemMobile"].ToString() != "") { model.MemMobile = dt.Rows[i]["MemMobile"].ToString(); } if (dt.Rows[i]["ProposalTime"] != null && dt.Rows[i]["ProposalTime"].ToString() != "") { model.ProposalTime = new DateTime?(DateTime.Parse(dt.Rows[i]["ProposalTime"].ToString())); } modelList.Add(model); } } return(modelList); }
public bool Update(Chain.Model.Proposal model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.Proposal model) { return(this.dal.Add(model)); }