示例#1
0
        /// <summary>
        /// 添加答辩小组
        /// </summary>
        private void insert()
        {
            string leaderId = Request["leaderId"];
            string memberId = Request["memberId"];
            string recordId = Request["recordId"];
            string planId = Request["planId"];
            Teacher teaLeader = teacherBll.GetModel(leaderId);
            Teacher teaMember = teacherBll.GetModel(memberId);
            Teacher tearecord = teacherBll.GetModel(recordId);
            string leaderName = teaLeader.TeaName;
            string memberName = teaMember.TeaName;
            string recordName = tearecord.TeaName;

            DefenceGroup defenceGroup = new DefenceGroup();
            defenceGroup.leader = leaderId;
            defenceGroup.member = memberId;
            defenceGroup.recorder = recordId;
            defenceGroup.leaderName = leaderName;
            defenceGroup.memberName = memberName;
            defenceGroup.recordName = recordName;
            Plan plan = new Plan();
            plan.PlanId = Convert.ToInt32(planId);
            defenceGroup.plan = plan;
            //添加过的教师不显示
            Result result, row1, row2, row3;
            teaLeader.state = 1;
            row1 = teacherBll.Updata(teaLeader);
            teaMember.state = 1;
            row2 = teacherBll.Updata(teaMember);
            tearecord.state = 1;
            row3 = teacherBll.Updata(tearecord);
            if (row1 == Result.更新失败 || row2 == Result.更新失败 || row3 == Result.更新失败)
            {
                teaLeader.state = 0;
                row1 = teacherBll.Updata(teaLeader);
                teaMember.state = 0;
                row2 = teacherBll.Updata(teaMember);
                tearecord.state = 0;
                row3 = teacherBll.Updata(tearecord);
                result = Result.添加失败;
            }
            else {
                result = defenceBll.InsertGroup(defenceGroup);
            }
            if (result == Result.添加成功)
            {
                LogHelper.Info(this.GetType(), teacher.TeaAccount + " - " + teacher.TeaName + " - 分配" + plan.PlanId + "批次答辩小组");
                Response.Write("分配成功");
                Response.End();
            }
            else
            {
                Response.Write("分配失败");
                Response.End();
            }
        }
示例#2
0
文件: DefenceBll.cs 项目: kmlihy/PMS
        public Result InsertGroup(DefenceGroup defence)
        {
            int row = dedao.InsertGroup(defence);

            if (row > 0)
            {
                return(Result.添加成功);
            }
            else
            {
                return(Result.添加失败);
            }
        }
示例#3
0
文件: DefenceBll.cs 项目: kmlihy/PMS
        /// <summary>
        /// 根据答辩小组id查找答辩小组
        /// </summary>
        /// <param name="defenGroupId">答辩小组id</param>
        /// <returns></returns>
        public DefenceGroup SelectGroup(int defenGroupId)
        {
            DataSet      ds      = dedao.SelectGroup(defenGroupId);
            DefenceGroup defence = new DefenceGroup();

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                int i = ds.Tables[0].Rows.Count - 1;
                defence.leader   = ds.Tables[0].Rows[i]["leader"].ToString();
                defence.member   = ds.Tables[0].Rows[i]["member"].ToString();
                defence.recorder = ds.Tables[0].Rows[i]["recorder"].ToString();
                return(defence);
            }
            return(null);
        }
