/// <summary> /// 获得数据列表 /// </summary> public List <LPWeb.Model.LoanMarketing> DataTableToList(DataTable dt) { List <LPWeb.Model.LoanMarketing> modelList = new List <LPWeb.Model.LoanMarketing>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LPWeb.Model.LoanMarketing model; for (int n = 0; n < rowsCount; n++) { model = new LPWeb.Model.LoanMarketing(); if (dt.Rows[n]["LoanMarketingId"].ToString() != "") { model.LoanMarketingId = int.Parse(dt.Rows[n]["LoanMarketingId"].ToString()); } if (dt.Rows[n]["Selected"].ToString() != "") { model.Selected = DateTime.Parse(dt.Rows[n]["Selected"].ToString()); } model.Type = dt.Rows[n]["Type"].ToString(); if (dt.Rows[n]["Started"].ToString() != "") { model.Started = DateTime.Parse(dt.Rows[n]["Started"].ToString()); } if (dt.Rows[n]["StartedBy"].ToString() != "") { model.StartedBy = int.Parse(dt.Rows[n]["StartedBy"].ToString()); } if (dt.Rows[n]["CampaignId"].ToString() != "") { model.CampaignId = int.Parse(dt.Rows[n]["CampaignId"].ToString()); } model.Status = dt.Rows[n]["Status"].ToString(); if (dt.Rows[n]["FileId"].ToString() != "") { model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString()); } if (dt.Rows[n]["SelectedBy"].ToString() != "") { model.SelectedBy = int.Parse(dt.Rows[n]["SelectedBy"].ToString()); } modelList.Add(model); } } return(modelList); }
private void SaveMarketings(string[] selectedItems, string sStartDate) { int iItem = 0; string sFileID = "0"; sFileID = this.hfFileID.Value; DateTime dtStart = DateTime.Now; if (!DateTime.TryParse(sStartDate, out dtStart)) { dtStart = DateTime.Now; } foreach (var item in selectedItems) { if (int.TryParse(item, out iItem)) { try { LPWeb.Model.LoanMarketing _mLoanMarketing = new LPWeb.Model.LoanMarketing(); _mLoanMarketing.CampaignId = iItem; _mLoanMarketing.Selected = DateTime.Now; _mLoanMarketing.SelectedBy = CurrUser.iUserID; _mLoanMarketing.FileId = Convert.ToInt32(sFileID); _mLoanMarketing.Started = dtStart; _mLoanMarketing.StartedBy = CurrUser.iUserID; _mLoanMarketing.Status = "Active"; _mLoanMarketing.Type = "Manual"; _bLoanMarketing.Add(_mLoanMarketing); } catch (Exception exception) { LPLog.LogMessage(exception.Message); } } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LPWeb.Model.LoanMarketing model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LPWeb.Model.LoanMarketing model) { return(dal.Add(model)); }