示例#1
0
    protected void CreateWorkbook_OkButtonClicked(object sender, EventArgs e)
    {
        Page.Validate("create_workbook");
        if (Page.IsValid)
        {
            if (this.ClassId > 0)
            {
                WorkbookInfo entity = new WorkbookInfo();
                entity.ClassID = this.ClassId;
                entity.Title = TitleTextBox.Text;
                entity.Body = BodyTextBox.Value;
                entity.Visible = VisibleCheckBox.Checked;
                entity.CreatedTimestamp = DateTime.Now;
                entity.UpdatedTimestamp = DateTime.Now;

                bool result = ClassroomController.InsertWorkbook(ref entity);

                if (result)
                {
                    DataBind();
                    OnWorkbookCreated(EventArgs.Empty);
                    entity = null;
                    Response.Redirect("Workbooks.aspx?ClassId=" + this.ClassId);
                }
            }
        }
        else
        {
            ValidationHelper.SetFocusToFirstError(this.Page, "create_workbook");
        }
    }
示例#2
0
    protected void UpdateWorkbook_OkButtonClicked(object sender, EventArgs e)
    {
        Page.Validate("update_workbook");
        if (Page.IsValid)
        {
            if (this.Id > 0)
            {
                WorkbookInfo entity = new WorkbookInfo();
                entity.Id = this.Id;
                entity.ClassID = Convert.ToInt32(ViewState["ClassId"]);
                entity.Title = TitleTextBox.Text;
                entity.Body = BodyTextBox.Value;
                entity.CreatedTimestamp = Convert.ToDateTime(ViewState["CreatedTime"]);
                entity.UpdatedTimestamp = DateTime.Now;
                entity.Visible = VisibleCheckBox.Checked;

                bool result = ClassroomController.UpdateWorkbook(entity);

                if (result)
                {
                    this.BindDialog();
                    DataBind();
                    OnWorkbookUpdated(EventArgs.Empty);
                    entity = null;
                    //ViewState["ClassId"] = null;
                    Response.Redirect("WorkbookDetail.aspx?Id=" + this.Id);
                }
            }
        }
        else
        {
            ValidationHelper.SetFocusToFirstError(this.Page, "update_workbook");
        }
    }
        public override bool InsertWorkbook(ref WorkbookInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString);
            cmd.CommandText = "dbo.mon_elrn_INSERT_WORKBOOK";

            cmd.AddInputParam("@ClassID", DbType.Int32, entity.ClassID);
            cmd.AddInputParam("@Title", DbType.AnsiString, entity.Title);
            cmd.AddInputParam("@Body", DbType.AnsiString, entity.Body);
            cmd.AddInputParam("@Visible", DbType.Boolean, entity.Visible);
            cmd.AddInputParam("@CreatedTimestamp", DbType.DateTime, entity.CreatedTimestamp);
            cmd.AddInputParam("@UpdatedTimestamp", DbType.DateTime, entity.UpdatedTimestamp);

            int results = 0;
            try
            {
                results = Convert.ToInt32(SqlHelpers.ExecuteScalar(cmd));
                if (results > 0)
                {
                    entity.Id = results;
                    return true;
                }
                else
                    return false;
            }
            catch
            {
                return false;
            }


        }
