コード例 #1
0
        public string GetTitle(string UserID)
        {
            BLL.CCOM.Tutor bll = new BLL.CCOM.Tutor();
            string         str = string.Empty;

            try
            {
                Model.CCOM.Tutor model = bll.GetModel(" User_id='" + UserID + "'");
                str = new BLL.CCOM.Title().GetModel((int)model.Title_id).Title_name;
            }
            catch
            {
                str = "未设置";
            }
            return(str);
        }
コード例 #2
0
        private bool UpdateTeacherInfo()
        {
            BLL.CCOM.User_information   user_bll   = new BLL.CCOM.User_information();
            Model.CCOM.User_information user_model = user_bll.GetModel(UserID);
            bool result = false;

            if (this.ddlGender.SelectedValue == "0")
            {
                user_model.User_gender = false;
            }
            else
            {
                user_model.User_gender = true;
            }

            if (this.txtPhone.Value != "")
            {
                user_model.User_phone = this.txtPhone.Value;
            }

            try
            {
                bool res = user_bll.Update(user_model);
                if (res == true)
                {
                    result = true;
                }
            }
            catch
            {
                result = false;
            }

            BLL.CCOM.Tutor   teacher_bll   = new BLL.CCOM.Tutor();
            Model.CCOM.Tutor teacher_model = teacher_bll.GetModel(" User_id=" + UserID);

            if (teacher_model != null)
            {
                if (this.ddlTitle.SelectedValue != "0")
                {
                    teacher_model.Title_id = int.Parse(this.ddlTitle.SelectedValue);
                }
                if (this.txtSubject.Value != "")
                {
                    teacher_model.Subject = this.txtSubject.Value;
                }
                if (this.txtEmail.Value != "")
                {
                    teacher_model.Tutor_email = this.txtEmail.Value;
                }
                if (this.txtFixedPhone.Value != "")
                {
                    teacher_model.Tutor_fixedphone = this.txtFixedPhone.Value;
                }
                if (this.txtPlace.Value != "")
                {
                    teacher_model.Tutor_location = this.txtPlace.Value;
                }
                if (this.txtIntroduce.Value != "")
                {
                    teacher_model.Tutor_introduce = this.txtIntroduce.Value;
                }
                if (teacher_bll.Update(teacher_model))
                {
                    result = true;
                }
            }
            else
            {
                teacher_model         = new Model.CCOM.Tutor();
                teacher_model.User_id = UserID;
                if (this.ddlTitle.SelectedValue != "0")
                {
                    teacher_model.Title_id = int.Parse(this.ddlTitle.SelectedValue);
                }
                if (this.txtSubject.Value != "")
                {
                    teacher_model.Subject = this.txtSubject.Value;
                }
                if (this.txtEmail.Value != "")
                {
                    teacher_model.Tutor_email = this.txtEmail.Value;
                }
                if (this.txtFixedPhone.Value != "")
                {
                    teacher_model.Tutor_fixedphone = this.txtFixedPhone.Value;
                }
                if (this.txtPlace.Value != "")
                {
                    teacher_model.Tutor_location = this.txtPlace.Value;
                }
                if (this.txtIntroduce.Value != "")
                {
                    teacher_model.Tutor_introduce = this.txtIntroduce.Value;
                }
                if (teacher_bll.Add(teacher_model) != 0)
                {
                    result = true;
                }
            }

            return(result);
        }