Exemplo n.º 1
0
        private List <ExercisesTest> DataTableToList(DataTable dt)
        {
            List <ExercisesTest> list = new List <ExercisesTest>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ExercisesTest info = new ExercisesTest();
                    info.ExercisesDescribe = dr["ExercisesDescribe"] == DBNull.Value ? "" : dr["ExercisesDescribe"].ToString();
                    info.ExercisesName     = dr["ExercisesName"] == DBNull.Value ? "" : dr["ExercisesName"].ToString();
                    info.ExercisesTestId   = dr["ExercisesTestId"] == DBNull.Value ? -100 : Convert.ToInt32(dr["ExercisesTestId"]);
                    info.ExercisesTypeId   = dr["ExercisesTypeId"] == DBNull.Value ? -100 : Convert.ToInt32(dr["ExercisesTypeId"]);
                    info.IsOver            = dr["IsOver"] == DBNull.Value ? -100 : Convert.ToInt32(dr["IsOver"]);
                    info.TypeName1         = dr["TypeName1"] == DBNull.Value ? "" : dr["TypeName1"].ToString();
                    info.TypeName2         = dr["TypeName2"] == DBNull.Value ? "" : dr["TypeName2"].ToString();
                    if (dr["UpdateDateTime"] != DBNull.Value)
                    {
                        DateTime datetime;
                        DateTime.TryParse(dr["UpdateDateTime"].ToString(), out datetime);
                        info.UpdateDateTime = datetime;
                    }
                    //info.ListTitleInfo = TitleInfobll.GetExercisesAllTitle(info.ExercisesTestId);

                    if (info.ExercisesTestId != -100 && info.ExercisesTestId == GetCurrentExercises(info.ExercisesTypeId).ExercisesTestId)
                    {
                        info.IsUse = 1;
                    }
                    list.Add(info);
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public int AddExercisesTest(ExercisesTest info)
        {
            string strSql = @"insert into ExercisesTest (ExercisesName,ExercisesDescribe,ExercisesTypeId,UpdateDateTime,IsOver) 
                            values(@ExercisesName,@ExercisesDescribe,@ExercisesTypeId,@UpdateDateTime,@IsOver)";

            return(DBFactory.GetDB(DBType.SQLITE, m_strConn).ExecuteNonQuery(strSql, new DbParameter[] {
                new SQLiteParameter()
                {
                    Value = info.ExercisesDescribe, ParameterName = "@ExercisesDescribe"
                },
                new SQLiteParameter()
                {
                    Value = info.ExercisesName, ParameterName = "@ExercisesName"
                },
                new SQLiteParameter()
                {
                    Value = info.ExercisesTypeId, ParameterName = "@ExercisesTypeId"
                },
                new SQLiteParameter()
                {
                    Value = info.IsOver, ParameterName = "@IsOver"
                },
                new SQLiteParameter()
                {
                    Value = info.UpdateDateTime, ParameterName = "@UpdateDateTime"
                }
            }));
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int UpdateExercisesTest(ExercisesTest info)
        {
            string strSql = @"update ExercisesTest set ExercisesDescribe=@ExercisesDescribe,ExercisesName=@ExercisesName
                            ,ExercisesTypeId=@ExercisesTypeId,UpdateDateTime=@UpdateDateTime,IsOver=@IsOver
                            where ExercisesTestId=@ExercisesTestId";

            return(DBFactory.GetDB(DBType.SQLITE, m_strConn).ExecuteNonQuery(strSql, new DbParameter[] {
                new SQLiteParameter()
                {
                    Value = info.ExercisesTestId, ParameterName = "@ExercisesTestId"
                },
                new SQLiteParameter()
                {
                    Value = info.ExercisesDescribe, ParameterName = "@ExercisesDescribe"
                },
                new SQLiteParameter()
                {
                    Value = info.ExercisesName, ParameterName = "@ExercisesName"
                },
                new SQLiteParameter()
                {
                    Value = info.ExercisesTypeId, ParameterName = "@ExercisesTypeId"
                },
                new SQLiteParameter()
                {
                    Value = info.IsOver, ParameterName = "@IsOver"
                },
                new SQLiteParameter()
                {
                    Value = info.UpdateDateTime, ParameterName = "@UpdateDateTime"
                }
            }));
        }
        public ActionResult UpdateExercisesTest(ExercisesTest info)
        {
            int result = ExercisesTestbll.UpdateExercisesTest(info);
            var res    = new ConfigurableJsonResult();

            res.Data = result;
            HttpContext.Response.AppendHeader("Access-Control-Allow-Origin", "*");
            return(res);
        }