Exemple #1
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text           = GetLabelText("BestPractice_Title");
                litBestPracticeName.Text    = GetLabelText("Bestpractice_BestPracticeName");
                txtBestPracticeName.ToolTip = GetLabelText("Bestpractice_BestPracticeName");
                litShortDescription.Text    = GetLabelText("Bestpractice_ShortDescription");
                txtShortDescription.ToolTip = GetLabelText("Bestpractice_ShortDescription");
                litContent.Text             = GetLabelText("Bestpractice_Description");
                litHits.Text          = GetLabelText("Bestpractice_Hits");
                txtHits.ToolTip       = GetLabelText("Bestpractice_Hits");
                litIsDisplay.Text     = GetLabelText("Bestpractice_IsDisplay");
                rdbDisplay0.Text      = GetLabelText("Common_Yes");
                rdbDisplay1.Text      = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Bestpractice_IsDisplay");
                litCreatedTime.Text   = GetLabelText("Common_CreatedTime");
                litCreatedByName.Text = GetLabelText("Common_CreatedByName");
                litUpdatedTime.Text   = GetLabelText("Common_UpdatedTime");
                litUpdatedByName.Text = GetLabelText("Common_UpdatedByName");

                if (Request.QueryString["action"] == "modify")
                {
                    //get id
                    int BestPracticeId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.SeH.BestPractice bll   = new Johnny.CMS.BLL.SeH.BestPractice();
                    Johnny.CMS.OM.SeH.BestPractice  model = new Johnny.CMS.OM.SeH.BestPractice();
                    model = bll.GetModel(BestPracticeId);


                    txtBestPracticeName.Text = model.BestPracticeName;
                    txtShortDescription.Text = model.ShortDescription;
                    fckContent.Value         = model.Description;
                    txtHits.Text             = DataConvert.GetString(model.Hits);
                    if (model.IsDisplay)
                    {
                        rdbDisplay0.Checked = true;
                    }
                    else
                    {
                        rdbDisplay1.Checked = true;
                    }

                    lblCreatedTime.Text   = DataConvert.GetLongDateString(model.CreatedTime);
                    lblCreatedByName.Text = model.CreatedByName;
                    lblUpdatedTime.Text   = DataConvert.GetLongDateString(model.UpdatedTime);
                    lblUpdatedByName.Text = model.UpdatedByName;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                }
                else
                {
                    rdbDisplay0.Checked = true;
                    txtHits.Text        = "0";
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Method to get one recoder by primary key
        /// </summary>
        public Johnny.CMS.OM.SeH.BestPractice GetModel(int bestpracticeid)
        {
            //Set up a return value
            Johnny.CMS.OM.SeH.BestPractice model = null;

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [BestPracticeId], [BestPracticeName], [ShortDescription], [Description], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bestpractice] ");
            strSql.Append(" WHERE [BestPracticeId]=@bestpracticeid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bestpracticeid", SqlDbType.Int, 4)
            };
            parameters[0].Value = bestpracticeid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                {
                    model = new Johnny.CMS.OM.SeH.BestPractice(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetInt32(4), sdr.GetBoolean(5), sdr.GetDateTime(6), sdr.GetInt32(7), sdr.GetString(8), sdr.GetDateTime(9), sdr.GetInt32(10), sdr.GetString(11), sdr.GetInt32(12));
                }
                else
                {
                    model = new Johnny.CMS.OM.SeH.BestPractice();
                }
            }
            return(model);
        }
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtBestPracticeName, "E00901", "E00902", false))
                return;
            if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false))
                return;

            Johnny.CMS.BLL.SeH.BestPractice bll = new Johnny.CMS.BLL.SeH.BestPractice();
            Johnny.CMS.OM.SeH.BestPractice model = new Johnny.CMS.OM.SeH.BestPractice();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.BestPracticeId = Convert.ToInt32(Request.QueryString["id"]);
                model.BestPracticeName = txtBestPracticeName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description = fckContent.Value;
                model.Hits = DataConvert.GetInt32(txtHits.Text);               
                model.IsDisplay = rdbDisplay0.Checked;
                model.UpdatedTime = System.DateTime.Now;
                model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.BestPracticeName = txtBestPracticeName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description = StringHelper.htmlInputText(fckContent.Value);
                model.Hits = DataConvert.GetInt32(txtHits.Text);
                model.IsDisplay = rdbDisplay0.Checked;
                model.CreatedTime = System.DateTime.Now;
                model.CreatedById = DataConvert.GetInt32(Session["UserId"]);
                model.CreatedByName = DataConvert.GetString(Session["UserName"]);
                model.UpdatedTime = System.DateTime.Now;
                model.UpdatedById = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName = DataConvert.GetString(Session["UserName"]);

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtBestPracticeName.Text = "";
                    txtShortDescription.Text = "";
                    fckContent.Value = "";
                    txtHits.Text = "0";
                    rdbDisplay0.Checked = true;
                    lblCreatedTime.Text = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text = "";
                    lblUpdatedByName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }        
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("BestPractice_Title");
                litBestPracticeName.Text = GetLabelText("Bestpractice_BestPracticeName");
                txtBestPracticeName.ToolTip = GetLabelText("Bestpractice_BestPracticeName");
                litShortDescription.Text = GetLabelText("Bestpractice_ShortDescription");
                txtShortDescription.ToolTip = GetLabelText("Bestpractice_ShortDescription");
                litContent.Text = GetLabelText("Bestpractice_Description");
                litHits.Text = GetLabelText("Bestpractice_Hits");
                txtHits.ToolTip = GetLabelText("Bestpractice_Hits");
                litIsDisplay.Text = GetLabelText("Bestpractice_IsDisplay");
                rdbDisplay0.Text = GetLabelText("Common_Yes");
                rdbDisplay1.Text = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Bestpractice_IsDisplay");
                litCreatedTime.Text = GetLabelText("Common_CreatedTime");
                litCreatedByName.Text = GetLabelText("Common_CreatedByName");
                litUpdatedTime.Text = GetLabelText("Common_UpdatedTime");
                litUpdatedByName.Text = GetLabelText("Common_UpdatedByName");

                if (Request.QueryString["action"] == "modify")
                {
                    //get id
                    int BestPracticeId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.SeH.BestPractice bll = new Johnny.CMS.BLL.SeH.BestPractice();
                    Johnny.CMS.OM.SeH.BestPractice model = new Johnny.CMS.OM.SeH.BestPractice();
                    model = bll.GetModel(BestPracticeId);


                    txtBestPracticeName.Text = model.BestPracticeName;
                    txtShortDescription.Text = model.ShortDescription;
                    fckContent.Value = model.Description;
                    txtHits.Text = DataConvert.GetString(model.Hits);
                    if (model.IsDisplay)
                        rdbDisplay0.Checked = true;
                    else
                        rdbDisplay1.Checked = true;
                    
                    lblCreatedTime.Text = DataConvert.GetLongDateString(model.CreatedTime);
                    lblCreatedByName.Text = model.CreatedByName;
                    lblUpdatedTime.Text = DataConvert.GetLongDateString(model.UpdatedTime);
                    lblUpdatedByName.Text = model.UpdatedByName;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                }
                else
                {
                    rdbDisplay0.Checked = true;
                    txtHits.Text = "0";
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Add one record
        /// </summary>
        public int Add(Johnny.CMS.OM.SeH.BestPractice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("DECLARE @Sequence int");
            strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_bestpractice]");
            strSql.Append(" if @Sequence is NULL");
            strSql.Append(" Set @Sequence=1");
            strSql.Append("INSERT INTO [seh_bestpractice](");
            strSql.Append("[BestPracticeName],[ShortDescription],[Description],[Hits],[IsDisplay],[CreatedTime],[CreatedById],[CreatedByName],[UpdatedTime],[UpdatedById],[UpdatedByName],[Sequence]");
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append("@bestpracticename,@shortdescription,@description,@hits,@isdisplay,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence");
            strSql.Append(")");
            strSql.Append(";SELECT @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bestpracticename", SqlDbType.NVarChar,   50),
                new SqlParameter("@shortdescription", SqlDbType.NVarChar,  200),
                new SqlParameter("@description",      SqlDbType.Text),
                new SqlParameter("@hits",             SqlDbType.Int,         4),
                new SqlParameter("@isdisplay",        SqlDbType.Bit),
                new SqlParameter("@createdtime",      SqlDbType.DateTime),
                new SqlParameter("@createdbyid",      SqlDbType.Int,         4),
                new SqlParameter("@createdbyname",    SqlDbType.VarChar,    50),
                new SqlParameter("@updatedtime",      SqlDbType.DateTime),
                new SqlParameter("@updatedbyid",      SqlDbType.Int,         4),
                new SqlParameter("@updatedbyname",    SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.BestPracticeName;
            parameters[1].Value  = model.ShortDescription;
            parameters[2].Value  = model.Description;
            parameters[3].Value  = model.Hits;
            parameters[4].Value  = model.IsDisplay;
            parameters[5].Value  = model.CreatedTime;
            parameters[6].Value  = model.CreatedById;
            parameters[7].Value  = model.CreatedByName;
            parameters[8].Value  = model.UpdatedTime;
            parameters[9].Value  = model.UpdatedById;
            parameters[10].Value = model.UpdatedByName;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #6
0
        /// <summary>
        /// Update one record
        /// </summary>
        public void Update(Johnny.CMS.OM.SeH.BestPractice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE [seh_bestpractice] SET ");
            strSql.Append("[BestPracticeName]=@bestpracticename,");
            strSql.Append("[ShortDescription]=@shortdescription,");
            strSql.Append("[Description]=@description,");
            strSql.Append("[Hits]=@hits,");
            strSql.Append("[IsDisplay]=@isdisplay,");
            //strSql.Append("[CreateTime]=@createtime,");
            //strSql.Append("[CreatorId]=@creatorid,");
            //strSql.Append("[CreatorName]=@creatorname,");
            strSql.Append("[UpdatedTime]=@updatedtime,");
            strSql.Append("[UpdatedById]=@updatedbyid,");
            strSql.Append("[UpdatedByName]=@updatedbyname,");
            strSql.Append("[Sequence]=@sequence");
            strSql.Append(" WHERE [BestPracticeId]=@bestpracticeid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bestpracticeid",   SqlDbType.Int,         4),
                new SqlParameter("@bestpracticename", SqlDbType.NVarChar,   50),
                new SqlParameter("@shortdescription", SqlDbType.NVarChar,  200),
                new SqlParameter("@description",      SqlDbType.Text),
                new SqlParameter("@hits",             SqlDbType.Int,         4),
                new SqlParameter("@isdisplay",        SqlDbType.Bit),
                //new SqlParameter("@createtime", SqlDbType.DateTime),
                //new SqlParameter("@creatorid", SqlDbType.Int,4),
                //new SqlParameter("@creatorname", SqlDbType.VarChar,50),
                new SqlParameter("@updatedtime",      SqlDbType.DateTime),
                new SqlParameter("@updatedbyid",      SqlDbType.Int,         4),
                new SqlParameter("@updatedbyname",    SqlDbType.VarChar,    50),
            };
            parameters[0].Value = model.BestPracticeId;
            parameters[1].Value = model.BestPracticeName;
            parameters[2].Value = model.ShortDescription;
            parameters[3].Value = model.Description;
            parameters[4].Value = model.Hits;
            parameters[5].Value = model.IsDisplay;
            //parameters[6].Value = model.CreateTime;
            //parameters[7].Value = model.CreatorId;
            //parameters[8].Value = model.CreatorName;
            parameters[6].Value = model.UpdatedTime;
            parameters[7].Value = model.UpdatedById;
            parameters[8].Value = model.UpdatedByName;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemple #7
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            Johnny.CMS.OM.SeH.BestPractice model = new Johnny.CMS.OM.SeH.BestPractice();
            base.ManageTable = model.TableName;
            base.ManageKey   = model.PrimaryKey;
            base.IsDesc      = model.IsDesc;

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Bestpractice_BestPracticeName");
                myManageGridView.Columns[3].HeaderText = GetLabelText("Bestpractice_ShortDescription");
                getData();
            }
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            Johnny.CMS.OM.SeH.BestPractice model = new Johnny.CMS.OM.SeH.BestPractice();
            base.ManageTable = model.TableName;
            base.ManageKey = model.PrimaryKey;
            base.IsDesc = model.IsDesc;

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Bestpractice_BestPracticeName");
                myManageGridView.Columns[3].HeaderText = GetLabelText("Bestpractice_ShortDescription");
                getData();                
            }
        }
