/// <summary> ///根据SQL语句获取集合 /// </summary> private IList <Tbl_Alert> getTbl_AlertsBySql(string sql) { IList <Tbl_Alert> list = new List <Tbl_Alert>(); DataSet ds = DBHelper.ExecuteDataset(this.connection, CommandType.Text, sql); if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { Tbl_Alert tbl_alert = new Tbl_Alert(); tbl_alert.ID = Convert.ToInt32(dr["ID"]); tbl_alert.UserName = Convert.ToString(dr["UserName"]); tbl_alert.AlertType = Convert.ToString(dr["AlertType"]); tbl_alert.AlertTitle = Convert.ToString(dr["AlertTitle"]); tbl_alert.AlertInfo = Convert.ToString(dr["AlertInfo"]); tbl_alert.AlertUrl = Convert.ToString(dr["AlertUrl"]); tbl_alert.AlertMode = Convert.ToString(dr["AlertMode"]); tbl_alert.Status = Convert.ToString(dr["Status"]); tbl_alert.DealFlag = Convert.ToInt32(dr["DealFlag"]); tbl_alert.DealUser = Convert.ToString(dr["DealUser"]); tbl_alert.DealTime = Convert.ToDateTime(dr["DealTime"]); tbl_alert.AddDate = Convert.ToDateTime(dr["AddDate"]); list.Add(tbl_alert); } } return(list); }
public static void WriteAlert(string user, string title, string info, string url) { Tbl_Alert tbl_Alert = new Tbl_Alert(); tbl_Alert.UserName = user; tbl_Alert.AlertMode = "0"; tbl_Alert.AlertType = "消息"; tbl_Alert.AlertTitle = title; tbl_Alert.AlertInfo = info; tbl_Alert.AlertUrl = url; tbl_Alert.Status = "未读"; new Tbl_AlertService().AddTbl_Alert(tbl_Alert); }
public int AddTbl_Alert(Tbl_Alert tbl_alert) { string sql = "insert into [Tbl_Alert] ([UserName],[AlertType],[AlertTitle],[AlertInfo],[AlertUrl],[AlertMode],[Status]) values (@UserName,@AlertType,@AlertTitle,@AlertInfo,@AlertUrl,@AlertMode,@Status)"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@UserName", tbl_alert.UserName), new SqlParameter("@AlertType", tbl_alert.AlertType), new SqlParameter("@AlertTitle", tbl_alert.AlertTitle), new SqlParameter("@AlertInfo", tbl_alert.AlertInfo), new SqlParameter("@AlertUrl", tbl_alert.AlertUrl), new SqlParameter("@AlertMode", tbl_alert.AlertMode), new SqlParameter("@Status", tbl_alert.Status) }; return(DBHelper.ExecuteNonQuery(this.connection, CommandType.Text, sql, sp)); }
public int UpdateTbl_AlertById(Tbl_Alert tbl_alert) { string sql = "update [Tbl_Alert] set [UserName]=@UserName,[AlertType]=@AlertType,[AlertTitle]=@AlertTitle,[AlertInfo]=@AlertInfo,[AlertUrl]=@AlertUrl,[AlertMode]=@AlertMode,[Status]=@Status,[DealFlag]=@DealFlag,[DealUser]=@DealUser,[DealTime]=@DealTime where [ID]=@ID"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@ID", tbl_alert.ID), new SqlParameter("@UserName", tbl_alert.UserName), new SqlParameter("@AlertType", tbl_alert.AlertType), new SqlParameter("@AlertTitle", tbl_alert.AlertTitle), new SqlParameter("@AlertInfo", tbl_alert.AlertInfo), new SqlParameter("@AlertUrl", tbl_alert.AlertUrl), new SqlParameter("@AlertMode", tbl_alert.AlertMode), new SqlParameter("@Status", tbl_alert.Status), new SqlParameter("@DealFlag", tbl_alert.DealFlag), new SqlParameter("@DealUser", tbl_alert.DealUser), new SqlParameter("@DealTime", tbl_alert.DealTime) }; return(DBHelper.ExecuteNonQuery(this.connection, CommandType.Text, sql, sp)); }
public static int UpdateTbl_Alert(Tbl_Alert tbl_alert) { tbl_alert.DealUser = WebCommon.Public.GetUserName(); tbl_alert.DealTime = DateTime.Now; return(new Tbl_AlertService().UpdateTbl_AlertById(tbl_alert)); }
public static int AddTbl_Alert(Tbl_Alert tbl_alert) { return(new Tbl_AlertService().AddTbl_Alert(tbl_alert)); }