Example #1
0
 private void ShowInfo(int ID)
 {
     JiaJiao.BLL.Teacher bll = new JiaJiao.BLL.Teacher();
     JiaJiao.Model.Teacher model = bll.GetModel(ID);
     this.lblID.Text = model.ID.ToString();
     this.lblTeacherName.Text = model.TeacherName;
     this.lblTeacherTel.Text = model.TeacherTel;
     this.lblTeacherEmail.Text = model.TeacherEmail;
     this.lblTeacherAddress.Text = model.TeacherAddress;
     this.lblTeacherDescribe.Text = model.TeacherDescribe;
     Image1.ImageUrl = model.Image;
     JiaJiao.Data.Role role = new Data.Role();
        var dr=  role.Retrieve(model.RoleId.Value);
        this.lblRoleId.Text = dr[1].ToString();
 }
Example #2
0
        public void BindData()
        {
            List<JiaJiao.Model.ClassInfo> list = new List<JiaJiao.Model.ClassInfo>();
            JiaJiao.BLL.Teacher bllTeacher = new JiaJiao.BLL.Teacher();
            JiaJiao.BLL.ClassSetting classSetting=new BLL.ClassSetting();

            var classlist = bll.GetModelList("").GroupBy(key => key.Day);
            foreach (var item in classlist)
            {
                list.Add(new JiaJiao.Model.ClassInfo() { Day = item.Key });
            }

               var teacherlist = bllTeacher.GetModelList("");
               teachers = teacherlist;
               var clsSetting = classSetting.GetModelList("").GroupBy(key => key.DayId);
               int index = 0;

               foreach (var item in classlist)
               {
               int index1 = 0;
               foreach (var item0 in item)
               {
                  var templist =clsSetting.Where(key => key.Key == item0.ID);
                  if (templist.Count() > 0)
                  {
                      foreach (var item1 in templist.FirstOrDefault())
                      {
                         var teacher=  teacherlist.Where(t => t.ID == item1.TeacherId).FirstOrDefault();
                         if (teacher != null)
                         {
                             switch (index1)
                             {
                                 case 0:
                                     list[index].Time1 += teacher.TeacherName+" ";
                                     break;
                                 case 1:
                                     list[index].Time2 += teacher.TeacherName + " ";
                                     break;
                                 case 2:
                                     list[index].Time3 += teacher.TeacherName + " ";
                                     break;
                                 case 3:
                                     list[index].Time4 += teacher.TeacherName + " ";
                                     break;
                                 case 4:
                                     list[index].Time5 += teacher.TeacherName + " ";
                                     break;
                                 case 5:
                                     list[index].Time6 += teacher.TeacherName + " ";
                                     break;
                                 case 6:
                                     list[index].Time7 += teacher.TeacherName + " ";
                                     break;
                             }

                         }
                      }
                  }
                  index1++;
               }
               index++;
               }

            gridView.DataSource = list;
            gridView.DataBind();
        }
Example #3
0
        public void BindData()
        {
            List<JiaJiao.Model.ClassInfo> list = new List<JiaJiao.Model.ClassInfo>();
            JiaJiao.BLL.Teacher bllTeacher = new JiaJiao.BLL.Teacher();
            JiaJiao.BLL.ClassSetting classSetting = new BLL.ClassSetting();
            JiaJiao.BLL.Class Classbll = new JiaJiao.BLL.Class();

            var classlist = Classbll.GetModelList("").GroupBy(key => key.Day);
            foreach (var item in classlist)
            {
                list.Add(new JiaJiao.Model.ClassInfo() { Day = item.Key, KeyValues = new Dictionary<int, Model.ClassSetting>() });
            }

            var teacherlist = bllTeacher.GetModelList("");
            var teacher = teacherlist.Where(t => t.ID.ToString() == Request.QueryString["id"]).FirstOrDefault();
            if (teacher != null)
            {
                Image1.ImageUrl= teacher.Image;
                Label1.Text = teacher.TeacherName;
                Label2.Text = teacher.TeacherDescribe;
            }

            var clsSetting = classSetting.GetModelList("teacherid=" + Request.QueryString["id"]).GroupBy(key => key.DayId);
            int index = 0;

            foreach (var item in classlist)
            {
                int index1 = 0;
                foreach (var item0 in item)
                {
                    var templist = clsSetting.Where(key => key.Key == item0.ID);
                    if (templist.Count() > 0)
                    {
                        foreach (var item1 in templist.FirstOrDefault())
                        {
                            switch (index1)
                            {
                                case 0:
                                    list[index].Time1 += item1.Count + "/" + item1.Total;
                                    break;
                                case 1:
                                    list[index].Time2 += item1.Count + "/" + item1.Total;
                                    break;
                                case 2:
                                    list[index].Time3 += item1.Count + "/" + item1.Total;
                                    break;
                                case 3:
                                    list[index].Time4 += item1.Count + "/" + item1.Total;
                                    break;
                                case 4:
                                    list[index].Time5 += item1.Count + "/" + item1.Total;
                                    break;
                                case 5:
                                    list[index].Time6 += item1.Count + "/" + item1.Total;
                                    break;
                                case 6:
                                    list[index].Time7 += item1.Count + "/" + item1.Total;
                                    break;
                            }
                            list[index].KeyValues.Add(index1, item1);
                        }
                    }
                    else
                    {
                        list[index].KeyValues.Add(index1, null);
                    }
                    index1++;
                }
                index++;
            }

            gridView.DataSource = list;
            gridView.DataBind();
        }