Exemple #9
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>    	 
        public IList<Johnny.CMS.OM.SeH.BestPractice> GetList()
        {
            IList<Johnny.CMS.OM.SeH.BestPractice> list = new List<Johnny.CMS.OM.SeH.BestPractice>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [BestPracticeId], [BestPracticeName], [ShortDescription], [Description], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bestpractice] ");
            strSql.Append(" ORDER BY [Sequence]");

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    Johnny.CMS.OM.SeH.BestPractice item = new Johnny.CMS.OM.SeH.BestPractice(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetInt32(4), sdr.GetBoolean(5), sdr.GetDateTime(6), sdr.GetInt32(7), sdr.GetString(8), sdr.GetDateTime(9), sdr.GetInt32(10), sdr.GetString(11), sdr.GetInt32(12));
                    list.Add(item);
                }
            }
            return list;
        }
Exemple #10
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>
        public IList <Johnny.CMS.OM.SeH.BestPractice> GetList()
        {
            IList <Johnny.CMS.OM.SeH.BestPractice> list = new List <Johnny.CMS.OM.SeH.BestPractice>();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [BestPracticeId], [BestPracticeName], [ShortDescription], [Description], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bestpractice] ");
            strSql.Append(" ORDER BY [Sequence]");

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    Johnny.CMS.OM.SeH.BestPractice item = new Johnny.CMS.OM.SeH.BestPractice(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetInt32(4), sdr.GetBoolean(5), sdr.GetDateTime(6), sdr.GetInt32(7), sdr.GetString(8), sdr.GetDateTime(9), sdr.GetInt32(10), sdr.GetString(11), sdr.GetInt32(12));
                    list.Add(item);
                }
            }
            return(list);
        }
