Example #1
0
        /// <summary>
        /// Method to get one recoder by primary key
        /// </summary>
        public Johnny.CMS.OM.SeH.Bulletin GetModel(int bulletinid)
        {
            //Set up a return value
            Johnny.CMS.OM.SeH.Bulletin model = null;

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [BulletinId], [Title], [Content], [URL], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bulletin] ");
            strSql.Append(" WHERE [BulletinId]=@bulletinid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bulletinid", SqlDbType.Int, 4)
            };
            parameters[0].Value = bulletinid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                {
                    model = new Johnny.CMS.OM.SeH.Bulletin(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.Bulletin();
                }
            }
            return(model);
        }
Example #2
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text     = GetLabelText("Bulletin_Title");
                litTitle.Text         = GetLabelText("Bulletin_Title");
                txtTitle.ToolTip      = GetLabelText("Bulletin_Title");
                litContent.Text       = GetLabelText("Bulletin_Content");
                litURL.Text           = GetLabelText("Bulletin_URL");
                txtURL.ToolTip        = GetLabelText("Bulletin_URL");
                litHits.Text          = GetLabelText("Bulletin_Hits");
                txtHits.ToolTip       = GetLabelText("Bulletin_Hits");
                litIsDisplay.Text     = GetLabelText("Bulletin_IsDisplay");
                rdbDisplay0.Text      = GetLabelText("Common_Yes");
                rdbDisplay1.Text      = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Bulletin_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 BulletinId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.SeH.Bulletin bll   = new Johnny.CMS.BLL.SeH.Bulletin();
                    Johnny.CMS.OM.SeH.Bulletin  model = new Johnny.CMS.OM.SeH.Bulletin();
                    model = bll.GetModel(BulletinId);

                    txtTitle.Text    = model.Title;
                    fckContent.Value = StringHelper.htmlOutputText(model.Content);
                    txtURL.Text      = model.URL;
                    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;
                    //btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }
                else
                {
                    rdbDisplay0.Checked = true;
                    txtHits.Text        = "0";
                }
            }
        }
Example #3
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtTitle, "E00901", "E00902", false))
                return;
            if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false))
                return;

            Johnny.CMS.BLL.SeH.Bulletin bll = new Johnny.CMS.BLL.SeH.Bulletin();
            Johnny.CMS.OM.SeH.Bulletin model = new Johnny.CMS.OM.SeH.Bulletin();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.BulletinId = Convert.ToInt32(Request.QueryString["id"]);
                model.Title = txtTitle.Text;
                model.Content = StringHelper.htmlInputText(fckContent.Value);
                model.URL = txtURL.Text;
                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.Title = txtTitle.Text;
                model.Content = StringHelper.htmlInputText(fckContent.Value);
                model.URL = txtURL.Text;
                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"));
                    txtTitle.Text = "";
                    fckContent.Value = "";
                    txtURL.Text = "";
                    txtHits.Text = "";
                    rdbDisplay0.Checked = true;
                    lblCreatedTime.Text = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text = "";
                    lblUpdatedByName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }       
Example #4
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("Bulletin_Title");
                litTitle.Text = GetLabelText("Bulletin_Title");
                txtTitle.ToolTip = GetLabelText("Bulletin_Title");
                litContent.Text = GetLabelText("Bulletin_Content");
                litURL.Text = GetLabelText("Bulletin_URL");
                txtURL.ToolTip = GetLabelText("Bulletin_URL");
                litHits.Text = GetLabelText("Bulletin_Hits");
                txtHits.ToolTip = GetLabelText("Bulletin_Hits");
                litIsDisplay.Text = GetLabelText("Bulletin_IsDisplay");
                rdbDisplay0.Text = GetLabelText("Common_Yes");
                rdbDisplay1.Text = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Bulletin_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 BulletinId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.SeH.Bulletin bll = new Johnny.CMS.BLL.SeH.Bulletin();
                    Johnny.CMS.OM.SeH.Bulletin model = new Johnny.CMS.OM.SeH.Bulletin();
                    model = bll.GetModel(BulletinId);

                    txtTitle.Text = model.Title;
                    fckContent.Value = StringHelper.htmlOutputText(model.Content);
                    txtURL.Text = model.URL;
                    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;
                    //btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }
                else
                {
                    rdbDisplay0.Checked = true;
                    txtHits.Text = "0";
                }
            }
        }
Example #5
0
        /// <summary>
        /// Add one record
        /// </summary>
        public int Add(Johnny.CMS.OM.SeH.Bulletin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("DECLARE @Sequence int");
            strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_bulletin]");
            strSql.Append(" if @Sequence is NULL");
            strSql.Append(" Set @Sequence=1");
            strSql.Append("INSERT INTO [seh_bulletin](");
            strSql.Append("[Title],[Content],[URL],[Hits],[IsDisplay],[CreatedTime],[CreatedById],[CreatedByName],[UpdatedTime],[UpdatedById],[UpdatedByName],[Sequence]");
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append("@title,@content,@url,@hits,@isdisplay,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence");
            strSql.Append(")");
            strSql.Append(";SELECT @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",         SqlDbType.NVarChar,  200),
                new SqlParameter("@content",       SqlDbType.Text),
                new SqlParameter("@url",           SqlDbType.VarChar,   200),
                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.Title;
            parameters[1].Value  = model.Content;
            parameters[2].Value  = model.URL;
            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));
            }
        }
