public Model_ExeccuteDataAnalysis DataRowToModel(DataRow row) { Model_ExeccuteDataAnalysis analysis = new Model_ExeccuteDataAnalysis(); if (row != null) { if (row["ExeccuteDataAnalysisID"] != null) { analysis.ExeccuteDataAnalysisID = row["ExeccuteDataAnalysisID"].ToString(); } if (row["ExeccuteLenght"] != null) { analysis.ExeccuteLenght = row["ExeccuteLenght"].ToString(); } if (row["Remark"] != null) { analysis.Remark = row["Remark"].ToString(); } if ((row["ExeccuteTime"] != null) && (row["ExeccuteTime"].ToString() != "")) { analysis.ExeccuteTime = new DateTime?(DateTime.Parse(row["ExeccuteTime"].ToString())); } if (row["ExeccuteUserId"] != null) { analysis.ExeccuteUserId = row["ExeccuteUserId"].ToString(); } if (row["ExeccuteUserName"] != null) { analysis.ExeccuteUserName = row["ExeccuteUserName"].ToString(); } } return(analysis); }
/// <summary> /// 执行教学数据分析 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDataAnalysis_Click(object sender, EventArgs e) { try { Model_ExeccuteDataAnalysis model = new Model_ExeccuteDataAnalysis(); model.ExeccuteDataAnalysisID = Guid.NewGuid().ToString(); model.ExeccuteTime = DateTime.Now; Stopwatch timer = new System.Diagnostics.Stopwatch(); timer.Start(); int result = Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime("EXEC P_ExecStatsHWData", 0); timer.Stop(); string lenght = timer.Elapsed.ToString(); model.ExeccuteUserId = loginUser.SysUser_ID; model.ExeccuteUserName = loginUser.SysUser_Name == "" ? loginUser.SysUser_LoginName : loginUser.SysUser_Name; model.ExeccuteLenght = lenght; BLL_ExeccuteDataAnalysis bll = new BLL_ExeccuteDataAnalysis(); bool i = bll.Add(model); Response.Redirect(Request.Url.ToString()); } catch (Exception ex) { new BLL_clsAuth().AddLogErrorFromBS("教学数据生成错误:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString() , ex.TargetSite.Name.ToString(), ex.Message)); Response.Redirect(Request.Url.ToString()); } }
public bool Add(Model_ExeccuteDataAnalysis model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into ExeccuteDataAnalysis("); builder.Append("ExeccuteDataAnalysisID,ExeccuteLenght,Remark,ExeccuteTime,ExeccuteUserId,ExeccuteUserName)"); builder.Append(" values ("); builder.Append("@ExeccuteDataAnalysisID,@ExeccuteLenght,@Remark,@ExeccuteTime,@ExeccuteUserId,@ExeccuteUserName)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ExeccuteDataAnalysisID", SqlDbType.Char, 0x24), new SqlParameter("@ExeccuteLenght", SqlDbType.NVarChar, 20), new SqlParameter("@Remark", SqlDbType.NVarChar, 200), new SqlParameter("@ExeccuteTime", SqlDbType.DateTime), new SqlParameter("@ExeccuteUserId", SqlDbType.Char, 0x24), new SqlParameter("@ExeccuteUserName", SqlDbType.NVarChar, 20) }; cmdParms[0].Value = model.ExeccuteDataAnalysisID; cmdParms[1].Value = model.ExeccuteLenght; cmdParms[2].Value = model.Remark; cmdParms[3].Value = model.ExeccuteTime; cmdParms[4].Value = model.ExeccuteUserId; cmdParms[5].Value = model.ExeccuteUserName; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_ExeccuteDataAnalysis> DataTableToList(DataTable dt) { List <Model_ExeccuteDataAnalysis> list = new List <Model_ExeccuteDataAnalysis>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_ExeccuteDataAnalysis item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Update(Model_ExeccuteDataAnalysis model) { StringBuilder builder = new StringBuilder(); builder.Append("update ExeccuteDataAnalysis set "); builder.Append("ExeccuteLenght=@ExeccuteLenght,"); builder.Append("Remark=@Remark,"); builder.Append("ExeccuteTime=@ExeccuteTime,"); builder.Append("ExeccuteUserId=@ExeccuteUserId,"); builder.Append("ExeccuteUserName=@ExeccuteUserName"); builder.Append(" where ExeccuteDataAnalysisID=@ExeccuteDataAnalysisID "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ExeccuteLenght", SqlDbType.NVarChar, 20), new SqlParameter("@Remark", SqlDbType.NVarChar, 200), new SqlParameter("@ExeccuteTime", SqlDbType.DateTime), new SqlParameter("@ExeccuteUserId", SqlDbType.Char, 0x24), new SqlParameter("@ExeccuteUserName", SqlDbType.NVarChar, 20), new SqlParameter("@ExeccuteDataAnalysisID", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.ExeccuteLenght; cmdParms[1].Value = model.Remark; cmdParms[2].Value = model.ExeccuteTime; cmdParms[3].Value = model.ExeccuteUserId; cmdParms[4].Value = model.ExeccuteUserName; cmdParms[5].Value = model.ExeccuteDataAnalysisID; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(Model_ExeccuteDataAnalysis model) { return(this.dal.Add(model)); }
public bool Update(Model_ExeccuteDataAnalysis model) { return(this.dal.Update(model)); }