Ejemplo n.º 1
0
        public void ClassRoom_Add()
        {
            M_ClassRoom roomMod = croomBll.SelReturnModel(Mid);

            if (roomMod == null)
            {
                roomMod = new M_ClassRoom();
            }
            int olderuser = roomMod.CreateUser;//记录原教师id

            roomMod.Classinfo = Request.Form["Classinfo"];
            M_UserInfo mu = buser.SelReturnModel(DataConverter.CLng(Request.Form["Manager_Hid"]));

            if (mu.IsNull)
            {
                mu = buser.GetLogin();
            }
            roomMod.CreateUser = mu.UserID;
            roomMod.Creation   = DateTime.Now;
            roomMod.Grade      = DataConverter.CLng(Request.Form["Grade"]);
            roomMod.Integral   = DataConverter.CLng(Request.Form["Integral"]);
            roomMod.IsTrue     = string.IsNullOrEmpty(Request.Form["IsTrue"]) ? 0 : 1;
            string saveurl = ZLHelper.GetUploadDir_Admin(adminMod, "Exam");

            roomMod.Monitor   = Request.Form["Monitor"];
            roomMod.ClassStar = DataConverter.CLng(Request.Form["star_hid"]);
            roomMod.IsDone    = string.IsNullOrEmpty(Request.Form["IsDone"]) ? 0 : 1;
            roomMod.RoomName  = Request.Form["RoomName"];
            string    schName     = Request.Form["SchoolName_T"].Trim();
            DataTable tempschools = schBll.SelByName(schName);

            //添加或选择学校操作
            if (string.IsNullOrEmpty(schName))
            {
                roomMod.SchoolID = 0;
            }
            else if (tempschools.Rows.Count > 0)
            {
                roomMod.SchoolID = DataConverter.CLng(tempschools.Rows[0]["ID"]);
            }                                                                                                         //选择学校
            else
            {
                roomMod.SchoolID = InsertSchool(schName);
            }                                                 //添加学校
            if (roomMod.RoomID > 0)
            {
                if (olderuser != roomMod.CreateUser)//更改了班主任
                {
                    ChangeTearch(olderuser, mu, roomMod.CreateUser);
                }
                croomBll.GetUpdate(roomMod);
                function.WriteSuccessMsg("修改成功!", "ClassRoomShow?id=" + roomMod.RoomID); return;
            }
            int roomid = croomBll.GetInsert(roomMod);

            InsertTearcher(mu, roomid);
            function.WriteSuccessMsg("添加成功!", "ClassRoomShow?id=" + roomid); return;
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            M_ClassRoom cinfo = new M_ClassRoom();

            if (ClassID > 0)
            {
                cinfo = classBll.SelReturnModel(ClassID);
            }
            int olderuser = cinfo.CreateUser;//记录原教师id

            cinfo.RoomID = DataConverter.CLng(txtRoomID.Value);
            //cinfo.Adviser = txtAdviser.Text.Trim();
            cinfo.Classinfo = txtClassinfo.Text.Trim();
            M_UserInfo mu = buser.SelReturnModel(DataConverter.CLng(Manager_Hid.Value));

            cinfo.CreateUser = DataConverter.CLng(Manager_Hid.Value);
            cinfo.Creation   = DateTime.Now;
            cinfo.Grade      = DataConverter.CLng(GradeList_Drop.SelectedValue);
            cinfo.Integral   = DataConverter.CLng(ClassNum_T.Text);
            cinfo.IsTrue     = txtIsTrue.Checked ? 1 : 0;
            M_AdminInfo admininfo = badmin.GetAdminLogin();
            string      saveurl   = SiteConfig.SiteOption.UploadDir + "Exam/" + admininfo.AdminName + admininfo.AdminId + "/";

            cinfo.Monitor   = ClassIcon_T.Text;
            cinfo.ClassStar = DataConverter.CLng(star_hid.Value);
            cinfo.IsDone    = IsDone_Check.Checked ? 1 : 0;
            cinfo.RoomName  = txtRoomName.Text.Trim();
            DataTable tempschools = sll.SelByName(SchoolName_T.Text.Trim());

            //添加或选择学校操作
            if (string.IsNullOrEmpty(SchoolName_T.Text))
            {
                cinfo.SchoolID = 0;
            }
            else if (tempschools.Rows.Count > 0)
            {
                cinfo.SchoolID = DataConverter.CLng(tempschools.Rows[0]["ID"]);
            }                                                                                                       //选择学校
            else
            {
                cinfo.SchoolID = InsertSchool(SchoolName_T.Text.Trim());
            }                                                                //添加学校
                                                                             //cinfo.Teacher = txtTeacher.Text.Trim();
            if (ClassID > 0)
            {
                if (!olderuser.ToString().Equals(Manager_Hid.Value))//更改了班主任
                {
                    ChangeTearch(olderuser, mu, ClassID);
                }
                classBll.GetUpdate(cinfo);
                function.WriteSuccessMsg("修改成功!", "ClassShow.aspx?cid=" + ClassID);
            }
            int classid = classBll.GetInsert(cinfo);

            InsertTearcher(mu, classid);
            function.WriteSuccessMsg("添加成功!", "ClassShow.aspx?cid=" + classid);
        }