Beispiel #1
0
        public void UpdateCoursewareTrainType(CoursewareTrainType obj)
        {
            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_COURSEWARE_TRAIN_TYPE_U";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_courseware_id", DbType.Int32, obj.CoursewareID);
            db.AddInParameter(dbCommand, "p_train_type_id", DbType.Int32, obj.TrainTypeID);
            db.AddInParameter(dbCommand, "p_order_index", DbType.Int32, obj.OrderIndex);

            db.ExecuteNonQuery(dbCommand);
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (Request.QueryString.Get("TrainTypeID") != null)
            {
                int bookID      = Convert.ToInt32(Request.QueryString.Get("CoursewareID"));
                int trainTypeID = Convert.ToInt32(Request.QueryString.Get("TrainTypeID"));
                CoursewareTrainTypeBLL objBll = new CoursewareTrainTypeBLL();
                CoursewareTrainType    obj    = objBll.GetCoursewareTrainType(bookID, trainTypeID);
                int order = Convert.ToInt32(txtOrderIndex.Text);
                int max   = Convert.ToInt32(Request.QueryString.Get("MaxOrder"));
                if (order > max)
                {
                    obj.OrderIndex = max;
                }
                else
                {
                    obj.OrderIndex = order;
                }
                objBll.UpdateCoursewareTrainType(obj);
            }
            else
            {
                CoursewareBLL             objBll = new CoursewareBLL();
                RailExam.Model.Courseware obj    = objBll.GetCourseware(Convert.ToInt32(Request.QueryString.Get("CoursewareID")));
                int order = Convert.ToInt32(txtOrderIndex.Text);
                int max   = Convert.ToInt32(Request.QueryString.Get("MaxOrder"));
                if (order > max)
                {
                    obj.OrderIndex = max;
                }
                else
                {
                    obj.OrderIndex = order;
                }
                objBll.UpdateCourseware(obj);
            }

            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
Beispiel #3
0
        public CoursewareTrainType GetCoursewareTrainType(int coursewareID, int trainTypeID)
        {
            CoursewareTrainType obj = new CoursewareTrainType();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_COURSEWARE_TRAIN_TYPE_G";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_courseware_id", DbType.Int32, coursewareID);
            db.AddInParameter(dbCommand, "p_train_type_id", DbType.Int32, trainTypeID);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    obj = CreateModelObject(dataReader);
                }
            }

            return(obj);
        }
Beispiel #4
0
        public IList <CoursewareTrainType> GetCoursewareTrainTypeByCoursewareID(int coursewareID)
        {
            IList <CoursewareTrainType> objList = new List <CoursewareTrainType>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_COURSEWARE_TRAIN_TYPE_S";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_courseware_id", DbType.Int32, coursewareID);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    CoursewareTrainType obj = CreateModelObject(dataReader);
                    objList.Add(obj);
                }
            }

            return(objList);
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                if (PrjPub.HasEditRight("课件管理") && PrjPub.IsServerCenter)                //&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("课件管理") && PrjPub.IsServerCenter)                //&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                OrganizationBLL orgBll = new OrganizationBLL();
                int             orgID  = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID);
                HfOrgId.Value = orgID.ToString();

                BindGrid();
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    DeleteData(int.Parse(strDeleteID));
                    BindGrid();
                }

                if (Request.Form.Get("Refresh") == "true")
                {
                    BindGrid();
                }
            }

            string strUpID = Request.Form.Get("UpID");

            if (strUpID != null && strUpID != "")
            {
                if (Request.QueryString.Get("type") == "Courseware")
                {
                    CoursewareBLL             objBll = new CoursewareBLL();
                    RailExam.Model.Courseware obj    = objBll.GetCourseware(Convert.ToInt32(strUpID));
                    obj.OrderIndex = obj.OrderIndex - 1;
                    objBll.UpdateCourseware(obj);
                }

                if (Request.QueryString.Get("type") == "TrainType")
                {
                    int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id"));
                    CoursewareTrainTypeBLL objTrainTypeBll = new CoursewareTrainTypeBLL();
                    CoursewareTrainType    objTrainType    =
                        objTrainTypeBll.GetCoursewareTrainType(Convert.ToInt32(strUpID), trainTypeID);
                    objTrainType.OrderIndex = objTrainType.OrderIndex - 1;
                    objTrainTypeBll.UpdateCoursewareTrainType(objTrainType);
                }
                BindGrid();
            }

            string strDownID = Request.Form.Get("DownID");

            if (strDownID != null && strDownID != "")
            {
                if (Request.QueryString.Get("type") == "Courseware")
                {
                    CoursewareBLL             objBll = new CoursewareBLL();
                    RailExam.Model.Courseware obj    = objBll.GetCourseware(Convert.ToInt32(strDownID));
                    obj.OrderIndex = obj.OrderIndex + 1;
                    objBll.UpdateCourseware(obj);
                }

                if (Request.QueryString.Get("type") == "TrainType")
                {
                    int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id"));
                    CoursewareTrainTypeBLL objTrainTypeBll = new CoursewareTrainTypeBLL();
                    CoursewareTrainType    objTrainType    =
                        objTrainTypeBll.GetCoursewareTrainType(Convert.ToInt32(strDownID), trainTypeID);
                    objTrainType.OrderIndex = objTrainType.OrderIndex + 1;
                    objTrainTypeBll.UpdateCoursewareTrainType(objTrainType);
                }
                BindGrid();
            }
        }
Beispiel #6
0
 public void UpdateCoursewareTrainType(CoursewareTrainType coursewareTrainType)
 {
     dal.UpdateCoursewareTrainType(coursewareTrainType);
 }
Beispiel #7
0
 public void AddCoursewareTrainType(CoursewareTrainType coursewareTrainType)
 {
     dal.AddCoursewareTrainType(coursewareTrainType);
 }