示例#4
0
文件: DefenceDao.cs 项目: kmlihy/PMS
 /// <summary>
 /// 添加答辩小组
 /// </summary>
 /// <param name="defence">答辩小组对象</param>
 /// <returns>受影响行数</returns>
 public int InsertGroup(DefenceGroup defence)
 {
     try
     {
         string   cmdText = "insert into T_DefenceGroup(leader,member,recorder,planId,leaderName,memberName,recordName) values(@leader,@member,@recorder,@planId,@leaderName,@memberName,@recordName)";
         string[] param   = { "@leader", "@member", "@recorder", "@planId", "@leaderName", "@memberName", "@recordName" };
         object[] values  = { defence.leader, defence.member, defence.recorder, defence.plan.PlanId, defence.leaderName, defence.memberName, defence.recordName };
         int      row     = db.ExecuteNoneQuery(cmdText.ToString(), param, values);
         return(row);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#5
0
文件: DefenceDao.cs 项目: kmlihy/PMS
        /// <summary>
        /// 通过选题记录id取到答辩小组id
        /// </summary>
        /// <param name="titleRecordId">选题记录id</param>
        /// <returns></returns>
        public DefenceGroup getDgId(string titleRecordId)
        {
            string sql = "select top 1 defenGroupId from T_DefenceRecord where titleRecordId=@titleRecordId order by defenRecordId desc";

            string[]      param        = { "@titleRecordId" };
            object[]      values       = { titleRecordId };
            DefenceGroup  defenceGroup = new DefenceGroup();
            SqlDataReader reader       = db.ExecuteReader(sql, param, values);

            while (reader.Read())
            {
                defenceGroup.defenGroupId = reader.GetInt32(0);
            }
            reader.Close();
            return(defenceGroup);;
        }
示例#6
0
        /// <summary>
        /// 实现分页
        /// </summary>
        /// <param name="strWhere">搜索条件</param>
        ///
        public void getdata(String strWhere)
        {
            DefenceGroup defenceGroup = defenceBll.SelectGroup(Convert.ToInt32(Session["defenGroupId"]));

            if (defenceGroup != null)
            {
                leaderAccount = defenceGroup.leader;
                memberAccount = defenceGroup.member;
                recordAccount = defenceGroup.recorder;
                string currentPage = Request.QueryString["currentPage"];
                if (currentPage == null || currentPage.Length <= 0)
                {
                    currentPage = "1";
                }
                string userType    = Session["state"].ToString();
                string userCollege = "";
                //usertype=2 为分院管理员登录
                if (userType == "2")
                {
                    int userCollegeId = tea.college.ColID;
                    if (strWhere == null || strWhere == "")
                    {
                        userCollege = @"collegeId = " + userCollegeId + " and teaAccount not like " + leaderAccount + " and teaAccount not like " + memberAccount + " and teaAccount not like " + recordAccount
                                      + " and crossTea not like " + leaderAccount + " and crossTea not like " + memberAccount + " and crossTea not like " + recordAccount + " and state=0";
                    }
                    else
                    {
                        userCollege = @"collegeId = " + userCollegeId + " and teaAccount not like " + leaderAccount + " and teaAccount not like " + memberAccount + " and teaAccount not like " + recordAccount
                                      + " and crossTea not like " + leaderAccount + " and crossTea not like " + memberAccount + " and crossTea not like " + recordAccount + " and state=0 and " + strWhere;
                    }
                    StudentBll   pro       = new StudentBll();
                    TableBuilder tabuilder = new TableBuilder()
                    {
                        StrTable      = "V_DefenAndStudent",
                        StrWhere      = userCollege,
                        IntColType    = 0,
                        IntOrder      = 0,
                        IntPageNum    = int.Parse(currentPage),
                        IntPageSize   = pagesize,
                        StrColumn     = "titleRecordId",
                        StrColumnlist = "titleRecordId,collegeName,proName,stuAccount,realName"
                    };
                    getCurrentPage = int.Parse(currentPage);
                    ds             = pro.SelectBypage(tabuilder, out count);
                }
            }
        }
示例#7
0
        public void getPage()
        {
            Student     stu         = (Student)Session["loginuser"];
            string      account     = stu.StuAccount;
            TitleRecord titleRecord = titleRecordBll.getRtId(account);

            RTId = titleRecord.TitleRecordId.ToString();
            //暂未选题
            if (RTId == "0" || RTId == "" || RTId == null)
            {
                RTId = "";
            }
            //暂未指定答辩小组
            else if (!defenceBll.isGroup(RTId))
            {
                RTId = "noGroup";
            }
            else
            {
                DefenceGroup getDgId      = defenceBll.getDgId(RTId);
                string       dgId         = getDgId.defenGroupId.ToString();
                DefenceGroup defenceGroup = defenceBll.getTeaId(dgId);

                ///分别取到小组成员账号
                string leader   = defenceGroup.leader;
                string member   = defenceGroup.member;
                string recorder = defenceGroup.recorder;

                Teacher leaderId   = teacherBll.getModel(leader);
                Teacher memberId   = teacherBll.getModel(member);
                Teacher recorderId = teacherBll.getModel(recorder);

                //取到姓名
                leaderName   = leaderId.TeaName;
                memberName   = memberId.TeaName;
                recorderName = recorderId.TeaName;
                //取到电话
                leaderTel   = leaderId.Phone;
                memberTel   = memberId.Phone;
                recorderTel = recorderId.Phone;
                //取到邮箱
                leaderMail   = leaderId.Email;
                memberMail   = memberId.Email;
                recorderMail = recorderId.Email;
            }
        }
示例#8
0
文件: DefenceDao.cs 项目: kmlihy/PMS
        /// <summary>
        /// 通过defenGroupId分别取到leader,member,recorder
        /// </summary>
        /// <param name="dgId">defenGroupId</param>
        /// <returns></returns>
        public DefenceGroup getTeaId(string dgId)
        {
            string sql = "select leader,member,recorder from T_DefenceGroup where defenGroupId=@dgId";

            string[]      param        = { "@dgId" };
            object[]      values       = { dgId };
            DefenceGroup  defenceGroup = new DefenceGroup();
            SqlDataReader reader       = db.ExecuteReader(sql, param, values);

            while (reader.Read())
            {
                defenceGroup.leader   = reader.GetString(0);
                defenceGroup.member   = reader.GetString(1);
                defenceGroup.recorder = reader.GetString(2);
            }
            reader.Close();
            return(defenceGroup);;
        }
示例#9
0
        /// <summary>
        /// 添加学生
        /// </summary>
        /// <returns></returns>
        public Result addStudent()
        {
            string stuAccount = Request["stuAccount"];

            string[] stuList = stuAccount.Split('?');
            for (int i = 0; i < stuList.Length - 1; i++)
            {
                TitleRecordBll titleBll      = new TitleRecordBll();
                TitleRecord    titleRecord   = titleBll.getRtId(stuList[i]);
                int            titleRecordId = titleRecord.TitleRecordId;
                DefenceBll     defenceBll    = new DefenceBll();
                DefenceRecord  defence       = new DefenceRecord();
                defence.titleRecord = titleRecord;
                DefenceGroup defenceGroup = new DefenceGroup();
                int          defenId      = Convert.ToInt32(Session["defenGroupId"]);
                defenceGroup.defenGroupId = defenId;
                defence.defenceGroup      = defenceGroup;
                row = defenceBll.InsertStudent(defence);
                StudentBll stuBll  = new StudentBll();
                Student    student = stuBll.GetModel(stuList[i]);
                string     stu     = stuList[i];
                student.state = 1;
                Result result = stuBll.Updata(student);
                if (row != Result.添加成功 || result != Result.更新成功)
                {
                    Response.Write("添加失败");
                    Response.End();
                    break;
                }
                else
                {
                    LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 添加" + defenId + "答辩小组学生 - " + student.StuAccount + " - " + student.RealName);
                }
            }
            return(row);
        }