Exemple #1
0
        protected bool CanSubmit()
        {
            DataTable dt = ViewState["table"] as DataTable;

            if (dt.Rows.Count == 0)
            {
                Maticsoft.Common.MessageBox.Show(this, "上传数据不能为空");
                return false;
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int collegeId = BLL.Utils.GetCollegeIdByName(dt.Rows[i]["学院"].ToString());
                int majorId = BLL.Utils.GetMajorIdByName(dt.Rows[i]["学院"].ToString(), dt.Rows[i]["专业"].ToString());
                int classId = BLL.Utils.GetClassIdByName(dt.Rows[i]["学院"].ToString(), dt.Rows[i]["专业"].ToString(), dt.Rows[i]["班级"].ToString());
                BLL.WebUser bllStu=new WebUser();
                DataSet ds=bllStu.GetStudents(Convert.ToInt32(dt.Rows[i]["学号"].ToString()));
                List<Eva.Model.WebUser> list = bllStu.DataTableToList(ds.Tables[0]);
                if (list.Count>0)
                {
                     this.Upload_info.Text += string.Format("<br/><span style='color:red;'>表格第{0}行,这‘{1}’学号已存在。<span>",
                                                                i + 1, dt.Rows[i]["学号"].ToString());
                    return false;
                }

                if (collegeId == -1)
                {
                    this.Upload_info.Text += string.Format("<br/><span style='color:red;'>表格第{0}行,本协会不存在‘{1}’这个学院。<span>",
                                                                i + 1, dt.Rows[i]["学院"].ToString());
                    return false;
                }
                if (majorId == -1)
                {
                    this.Upload_info.Text += string.Format("<br/><span style='color:red;'>表格第{0}行,不存在‘{1}’这个专业。<span>",
                                                                i + 1, dt.Rows[i]["专业"].ToString());
                    return false;
                }

                if (classId == -1)
                {
                    this.Upload_info.Text += string.Format("<br/><span style='color:red;'>表格第{0}行,不存在‘{1}’这个班级。<span>",
                                                               i + 1, dt.Rows[i]["班级"].ToString());
                    return false;
                }
            }

            return true;
        }
Exemple #2
0
 public static WebUser GetWebUserBLLInstance()
 {
     //如实例不存在,则New一个新实例,否则返回已有实例
     if (WebUserBLLInstance == null)
     {
         lock (syncRootWebUser)
         {
             if (WebUserBLLInstance == null)
                 WebUserBLLInstance = new WebUser();
         }
     }
     return WebUserBLLInstance;
 }
Exemple #3
0
 public static string GetTeacherName(int id)
 {
     var bll = new WebUser();
     return bll.GetModel(id).Name;
 }