public Model_visit_web DataRowToModel(DataRow row) { Model_visit_web _web = new Model_visit_web(); if (row != null) { if (row["visit_web_id"] != null) { _web.visit_web_id = row["visit_web_id"].ToString(); } if (row["user_id"] != null) { _web.user_id = row["user_id"].ToString(); } if (row["resource_data_id"] != null) { _web.resource_data_id = row["resource_data_id"].ToString(); } if (row["class_id"] != null) { _web.class_id = row["class_id"].ToString(); } if ((row["open_time"] != null) && (row["open_time"].ToString() != "")) { _web.open_time = new DateTime?(DateTime.Parse(row["open_time"].ToString())); } if ((row["close_time"] != null) && (row["close_time"].ToString() != "")) { _web.close_time = new DateTime?(DateTime.Parse(row["close_time"].ToString())); } } return(_web); }
/// <summary> /// 讲评报告访问情况 /// </summary> private void RecordVisit_Web(string tch_id, string class_id) { visit_web_id = Guid.NewGuid().ToString(); Model_visit_web modelVW = new Model_visit_web(); modelVW.visit_web_id = visit_web_id; modelVW.user_id = tch_id; modelVW.resource_data_id = HomeWork_Id; modelVW.class_id = class_id; modelVW.open_time = DateTime.Now; modelVW.close_time = DateTime.Now.AddMinutes(1); new BLL_visit_web().Add(modelVW); }
public static string UpdateRecordVisitCloseTime(string visit_web_id) { try { visit_web_id = visit_web_id.Filter(); BLL_visit_web bll = new BLL_visit_web(); Model_visit_web modelVW = bll.GetModel(visit_web_id); modelVW.close_time = DateTime.Now; bll.Update(modelVW); return("1"); } catch (Exception) { return("0"); } }
public bool Add(Model_visit_web model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into visit_web("); builder.Append("visit_web_id,user_id,resource_data_id,class_id,open_time,close_time)"); builder.Append(" values ("); builder.Append("@visit_web_id,@user_id,@resource_data_id,@class_id,@open_time,@close_time)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@visit_web_id", SqlDbType.Char, 0x24), new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@resource_data_id", SqlDbType.Char, 0x24), new SqlParameter("@class_id", SqlDbType.VarChar, 50), new SqlParameter("@open_time", SqlDbType.DateTime), new SqlParameter("@close_time", SqlDbType.DateTime) }; cmdParms[0].Value = model.visit_web_id; cmdParms[1].Value = model.user_id; cmdParms[2].Value = model.resource_data_id; cmdParms[3].Value = model.class_id; cmdParms[4].Value = model.open_time; cmdParms[5].Value = model.close_time; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_visit_web> DataTableToList(DataTable dt) { List <Model_visit_web> list = new List <Model_visit_web>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_visit_web item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Update(Model_visit_web model) { StringBuilder builder = new StringBuilder(); builder.Append("update visit_web set "); builder.Append("user_id=@user_id,"); builder.Append("resource_data_id=@resource_data_id,"); builder.Append("class_id=@class_id,"); builder.Append("open_time=@open_time,"); builder.Append("close_time=@close_time"); builder.Append(" where visit_web_id=@visit_web_id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@resource_data_id", SqlDbType.Char, 0x24), new SqlParameter("@class_id", SqlDbType.VarChar, 50), new SqlParameter("@open_time", SqlDbType.DateTime), new SqlParameter("@close_time", SqlDbType.DateTime), new SqlParameter("@visit_web_id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.user_id; cmdParms[1].Value = model.resource_data_id; cmdParms[2].Value = model.class_id; cmdParms[3].Value = model.open_time; cmdParms[4].Value = model.close_time; cmdParms[5].Value = model.visit_web_id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(Model_visit_web model) { return(this.dal.Add(model)); }
public bool Update(Model_visit_web model) { return(this.dal.Update(model)); }