Example #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.txtTeacherName.Text.Trim().Length == 0)
            {
                strErr += "姓名不能为空!\\n";
            }
            if (this.txtTeacherTel.Text.Trim().Length == 0)
            {
                strErr += "电话不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string fullFileName = this.fileUpLoad.PostedFile.FileName;
            string fileName = fullFileName.Substring(fullFileName.LastIndexOf(@"/") + 1);
            string typeName = (fullFileName.Substring(fullFileName.LastIndexOf(".") + 1)).ToLower();

            if (string.IsNullOrWhiteSpace(fileName))
            {
                MessageBox.Show(this, "请选择一张图片");
                return;
            }
            string file = DateTime.Now.ToString("yyyyMMddHHmmss") + "." + typeName;
            if (typeName == "png" || typeName == "jpg" || typeName == "bmp" || typeName == "gif" || typeName == "jpeg")
            {

                this.fileUpLoad.PostedFile.SaveAs(Server.MapPath("~/Images/") + file);

            }
            else
            {
                MessageBox.Show(this, "你的图片格式错误");
                return;
            }
            string TeacherName = this.txtTeacherName.Text;
            string TeacherTel = this.txtTeacherTel.Text;
            string TeacherEmail = this.txtTeacherEmail.Text;
            string TeacherAddress = this.txtTeacherAddress.Text;
            string TeacherDescribe = this.txtTeacherDescribe.Text;
            int RoleId = int.Parse(DropDownList1.SelectedValue);
            DateTime CreateTime = DateTime.Now;
            DateTime UpdateTime = DateTime.Now;

            JiaJiao.Model.Teacher model = new JiaJiao.Model.Teacher();
            model.TeacherName = TeacherName;
            model.TeacherTel = TeacherTel;
            model.TeacherEmail = TeacherEmail;
            model.TeacherAddress = TeacherAddress;
            model.TeacherDescribe = TeacherDescribe;
            model.RoleId = RoleId;
            model.CreateTime = CreateTime;
            model.UpdateTime = UpdateTime;
            model.Image = "~/Images/" + file;

            JiaJiao.BLL.Teacher bll = new JiaJiao.BLL.Teacher();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #5
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.txtTeacherName.Text.Trim().Length == 0)
            {
                strErr += "TeacherName不能为空!\\n";
            }
            if (this.txtTeacherTel.Text.Trim().Length == 0)
            {
                strErr += "TeacherTel不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string fullFileName = this.fileUpLoad.PostedFile.FileName;
            string fileName = fullFileName.Substring(fullFileName.LastIndexOf(@"/") + 1);
            string typeName = (fullFileName.Substring(fullFileName.LastIndexOf(".") + 1)).ToLower();

            string file = DateTime.Now.ToString("yyyyMMddHHmmss") + "." + typeName;
            bool flag = false;
            if (!string.IsNullOrWhiteSpace(fileName))
            {

                if (typeName == "png" || typeName == "jpg" || typeName == "bmp" || typeName == "gif" || typeName == "jpeg")
                {

                    this.fileUpLoad.PostedFile.SaveAs(Server.MapPath("~/Images/") + file);
                    flag = true;
                }
                else
                {
                    MessageBox.Show(this, "你的图片格式错误");
                    return;
                }

            }

            int ID = int.Parse(this.lblID.Text);
            string TeacherName = this.txtTeacherName.Text;
            string TeacherTel = this.txtTeacherTel.Text;
            string TeacherEmail = this.txtTeacherEmail.Text;
            string TeacherAddress = this.txtTeacherAddress.Text;
            string TeacherDescribe = this.txtTeacherDescribe.Text;
            int RoleId = int.Parse(DropDownList1.SelectedValue);
            DateTime CreateTime = DateTime.Now;
            DateTime UpdateTime = DateTime.Now;

            JiaJiao.Model.Teacher model = new JiaJiao.Model.Teacher();
            model.ID = ID;
            model.TeacherName = TeacherName;
            model.TeacherTel = TeacherTel;
            model.TeacherEmail = TeacherEmail;
            model.TeacherAddress = TeacherAddress;
            model.TeacherDescribe = TeacherDescribe;
            model.RoleId = RoleId;
            model.CreateTime = CreateTime;
            model.UpdateTime = UpdateTime;
            JiaJiao.BLL.Teacher bll = new JiaJiao.BLL.Teacher();
            if (flag)
            {
                model.Image = "~/Images/" + file;
            }
            else
            {

                JiaJiao.Model.Teacher model1 = bll.GetModel(ID);
                model.Image = model1.Image;
               int id= int.Parse(Request.Params["id"]);
            }

            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #6
0
 private void ShowInfo(int ID)
 {
     JiaJiao.BLL.Teacher bll = new JiaJiao.BLL.Teacher();
     JiaJiao.Model.Teacher model = bll.GetModel(ID);
     this.lblID.Text = model.ID.ToString();
     this.txtTeacherName.Text = model.TeacherName;
     this.txtTeacherTel.Text = model.TeacherTel;
     this.txtTeacherEmail.Text = model.TeacherEmail;
     this.txtTeacherAddress.Text = model.TeacherAddress;
     this.txtTeacherDescribe.Text = model.TeacherDescribe;
 }