public bool Add(Model_StatsVisitClient model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into StatsVisitClient("); builder.Append("StatsVisitClient_Id,DateType,DateData,TeacherId,TeacherName,VisitCount_All,VisitCount_Cloud,VisitCount_Own,VisitFile_All,VisitFile_Cloud,VisitFile_Own,CreateOwnCount_All,CreateOwnCount_Plan,CreateOwnCount_TestPaper,CreateTime,IsUsed)"); builder.Append(" values ("); builder.Append("@StatsVisitClient_Id,@DateType,@DateData,@TeacherId,@TeacherName,@VisitCount_All,@VisitCount_Cloud,@VisitCount_Own,@VisitFile_All,@VisitFile_Cloud,@VisitFile_Own,@CreateOwnCount_All,@CreateOwnCount_Plan,@CreateOwnCount_TestPaper,@CreateTime,@IsUsed)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@StatsVisitClient_Id", SqlDbType.Char, 0x24), new SqlParameter("@DateType", SqlDbType.VarChar, 10), new SqlParameter("@DateData", SqlDbType.VarChar, 20), new SqlParameter("@TeacherId", SqlDbType.Char, 0x24), new SqlParameter("@TeacherName", SqlDbType.VarChar, 200), new SqlParameter("@VisitCount_All", SqlDbType.Int, 4), new SqlParameter("@VisitCount_Cloud", SqlDbType.Int, 4), new SqlParameter("@VisitCount_Own", SqlDbType.Int, 4), new SqlParameter("@VisitFile_All", SqlDbType.Int, 4), new SqlParameter("@VisitFile_Cloud", SqlDbType.Int, 4), new SqlParameter("@VisitFile_Own", SqlDbType.Int, 4), new SqlParameter("@CreateOwnCount_All", SqlDbType.Int, 4), new SqlParameter("@CreateOwnCount_Plan", SqlDbType.Int, 4), new SqlParameter("@CreateOwnCount_TestPaper", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@IsUsed", SqlDbType.Char, 1) }; cmdParms[0].Value = model.StatsVisitClient_Id; cmdParms[1].Value = model.DateType; cmdParms[2].Value = model.DateData; cmdParms[3].Value = model.TeacherId; cmdParms[4].Value = model.TeacherName; cmdParms[5].Value = model.VisitCount_All; cmdParms[6].Value = model.VisitCount_Cloud; cmdParms[7].Value = model.VisitCount_Own; cmdParms[8].Value = model.VisitFile_All; cmdParms[9].Value = model.VisitFile_Cloud; cmdParms[10].Value = model.VisitFile_Own; cmdParms[11].Value = model.CreateOwnCount_All; cmdParms[12].Value = model.CreateOwnCount_Plan; cmdParms[13].Value = model.CreateOwnCount_TestPaper; cmdParms[14].Value = model.CreateTime; cmdParms[15].Value = model.IsUsed; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_StatsVisitClient> DataTableToList(DataTable dt) { List <Model_StatsVisitClient> list = new List <Model_StatsVisitClient>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_StatsVisitClient item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Update(Model_StatsVisitClient model) { StringBuilder builder = new StringBuilder(); builder.Append("update StatsVisitClient set "); builder.Append("DateType=@DateType,"); builder.Append("DateData=@DateData,"); builder.Append("TeacherId=@TeacherId,"); builder.Append("TeacherName=@TeacherName,"); builder.Append("VisitCount_All=@VisitCount_All,"); builder.Append("VisitCount_Cloud=@VisitCount_Cloud,"); builder.Append("VisitCount_Own=@VisitCount_Own,"); builder.Append("VisitFile_All=@VisitFile_All,"); builder.Append("VisitFile_Cloud=@VisitFile_Cloud,"); builder.Append("VisitFile_Own=@VisitFile_Own,"); builder.Append("CreateOwnCount_All=@CreateOwnCount_All,"); builder.Append("CreateOwnCount_Plan=@CreateOwnCount_Plan,"); builder.Append("CreateOwnCount_TestPaper=@CreateOwnCount_TestPaper,"); builder.Append("CreateTime=@CreateTime,"); builder.Append("IsUsed=@IsUsed"); builder.Append(" where StatsVisitClient_Id=@StatsVisitClient_Id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@DateType", SqlDbType.VarChar, 10), new SqlParameter("@DateData", SqlDbType.VarChar, 20), new SqlParameter("@TeacherId", SqlDbType.Char, 0x24), new SqlParameter("@TeacherName", SqlDbType.VarChar, 200), new SqlParameter("@VisitCount_All", SqlDbType.Int, 4), new SqlParameter("@VisitCount_Cloud", SqlDbType.Int, 4), new SqlParameter("@VisitCount_Own", SqlDbType.Int, 4), new SqlParameter("@VisitFile_All", SqlDbType.Int, 4), new SqlParameter("@VisitFile_Cloud", SqlDbType.Int, 4), new SqlParameter("@VisitFile_Own", SqlDbType.Int, 4), new SqlParameter("@CreateOwnCount_All", SqlDbType.Int, 4), new SqlParameter("@CreateOwnCount_Plan", SqlDbType.Int, 4), new SqlParameter("@CreateOwnCount_TestPaper", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@IsUsed", SqlDbType.Char, 1), new SqlParameter("@StatsVisitClient_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.DateType; cmdParms[1].Value = model.DateData; cmdParms[2].Value = model.TeacherId; cmdParms[3].Value = model.TeacherName; cmdParms[4].Value = model.VisitCount_All; cmdParms[5].Value = model.VisitCount_Cloud; cmdParms[6].Value = model.VisitCount_Own; cmdParms[7].Value = model.VisitFile_All; cmdParms[8].Value = model.VisitFile_Cloud; cmdParms[9].Value = model.VisitFile_Own; cmdParms[10].Value = model.CreateOwnCount_All; cmdParms[11].Value = model.CreateOwnCount_Plan; cmdParms[12].Value = model.CreateOwnCount_TestPaper; cmdParms[13].Value = model.CreateTime; cmdParms[14].Value = model.IsUsed; cmdParms[15].Value = model.StatsVisitClient_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(Model_StatsVisitClient model) { return(this.dal.Add(model)); }
public bool Update(Model_StatsVisitClient model) { return(this.dal.Update(model)); }
public Model_StatsVisitClient DataRowToModel(DataRow row) { Model_StatsVisitClient client = new Model_StatsVisitClient(); if (row != null) { if (row["StatsVisitClient_Id"] != null) { client.StatsVisitClient_Id = row["StatsVisitClient_Id"].ToString(); } if (row["DateType"] != null) { client.DateType = row["DateType"].ToString(); } if (row["DateData"] != null) { client.DateData = row["DateData"].ToString(); } if (row["TeacherId"] != null) { client.TeacherId = row["TeacherId"].ToString(); } if (row["TeacherName"] != null) { client.TeacherName = row["TeacherName"].ToString(); } if ((row["VisitCount_All"] != null) && (row["VisitCount_All"].ToString() != "")) { client.VisitCount_All = new int?(int.Parse(row["VisitCount_All"].ToString())); } if ((row["VisitCount_Cloud"] != null) && (row["VisitCount_Cloud"].ToString() != "")) { client.VisitCount_Cloud = new int?(int.Parse(row["VisitCount_Cloud"].ToString())); } if ((row["VisitCount_Own"] != null) && (row["VisitCount_Own"].ToString() != "")) { client.VisitCount_Own = new int?(int.Parse(row["VisitCount_Own"].ToString())); } if ((row["VisitFile_All"] != null) && (row["VisitFile_All"].ToString() != "")) { client.VisitFile_All = new int?(int.Parse(row["VisitFile_All"].ToString())); } if ((row["VisitFile_Cloud"] != null) && (row["VisitFile_Cloud"].ToString() != "")) { client.VisitFile_Cloud = new int?(int.Parse(row["VisitFile_Cloud"].ToString())); } if ((row["VisitFile_Own"] != null) && (row["VisitFile_Own"].ToString() != "")) { client.VisitFile_Own = new int?(int.Parse(row["VisitFile_Own"].ToString())); } if ((row["CreateOwnCount_All"] != null) && (row["CreateOwnCount_All"].ToString() != "")) { client.CreateOwnCount_All = new int?(int.Parse(row["CreateOwnCount_All"].ToString())); } if ((row["CreateOwnCount_Plan"] != null) && (row["CreateOwnCount_Plan"].ToString() != "")) { client.CreateOwnCount_Plan = new int?(int.Parse(row["CreateOwnCount_Plan"].ToString())); } if ((row["CreateOwnCount_TestPaper"] != null) && (row["CreateOwnCount_TestPaper"].ToString() != "")) { client.CreateOwnCount_TestPaper = new int?(int.Parse(row["CreateOwnCount_TestPaper"].ToString())); } if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != "")) { client.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString())); } if (row["IsUsed"] != null) { client.IsUsed = row["IsUsed"].ToString(); } } return(client); }