Exemple #1
0
        /// <summary>
        /// 单一条件String查询
        /// </summary>
        /// <param name="Value"></param>
        /// <param name="ValueName"></param>
        /// <returns></returns>
        public static List <Models.DB.StudentInfoModel> FindByString(String Value, String ValueName)
        {
            #region 输入合法性检查
            if (String.IsNullOrEmpty(Value))
            {
                return(null);
            }
            #endregion

            List <Models.DB.StudentInfoModel> list = new List <Models.DB.StudentInfoModel>();


            DataTable dt = DAL.Select.QueryOne(Value, "Tb_StudentInfoModel", ValueName);

            for (int i = 0; i < dt.Rows.Count; ++i)
            {
                Models.DB.StudentInfoModel e = new Models.DB.StudentInfoModel();
                e.StudentID  = dt.Rows[i]["StudentID"].ToString();
                e.Name       = dt.Rows[i]["Name"].ToString();
                e.Sex        = dt.Rows[i]["Sex"].ToString();
                e.Major      = dt.Rows[i]["Major"].ToString();
                e.InTimeYear = Convert.ToInt32(dt.Rows[i]["InTimeYear"]);
                e.School     = dt.Rows[i]["School"].ToString();
                e.College    = dt.Rows[i]["College"].ToString();
                e.UserId     = Convert.ToInt32(dt.Rows[i]["UserId"]);
                e.Mail       = dt.Rows[i]["Mail"].ToString();

                list.Add(e);
            }
            return(list);
        }
 private void initData()
 {
     if (String.IsNullOrEmpty(Request["ProjectID"]) || String.IsNullOrEmpty(Request["MID"]))
     {
         Response.Redirect("Default.aspx");
     }
     ProjectID   = Request["ProjectID"].ToString();
     MatchID     = Request["MID"].ToString();
     Match       = BLL.Match.SelectOne(Convert.ToInt32(MatchID));
     Innovations = BLL.InnovationProjectModel.FindByInt(ProjectID, "Id");
     if (Innovations.Count > 0)
     {
         Innovation = Innovations[0];
     }
     else
     {
         Innovation = new Models.DB.InnovationProjectModel();
     }
     Declarant   = BLL.InnovationDeclarantInfo.SelectOne(ProjectID);
     TeamMembers = BLL.InnovationTeamMember.SelectByProjectId(ProjectID);
     Tutors      = BLL.Tutors.SelectByProjectId(ProjectID);
     Works       = BLL.InnovationWorksInfo.FindByInt(ProjectID, "ProjectID");
     if (Works.Count > 0)
     {
         WorkInfo = Works[0];
     }
     else
     {
         WorkInfo = new Models.DB.InnovationWorksInfo();
     }
     Student = BLL.StudentInfoModel.SelectOneByUserId(Innovation.UserID.ToString());
 }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     accessControl();
     if (String.IsNullOrEmpty(Request["ProjectID"]) || String.IsNullOrEmpty(Request["MID"]))
     {
         Response.Redirect("Default.aspx");
     }
     ProjectID = Request["ProjectID"].ToString();
     MatchID   = Request["MID"].ToString();
     Match     = BLL.Match.SelectOne(Convert.ToInt32(MatchID));
     Projects  = BLL.CupProjectModel.FindByInt(ProjectID, "ID");
     if (Projects.Count > 0)
     {
         Project = Projects[0];
     }
     else
     {
         Project = new Models.DB.CupProjectModel();
     }
     Declarant   = BLL.CupDeclarantInfo.SelectOneByProjectID(ProjectID);
     TeamMember  = BLL.CupTeamMemberInfo.SelectByProjectId(ProjectID);
     Recommender = BLL.RecommendInfo.SelectByProjectId(ProjectID);
     Student     = BLL.StudentInfoModel.SelectOneByUserId(Project.UserID.ToString());
     if (Project.Category == "自然科学类学术论文")
     {
         WorkInfoList = BLL.CupWorksInfo.FindByInt(ProjectID, "ProjectID");
         if (WorkInfoList.Count > 0)
         {
             WorkInfo = WorkInfoList[0];
         }
         else
         {
             WorkInfo = new Models.DB.CupWorksInfo();
         }
     }
     else if (Project.Category == "哲学社会科学类社会调查报告和学术论文")
     {
         SurveyInfoList = BLL.CupWorksSurvey.FindByInt(ProjectID, "ProjectID");
         if (SurveyInfoList.Count > 0)
         {
             SurveyInfo = SurveyInfoList[0];
         }
         else
         {
             SurveyInfo = new Models.DB.CupWorksSurvey();
         }
     }
     else if (Project.Category == "科技发明制作")
     {
         InventionInfoList = BLL.CupWorksInvention.FindByInt(ProjectID, "ProjectID");
         if (InventionInfoList.Count > 0)
         {
             InventionInfo = InventionInfoList[0];
         }
         else
         {
             InventionInfo = new Models.DB.CupWorksInvention();
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// 根据UserID获取记录
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static Models.DB.StudentInfoModel SelectOneByUserId(string UserID)
        {
            Models.DB.StudentInfoModel Student = new Models.DB.StudentInfoModel();
            int userId = 0;

            if (string.IsNullOrEmpty(UserID))
            {
                return(Student);
            }
            try
            {
                userId = Convert.ToInt32(UserID);
            }
            catch
            {
                return(Student);
            }
            Student.UserId = userId;
            System.Data.DataTable dt = DAL.Select.GetList(Student, "UserId");
            if (dt.Rows.Count > 0)
            {
                Student.StudentID  = dt.Rows[0]["StudentID"].ToString();
                Student.Name       = dt.Rows[0]["Name"].ToString();
                Student.Sex        = dt.Rows[0]["Sex"].ToString();
                Student.Major      = dt.Rows[0]["Major"].ToString();
                Student.InTimeYear = Convert.ToInt32(dt.Rows[0]["InTimeYear"]);
                Student.School     = dt.Rows[0]["School"].ToString();
                Student.College    = dt.Rows[0]["College"].ToString();
                Student.UserId     = Convert.ToInt32(dt.Rows[0]["UserId"]);
                Student.Mail       = dt.Rows[0]["Mail"].ToString();
            }
            return(Student);
        }
Exemple #5
0
        private void initData()
        {
            if (Context.Request["ProjectID"] == null)
            {
                Response.Redirect("../../Match/Default.aspx");
            }
            if (Context.Session["user"] == null)
            {
                Response.Redirect(ResolveUrl("~/Web/Login/Default.aspx"));
            }

            ProjectID = Context.Request["ProjectID"].ToString();
            UserID    = Context.Session["user"].ToString();
            Student   = BLL.StudentInfoModel.SelectOneByUserId(UserID);
            Projects  = BLL.InnovationProjectModel.FindByInt(ProjectID, "Id");
            Declarant = BLL.InnovationDeclarantInfo.SelectOne(ProjectID);
            if (Declarant == null)
            {
                Declarant = new Models.DB.InnovationDeclarantInfo();
            }


            if (Projects.Count <= 0)
            {
                Response.Redirect("../../Match/Default.aspx");
            }
            Match = BLL.Match.SelectOne(Convert.ToInt32(Projects[0].MatchID));
            if (Match == null)
            {
                Response.Redirect("../../Match/Default.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.Session["user"] == null)
            {
                Response.Redirect("~/Web/Login/Default.aspx");
            }
            UserID         = Context.Session["user"].ToString();
            Student        = BLL.StudentInfoModel.SelectOneByUserId(UserID);
            CupList        = BLL.CupProjectModel.FindByInt(UserID.ToString(), "UserID");
            InnovationList = BLL.InnovationProjectModel.FindByInt(UserID.ToString(), "UserID");
            ProjectList.AddRange(CupList);
            ProjectList.AddRange(InnovationList);
            PageSum = ProjectList.Count;

            if (!string.IsNullOrEmpty(Request["page"]))
            {
                current_page = Convert.ToInt32(Request["page"].ToString());
            }
            page_count = (int)Math.Ceiling(PageSum / (double)page_size);
            if (current_page <= 0)
            {
                current_page = 1;
            }
            if (current_page > page_count)
            {
                current_page = page_count;
            }
        }
 private void initData()
 {
     if (Session["user"] == null)
     {
         Response.Redirect(ResolveUrl("~/Web/Login/Default.aspx"));
     }
     UserID  = Session["user"].ToString();
     Student = BLL.StudentInfoModel.SelectOneByUserId(UserID);
 }
Exemple #8
0
        public static double CountByEnable(string Enable)
        {
            bool enable = true;

            if (string.IsNullOrEmpty(Enable))
            {
                return(0);
            }
            try
            {
                enable = Convert.ToBoolean(Enable);
            }
            catch
            {
                return(0);
            }
            Models.DB.StudentInfoModel Student = new Models.DB.StudentInfoModel();
            Models.DB.User             User    = new Models.DB.User();
            User.Enable = enable;
            return(DAL.Select.GetCount(Student, User, "Tb_StudentInfoModel.UserId=Tb_User.ID", "Enable"));
        }
Exemple #9
0
        /// <summary>
        /// 根据Enable获取数据
        /// </summary>
        /// <param name="Enable"></param>
        /// <param name="pagesize"></param>
        /// <param name="currentPage"></param>
        /// <returns></returns>
        public static List <Models.DB.StudentInfoModel> SelectByEnable(string Enable, int pagesize, int currentPage)
        {
            List <Models.DB.StudentInfoModel> Students = new List <Models.DB.StudentInfoModel>();
            bool enable = true;

            if (string.IsNullOrEmpty(Enable))
            {
                return(Students);
            }
            try
            {
                enable = Convert.ToBoolean(Enable);
            }
            catch
            {
                return(Students);
            }
            Models.DB.StudentInfoModel Student = new Models.DB.StudentInfoModel();
            Models.DB.User             User    = new Models.DB.User();
            Models.DB.RoleInfoModel    Model   = BLL.RoleInfoModel.SelectRoleInfoModel("Tb_StudentInfoModel");
            List <Models.DB.Role>      Roles   = BLL.Role.SelectRole(Model.Id);

            if (Roles.Count <= 0)
            {
                return(Students);
            }
            User.Enable = enable;
            User.RoleId = Roles[0].ID;
            string[] targets         = { "RoleId", "Enable" };
            System.Data.DataTable dt = DAL.Select.GetSome(User, targets, pagesize, currentPage, "ID", "");
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Student = BLL.StudentInfoModel.SelectOneByUserId(dt.Rows[i]["Id"].ToString());
                    Students.Add(Student);
                }
            }
            return(Students);
        }
Exemple #10
0
        private bool initData(string ProjectId)
        {
            List <Models.DB.InnovationProjectModel> Projects = BLL.InnovationProjectModel.FindByInt(ProjectId, "Id");

            if (Projects.Count <= 0)
            {
                return(false);
            }
            Project = Projects[0];
            Match   = BLL.Match.SelectOne(Project.MatchID);
            List <Models.DB.InnovationWorksInfo> WorksInfos = BLL.InnovationWorksInfo.FindByInt(ProjectId, "ProjectId");

            if (WorksInfos.Count > 0)
            {
                WorksInfo = WorksInfos[0];
            }
            TeamMembers = BLL.InnovationTeamMember.SelectByProjectId(ProjectId);
            Declarant   = BLL.InnovationDeclarantInfo.SelectOne(ProjectId);
            Tutors      = BLL.Tutors.SelectByProjectId(ProjectId);
            Student     = BLL.StudentInfoModel.SelectOneByUserId(Project.UserID + "");
            return(true);
        }
        /// <summary>
        /// 插入学生基本信息
        /// </summary>
        /// <param name="StudentID"></param>
        /// <param name="Name"></param>
        /// <param name="Sex"></param>
        /// <param name="Major"></param>
        /// <param name="InTimeYear"></param>
        /// <param name="School"></param>
        /// <param name="College"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public static int CreateStudentModelInfo(String StudentID, String Name, String Sex, String Major, String InTimeYear, String School, String College, String Mail, int UserId)
        {
            #region 输入合法性检测
            if (string.IsNullOrEmpty(StudentID) || string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Sex) || string.IsNullOrEmpty(Major) || string.IsNullOrEmpty(School) ||
                string.IsNullOrEmpty(College) || string.IsNullOrEmpty(Mail))
            {
                return(0);
            }

            int intimeyear;
            try
            {
                intimeyear = Convert.ToInt32(InTimeYear);
            }
            catch
            {
                return(0);
            }
            #endregion


            #region 把输入组装成类的实例
            Models.DB.StudentInfoModel student = new Models.DB.StudentInfoModel();
            student.StudentID  = StudentID;
            student.Name       = Name;
            student.Sex        = Sex;
            student.Major      = Major;
            student.School     = School;
            student.College    = College;
            student.Mail       = Mail;
            student.UserId     = UserId;
            student.InTimeYear = intimeyear;

            #endregion

            return(DAL.Create.CreateOne(student));
        }
Exemple #12
0
        public static int UpdateStudent(String StudentID, String Mail, String UserID, String InTimeYear)
        {
            if (String.IsNullOrEmpty(StudentID))
            {
                return(0);
            }
            int userid, intimeyear;

            try
            {
                userid     = Convert.ToInt32(UserID);
                intimeyear = Convert.ToInt32(InTimeYear);
            }
            catch
            {
                return(0);
            }
            Models.DB.StudentInfoModel Student = new Models.DB.StudentInfoModel();
            Student.StudentID  = StudentID;
            Student.Mail       = Mail;
            Student.UserId     = userid;
            Student.InTimeYear = intimeyear;
            return(DAL.Update.ChangeSome(Student, "StudentID"));
        }
Exemple #13
0
        public static List <Models.DB.StudentInfoModel> SelectByEnableAndCollege(string Enable, int pagesize, int currentPage, String College)
        {
            List <Models.DB.StudentInfoModel> list = new List <Models.DB.StudentInfoModel>();
            bool enable = true;

            if (string.IsNullOrEmpty(Enable) || String.IsNullOrEmpty(College))
            {
                return(null);
            }
            try
            {
                enable = Convert.ToBoolean(Enable);
            }
            catch
            {
                return(null);
            }
            System.Data.DataTable      dt      = DAL.Select.SelectByEnableAndCollege(pagesize, currentPage, "Tb_User.ID", "", College, enable);
            Models.DB.StudentInfoModel Student = new Models.DB.StudentInfoModel();
            for (int i = 0; i < dt.Rows.Count; ++i)
            {
                Models.DB.StudentInfoModel e = new Models.DB.StudentInfoModel();
                e.StudentID  = dt.Rows[i]["StudentID"].ToString();
                e.Name       = dt.Rows[i]["Name"].ToString();
                e.Sex        = dt.Rows[i]["Sex"].ToString();
                e.Major      = dt.Rows[i]["Major"].ToString();
                e.InTimeYear = Convert.ToInt32(dt.Rows[i]["InTimeYear"]);
                e.School     = dt.Rows[i]["School"].ToString();
                e.College    = dt.Rows[i]["College"].ToString();
                e.UserId     = Convert.ToInt32(dt.Rows[i]["UserId"]);
                e.Mail       = dt.Rows[i]["Mail"].ToString();

                list.Add(e);
            }
            return(list);
        }