Example #6
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

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

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Bulletin_Title");
                getData();
            }
        }
Example #7
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

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

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Bulletin_Title");
                getData();                
            }
        }
Example #8
0
        /// <summary>
        /// Update one record
        /// </summary>
        public void Update(Johnny.CMS.OM.SeH.Bulletin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE [seh_bulletin] SET ");
            strSql.Append("[Title]=@title,");
            strSql.Append("[Content]=@content,");
            strSql.Append("[URL]=@url,");
            strSql.Append("[Hits]=@hits,");
            strSql.Append("[IsDisplay]=@isdisplay,");
            //strSql.Append("[CreatedTime]=@createdtime,");
            //strSql.Append("[CreatedById]=@createdbyid,");
            //strSql.Append("[CreatedByName]=@createdbyname,");
            strSql.Append("[UpdatedTime]=@updatedtime,");
            strSql.Append("[UpdatedById]=@updatedbyid,");
            strSql.Append("[UpdatedByName]=@updatedbyname,");
            strSql.Append(" WHERE [BulletinId]=@bulletinid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bulletinid",    SqlDbType.Int,         4),
                new SqlParameter("@title",         SqlDbType.NVarChar,  200),
                new SqlParameter("@content",       SqlDbType.Text),
                new SqlParameter("@url",           SqlDbType.VarChar,   200),
                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.BulletinId;
            parameters[1].Value = model.Title;
            parameters[2].Value = model.Content;
            parameters[3].Value = model.URL;
            parameters[4].Value = model.Hits;
            parameters[5].Value = model.IsDisplay;
            //parameters[6].Value = model.CreatedTime;
            //parameters[7].Value = model.CreatedById;
            //parameters[8].Value = model.CreatedByName;
            parameters[6].Value = model.UpdatedTime;
            parameters[7].Value = model.UpdatedById;
            parameters[8].Value = model.UpdatedByName;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #9
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>    	 
        public IList<Johnny.CMS.OM.SeH.Bulletin> GetList()
        {
            IList<Johnny.CMS.OM.SeH.Bulletin> list = new List<Johnny.CMS.OM.SeH.Bulletin>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [BulletinId], [Title], [Content], [URL], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bulletin] ");
            strSql.Append(" ORDER BY [Sequence] DESC");

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    Johnny.CMS.OM.SeH.Bulletin item = new Johnny.CMS.OM.SeH.Bulletin(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;
        }
Example #10
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>
        public IList <Johnny.CMS.OM.SeH.Bulletin> GetList()
        {
            IList <Johnny.CMS.OM.SeH.Bulletin> list = new List <Johnny.CMS.OM.SeH.Bulletin>();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [BulletinId], [Title], [Content], [URL], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bulletin] ");
            strSql.Append(" ORDER BY [Sequence] DESC");

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    Johnny.CMS.OM.SeH.Bulletin item = new Johnny.CMS.OM.SeH.Bulletin(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);
        }
Example #11
0
        /// <summary>
        /// Method to get one recoder by primary key
        /// </summary>    	 
        public Johnny.CMS.OM.SeH.Bulletin GetModel(int bulletinid)
        {
            //Set up a return value
            Johnny.CMS.OM.SeH.Bulletin model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [BulletinId], [Title], [Content], [URL], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_bulletin] ");
            strSql.Append(" WHERE [BulletinId]=@bulletinid");
            SqlParameter[] parameters = {
					new SqlParameter("@bulletinid", SqlDbType.Int,4)};
            parameters[0].Value = bulletinid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                    model = new Johnny.CMS.OM.SeH.Bulletin(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.Bulletin();
            }
            return model;
        }
Example #12
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtTitle, "E00901", "E00902", false))
            {
                return;
            }
            if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false))
            {
                return;
            }

            Johnny.CMS.BLL.SeH.Bulletin bll   = new Johnny.CMS.BLL.SeH.Bulletin();
            Johnny.CMS.OM.SeH.Bulletin  model = new Johnny.CMS.OM.SeH.Bulletin();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.BulletinId    = Convert.ToInt32(Request.QueryString["id"]);
                model.Title         = txtTitle.Text;
                model.Content       = StringHelper.htmlInputText(fckContent.Value);
                model.URL           = txtURL.Text;
                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.Title         = txtTitle.Text;
                model.Content       = StringHelper.htmlInputText(fckContent.Value);
                model.URL           = txtURL.Text;
                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"));
                    txtTitle.Text         = "";
                    fckContent.Value      = "";
                    txtURL.Text           = "";
                    txtHits.Text          = "";
                    rdbDisplay0.Checked   = true;
                    lblCreatedTime.Text   = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text   = "";
                    lblUpdatedByName.Text = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }
Example #13
0
 /// <summary>
 /// Update one record
 /// </summary>
 public void Update(Johnny.CMS.OM.SeH.Bulletin model)
 {
     dal.Update(model);
 }
Example #14
0
 /// <summary>
 /// Add one record
 /// </summary>
 public int Add(Johnny.CMS.OM.SeH.Bulletin model)
 {
     return(dal.Add(model));
 }