Example #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="context"></param>
        public void TeacherClassUpdate(HttpContext context)
        {
            string   Tc_Name      = context.Request["Tc_Name"].ToString();
            string   TC_Grade     = context.Request["TC_Grade"].ToString();
            DateTime TC_BeginTime = DateTime.Parse(context.Request["TC_BeginTime"].ToString());
            DateTime TC_EndTime   = DateTime.Parse(context.Request["TC_EndTime"].ToString());
            string   TC_MaxAmount = context.Request["TC_MaxAmount"].ToString();
            string   Provice      = context.Request["Provice"].ToString();
            int      Categoryt    = 0;
            int      Categorye    = 1;

            try
            {
                Categoryt = int.Parse(context.Request["Categoryt"].ToString());
                Categorye = int.Parse(context.Request["Categorye"].ToString());
            }
            catch
            {
            }
            int Tc_ID = int.Parse(context.Request["Tc_ID"].ToString());

            TrainClassesInfo T = new TrainClassesInfo();

            T.TC_Name      = Tc_Name;
            T.TC_Grade     = TC_Grade;
            T.TC_BeginTime = TC_BeginTime;
            T.TC_EndTime   = TC_EndTime;
            T.TC_MaxAmount = TC_MaxAmount;
            T.TC_Period    = Provice;
            T.TC_Grade     = TC_Grade;
            T.TC_ID        = Tc_ID;

            int jyID = 0;
            int ddID = 0;

            if (Categoryt != 0)
            {
                jyID = Categoryt;
            }
            if (Categorye != 0)
            {
                ddID = Categorye;
            }
            String str = "";
            bool   b   = BLL.TrainClass_BLL.TeacherUpdate(T, jyID, ddID);

            if (b)
            {
                str = "1";
            }
            else
            {
                str = "0";
            }
            string json = JsonConvert.SerializeObject(str);

            context.Response.Write(json);
        }
Example #2
0
        /// <summary>
        /// 新增一个实训班级信息
        /// </summary>
        /// <param name="T"></param>
        /// <param name="C"></param>
        /// <returns></returns>
        public static bool TeacherClassAdd(TrainClassesInfo T, int jyid, int ddid)
        {
            string sql = "insert into TrainClasses(TC_Name, TC_Grade, TC_BeginTime,TC_EndTime, TC_MaxAmount, TC_MaleAmount, TC_FemaleAmount, TC_Period)values(@TC_Name, @TC_Grade, @TC_BeginTime, @TC_EndTime, @TC_MaxAmount, '4', '1',@TC_Period); select @@IDENTITY as id;";

            SqlParameter[] para =
            {
                new SqlParameter("TC_Name",      T.TC_Name),
                new SqlParameter("TC_Grade",     T.TC_Grade),
                new SqlParameter("TC_BeginTime", T.TC_BeginTime),
                new SqlParameter("TC_EndTime",   T.TC_EndTime),
                new SqlParameter("TC_MaxAmount", T.TC_MaxAmount),
                new SqlParameter("TC_Period",    T.TC_Period)
                //new SqlParameter ("T_ID",C.T_ID)
            };
            DataTable dt = DBHelper.GetDataTable(sql, para);

            string strSql = "insert into TrainClassTeachers ";

            //如果jyid,ddid不等于0时执行sql语句,可以同时追加两条
            if (jyid != 0)
            {
                strSql += "select " + dt.Rows[0][0] + "," + jyid + " union ";
            }
            if (ddid != 0)
            {
                strSql += " select " + dt.Rows[0][0] + "," + ddid + " union ";
            }
            strSql = strSql.Substring(0, strSql.Length - 6);//去掉最后一个union(union)的字段为6
            int i = DBHelper.ExecuteNonQuery(strSql, null);

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="T"></param>
        /// <param name="jyid"></param>
        /// <param name="ddid"></param>
        /// <param name="T_id"></param>
        /// <returns></returns>
        public static bool TeacherUpdate(TrainClassesInfo T, int jyid, int ddid)
        {
            int T_ID;

            if (jyid != 0)
            {
                T_ID = jyid;
            }
            else
            {
                T_ID = ddid;
            }
            string sql = "update TrainClasses set TC_Name=@TC_Name,TC_Grade=@TC_Grade,TC_BeginTime=@TC_BeginTime,TC_EndTime=@TC_EndTime,TC_MaxAmount=@TC_MaxAmount,TC_Period=@TC_Period where TC_ID=@TC_ID;delete from TrainClassTeachers where TC_ID=@TC_ID and T_ID=@T_ID;insert into TrainClassTeachers(TC_ID,T_ID)values(@TC_ID,@T_ID)";

            SqlParameter[] para =
            {
                new SqlParameter("TC_Name",      T.TC_Name),
                new SqlParameter("TC_Grade",     T.TC_Grade),
                new SqlParameter("TC_BeginTime", T.TC_BeginTime),
                new SqlParameter("TC_EndTime",   T.TC_EndTime),
                new SqlParameter("TC_MaxAmount", T.TC_MaxAmount),
                new SqlParameter("TC_Period",    T.TC_Period),
                new SqlParameter("TC_ID",        T.TC_ID),
                new SqlParameter("T_ID",         T_ID)
            };
            int dt = DBHelper.ExecuteNonQuery(sql, para);

            if (dt > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="T"></param>
 /// <param name="jyid"></param>
 /// <param name="ddid"></param>
 /// <param name="T_id"></param>
 /// <returns></returns>
 public static bool TeacherUpdate(TrainClassesInfo T, int jyid, int ddid)
 {
     return(DAL.TrainClass_DAL.TeacherUpdate(T, jyid, ddid));
 }