Exemple #11
0
        /// <summary>
        /// Method to get one recoder by primary key
        /// </summary>    	 
        public Johnny.CMS.OM.SeH.BestPractice GetModel(int bestpracticeid)
        {
            //Set up a return value
            Johnny.CMS.OM.SeH.BestPractice model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [BestPracticeId], [BestPracticeName], [ShortDescription], [Description], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bestpractice] ");
            strSql.Append(" WHERE [BestPracticeId]=@bestpracticeid");
            SqlParameter[] parameters = {
					new SqlParameter("@bestpracticeid", SqlDbType.Int,4)};
            parameters[0].Value = bestpracticeid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                    model = new Johnny.CMS.OM.SeH.BestPractice(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetInt32(4), sdr.GetBoolean(5), sdr.GetDateTime(6), sdr.GetInt32(7), sdr.GetString(8), sdr.GetDateTime(9), sdr.GetInt32(10), sdr.GetString(11), sdr.GetInt32(12));
                else
                    model = new Johnny.CMS.OM.SeH.BestPractice();
            }
            return model;
        }
Exemple #12
0
 /// <summary>
 /// Update one record
 /// </summary>
 public void Update(Johnny.CMS.OM.SeH.BestPractice model)
 {
     dal.Update(model);
 }
Exemple #13
0
 /// <summary>
 /// Add one record
 /// </summary>
 public int Add(Johnny.CMS.OM.SeH.BestPractice model)
 {
     return(dal.Add(model));
 }
