コード例 #1
0
    protected void CreateInstructorDialog_OkButtonClicked(object sender, EventArgs e)
    {
        BiographyCustomValidator.Validate();
        if (Page.IsValid)
        {
            InstructorInfo entity = new InstructorInfo();
            entity.Biography = hdnMain.Value;
            entity.CreatedOn = DateTime.Now;
            entity.Email = EmailTextBox.Text;
            entity.LastUpdatedOn = DateTime.Now;
            entity.Name = NameTextBox.Text;
            entity.Photo = "";
            entity.RssUrl = RssUrlTextBox.Text;

            int InstructorID = InstructorInfo.Insert(entity);

            if (InstructorID > 0)
            {
                CreateInstructorDialog.Reset();
                OnInstructorCreated(EventArgs.Empty);
            }
        }
        else
        {
            ValidationHelper.SetFocusToFirstError(this.Page, "create_instructor");
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /* Registering click event for update button for editor */
        UpdateButton.Click += new EventHandler(UpdateButton_Click);
        PhotoUpdatePanel.DataBinding += new EventHandler(PhotoUpdatePanel_DataBinding);


        if (this.Id < 1)
        {
            Response.Redirect("Default.aspx");
        }
        _entity = InstructorInfo.Load(this.Id);
        if (_entity != null)
            if (!IsPostBack)
            {
                DataBind();
                CancelButton.RedirectUrl = "Instructors.aspx";

                if (SelectedInstructor != null)
                {
                    if (SelectedInstructor.Name != "")
                        this.Page.Title = SelectedInstructor.Name;

                }
            }
    }
コード例 #3
0
ファイル: InstructorInfo.cs プロジェクト: IdeaFortune/Monaco
        public static int Insert(InstructorInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.mon_elrn_INSERT_INSTRUCTOR");

            //cmd.Parameters.Add(SqlHelpers.CreateOutputParam("@Id", DbType.Int32, 4));
            cmd.AddInputParam("@Name", DbType.AnsiString, entity.Name);
            cmd.AddInputParam("@RssUrl", DbType.AnsiString, entity.RssUrl);
            cmd.AddInputParam("@Biography", DbType.AnsiString, entity.Biography);
            cmd.AddInputParam("@Email", DbType.AnsiString, entity.Email);
            cmd.AddInputParam("@Photo", DbType.AnsiString, entity.Photo);
            cmd.AddInputParam("@CreatedOn", DbType.DateTime, entity.CreatedOn);
            cmd.AddInputParam("@LastUpdatedOn", DbType.DateTime, entity.LastUpdatedOn);
            cmd.AddInputParam("@ApplicationName", DbType.String, System.Web.Security.Membership.Provider.ApplicationName);

            return Convert.ToInt32(SqlHelpers.ExecuteScalar(cmd));

        }
コード例 #4
0
ファイル: InstructorInfo.cs プロジェクト: IdeaFortune/Monaco
        public static bool Update(InstructorInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.mon_elrn_UPDATE_INSTRUCTOR");

            cmd.AddInputParam("@InstructorId", DbType.Int32, entity.InstructorID);
            cmd.AddInputParam("@Name", DbType.AnsiString, entity.Name);
            cmd.AddInputParam("@RssUrl", DbType.AnsiString, entity.RssUrl);
            cmd.AddInputParam("@Biography", DbType.AnsiString, entity.Biography);
            cmd.AddInputParam("@Email", DbType.AnsiString, entity.Email);
            cmd.AddInputParam("@Photo", DbType.AnsiString, entity.Photo);
            //cmd.AddInputParam("@CreatedOn", DbType.DateTime, entity.CreatedOn);
            cmd.AddInputParam("@LastUpdatedOn", DbType.DateTime, entity.LastUpdatedOn);

            return Convert.ToBoolean(SqlHelpers.ExecuteNonQuery(cmd));

        }
コード例 #5
0
 protected void DeleteInstructorButton_Click(object sender, EventArgs e)
 {
     InstructorInfo.DeleteInstructor(this.Id);
     ClearImage(null, null);
     Response.Redirect("Instructors.aspx");
     _entity = null;
 }
コード例 #6
0
ファイル: instructor.aspx.cs プロジェクト: IdeaFortune/Monaco
    protected void BindPageData()
    {

        //Bind Instructor Information.
        InstructorInfo instructorInfo;
        if (this.Id > 0)
            instructorInfo = InstructorInfo.Load(this.Id);
        else
            instructorInfo = new InstructorInfo();

        strEmail = "mailto:" + instructorInfo.Email;
        ltrInstructorName1.Text = ltrInstructorName2.Text = instructorInfo.Name;
        ltrInstructorBiography.Text = HttpUtility.HtmlDecode(instructorInfo.Biography);


        if (WebImage.ExistsInCustomStorage("instructor_image", this.Id.ToString()))
        {
            try
            {
                InstructorImage.ImageUrl = WebImage.LoadFromCustomStorage("instructor_image", this.Id.ToString()).Resizes["_InstructorPageImage"].FileUrl;
            }
            catch (Exception ex)
            {
                InstructorImage.ImageUrl = "~/Images/noimage_instructor.gif";
            }
        }
        else
        {
            InstructorImage.ImageUrl = "~/Images/noimage_instructor.gif";
        }


        // Load course for instructor.
        courseInfo = CourseInfo.LoadCoursesByInstructor(this.Id);
        rptCourses.DataSource = courseInfo;
        rptCourses.DataBind();


        base.DataBind();
    }