示例#4
0
    private void BindDialog()
    {
        _entity = ClassroomController.GetWorkbook(this.Id);
        ViewState["ClassId"] = _entity.ClassID;
        ViewState["CreatedTime"] = _entity.CreatedTimestamp;
        BodyTextBox.Value = _entity.Body;
        TitleTextBox.Text = _entity.Title;
        VisibleCheckBox.Checked = _entity.Visible;

    }
        public override WorkbookInfo GetWorkbook(System.Int32 id)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString);
            cmd.CommandText = "dbo.mon_elrn_GET_WORKBOOK";

            cmd.AddInputParam("@Id", DbType.Int32, id);

            DataTable table = null;
            WorkbookInfo entity = null;

            try
            {
                table = cmd.ExecuteSelectTable();
                if (table.Rows.Count > 0)
                    entity = new WorkbookInfo(table.Rows[0]);
            }
            finally
            {

            }
            return entity;
        }
        //error here
        //public override bool InsertEnrollmentDetails(ref Monaco.ELearning.UserEnrollment objUserEnrollment)
        //{

        //    DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString);
        //    cmd.CommandText = "meo_elrn_INSERT_ENROLLMENT";
        //    cmd.AddInputParam("@UserID",DbType.AnsiString,"TestingId");
        //    cmd.AddInputParam("@SKU", DbType.AnsiString, objUserEnrollment.SKU);
        //    cmd.AddInputParam("@TrialPeriod", DbType.Int32, objUserEnrollment.TrailPeriod);
        //    cmd.AddInputParam("@InitialPrice", DbType.Int32, objUserEnrollment.IntialPrize);
        //    cmd.AddInputParam("@RecurringPrice", DbType.Int32, objUserEnrollment.RecurringPrice);
        //    cmd.AddInputParam("@SubsDur", DbType.Int32, objUserEnrollment.SubsDuration);
        //    cmd.AddInputParam("@AvailDur", DbType.Int32, objUserEnrollment.AvailableDuration);
        //    cmd.AddInputParam("@EnrollmentDate", DbType.DateTime,DateTime.Now);
        //    cmd.AddInputParam("@LockedOut", DbType.Int32,objUserEnrollment.LockedOut);
        //    cmd.AddInputParam("@LockedOutReason", DbType.AnsiString, objUserEnrollment.LockedOutReason);
        //    cmd.AddInputParam("@CreatedOn", DbType.DateTime,DateTime.Now);
        //    cmd.AddInputParam("@LastUpdatedOn", DbType.DateTime,DateTime.Now);
        //    cmd.AddInputParam("@LastUpdatedBy", DbType.AnsiString,"TestingId");
        //    cmd.AddInputParam("@CourseID", DbType.Int32,1);

        //    int results = 0;

        //    try
        //    {
        //        results = SqlHelpers.ExecuteNonQuery(cmd);

        //        if (results > 0)
        //        {
        //            return true;
        //        }
        //        else
        //            return false;
        //    }
        //    catch (Exception exc)
        //    {
        //        return false;
        //    }
        //}

        public override bool UpdateWorkbook(WorkbookInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString);
            cmd.CommandText = "dbo.mon_elrn_UPDATE_WORKBOOK";

            cmd.AddInputParam("@Id", DbType.Int32, entity.Id);
            cmd.AddInputParam("@ClassID", DbType.Int32, entity.ClassID);
            cmd.AddInputParam("@Title", DbType.AnsiString, entity.Title);
            cmd.AddInputParam("@Body", DbType.AnsiString, entity.Body);
            cmd.AddInputParam("@Visible", DbType.Boolean, entity.Visible);
            cmd.AddInputParam("@CreatedTimestamp", DbType.DateTime, entity.CreatedTimestamp);
            cmd.AddInputParam("@UpdatedTimestamp", DbType.DateTime, DateTime.UtcNow);

            int results = 0;
            results = SqlHelpers.ExecuteNonQuery(cmd);

            return Convert.ToBoolean(results);
        }
示例#7
0
 public abstract bool UpdateWorkbook(WorkbookInfo entity);
示例#8
0
 public abstract bool InsertWorkbook(ref WorkbookInfo entity);
    protected void BindPage()
    {
        _entity = ClassroomController.GetWorkbook(this.WorkbookId);
        if (_entity != null)
        {
            litTitle.Text = _entity.Title;
            litBody.Text = Server.HtmlDecode(_entity.Body);
        }

    }
示例#10
0
 public static bool UpdateWorkbook(WorkbookInfo entity) { return Instance.UpdateWorkbook(entity); }
示例#11
0
        // Workbook related functions

        public static bool InsertWorkbook(ref WorkbookInfo entity) { return Instance.InsertWorkbook(ref entity); }
示例#12
0
 protected void ChangeTitleDialog_OkButtonClick(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         if (this.Id > 0)
         {
             _entity = ClassroomController.GetWorkbook(this.Id);
             _entity.Title = TitleTextBox.Text;
             _entity.UpdatedTimestamp = DateTime.Now;
             UpdateWorkbookEntity();
             TitleUpdatePanel.Update();
         }
     }
     else
     {
         ValidationHelper.SetFocusToFirstError(this.Page, "update_video");
     }
 }
示例#13
0
 protected void DeleteWorkbookButton_Click(object sender, EventArgs e)
 {
     ClassroomController.DeleteWorkbook(this.Id);
     Response.Redirect("Workbooks.aspx?ClassId=" + Convert.ToInt32(ViewState["ClassId"]));
     _entity = null;
 }
示例#14
0
 private void BindDialog()
 {
     _entity = ClassroomController.GetWorkbook(this.Id);
     ViewState["ClassId"] = _entity.ClassID;
 }