Exemple #14
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtBestPracticeName, "E00901", "E00902", false))
            {
                return;
            }
            if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false))
            {
                return;
            }

            Johnny.CMS.BLL.SeH.BestPractice bll   = new Johnny.CMS.BLL.SeH.BestPractice();
            Johnny.CMS.OM.SeH.BestPractice  model = new Johnny.CMS.OM.SeH.BestPractice();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.BestPracticeId   = Convert.ToInt32(Request.QueryString["id"]);
                model.BestPracticeName = txtBestPracticeName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description      = fckContent.Value;
                model.Hits             = DataConvert.GetInt32(txtHits.Text);
                model.IsDisplay        = rdbDisplay0.Checked;
                model.UpdatedTime      = System.DateTime.Now;
                model.UpdatedById      = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName    = DataConvert.GetString(Session["UserName"]);

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.BestPracticeName = txtBestPracticeName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description      = StringHelper.htmlInputText(fckContent.Value);
                model.Hits             = DataConvert.GetInt32(txtHits.Text);
                model.IsDisplay        = rdbDisplay0.Checked;
                model.CreatedTime      = System.DateTime.Now;
                model.CreatedById      = DataConvert.GetInt32(Session["UserId"]);
                model.CreatedByName    = DataConvert.GetString(Session["UserName"]);
                model.UpdatedTime      = System.DateTime.Now;
                model.UpdatedById      = DataConvert.GetInt32(Session["UserId"]);
                model.UpdatedByName    = DataConvert.GetString(Session["UserName"]);

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtBestPracticeName.Text = "";
                    txtShortDescription.Text = "";
                    fckContent.Value         = "";
                    txtHits.Text             = "0";
                    rdbDisplay0.Checked      = true;
                    lblCreatedTime.Text      = "";
                    lblCreatedByName.Text    = "";
                    lblUpdatedTime.Text      = "";
                    lblUpdatedByName.Text    = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }