Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;
                TextBox uptName = (TextBox)row.FindControl("txtUptChannelName");

                //check name
                if (!CheckInputEmptyAndLength(uptName, "E00801", "E00802"))
                    return;

                //update
                Johnny.CMS.OM.SeH.Channel model = new Johnny.CMS.OM.SeH.Channel();
                model.ChannelId = DataConvert.GetInt32(strId);
                model.ChannelName = uptName.Text;

                Johnny.CMS.BLL.SeH.Channel bll = new Johnny.CMS.BLL.SeH.Channel();
                bll.Update(model);
            }

            SetMessage(GetMessage("C00003"));

            //update grid
            getData();
        }
Exemplo n.º 2
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //check category name
            if (!CheckInputEmptyAndLength(txtChannelName, "E00801", "E00802", false))
                return;

            Johnny.CMS.BLL.SeH.Channel bll = new Johnny.CMS.BLL.SeH.Channel();
            Johnny.CMS.OM.SeH.Channel model = new Johnny.CMS.OM.SeH.Channel();

            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.ChannelId = Convert.ToInt32(Request.QueryString["id"]);
                model.ChannelName = txtChannelName.Text;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.ChannelName = txtChannelName.Text;
                
                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtChannelName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }        
Exemplo n.º 3
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text      = GetLabelText("Channel_Title");
                litChannelName.Text    = GetLabelText("Channel_ChannelName");
                txtChannelName.ToolTip = GetLabelText("Channel_ChannelName");

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

                    Johnny.CMS.BLL.SeH.Channel bll   = new Johnny.CMS.BLL.SeH.Channel();
                    Johnny.CMS.OM.SeH.Channel  model = new Johnny.CMS.OM.SeH.Channel();
                    model = bll.GetModel(MenuCategoryId);

                    txtChannelName.Text = model.ChannelName;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                }

                //RFVldtMenuCategoryName.ErrorMessage = GetMessage("E00801", txtMenuCategoryName.MaxLength.ToString());
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Add one record
        /// </summary>
        public int Add(Johnny.CMS.OM.SeH.Channel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("DECLARE @Sequence int");
            strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_channel]");
            strSql.Append(" if @Sequence is NULL");
            strSql.Append(" Set @Sequence=1");
            strSql.Append("INSERT INTO [seh_channel](");
            strSql.Append("[ChannelName],[Sequence]");
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append("@channelname,@Sequence");
            strSql.Append(")");
            strSql.Append(";SELECT @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@channelname", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.ChannelName;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 5
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("Channel_Title");
                litChannelName.Text = GetLabelText("Channel_ChannelName");
                txtChannelName.ToolTip = GetLabelText("Channel_ChannelName");

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

                    Johnny.CMS.BLL.SeH.Channel bll = new Johnny.CMS.BLL.SeH.Channel();
                    Johnny.CMS.OM.SeH.Channel model = new Johnny.CMS.OM.SeH.Channel();
                    model = bll.GetModel(MenuCategoryId);

                    txtChannelName.Text = model.ChannelName;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
                }

                //RFVldtMenuCategoryName.ErrorMessage = GetMessage("E00801", txtMenuCategoryName.MaxLength.ToString());
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Method to get one recoder by primary key
        /// </summary>
        public Johnny.CMS.OM.SeH.Channel GetModel(int channelid)
        {
            //Set up a return value
            Johnny.CMS.OM.SeH.Channel model = null;

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [ChannelId], [ChannelName], [Sequence] ");
            strSql.Append(" FROM [seh_channel] ");
            strSql.Append(" WHERE [ChannelId]=@channelid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@channelid", SqlDbType.Int, 4)
            };
            parameters[0].Value = channelid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                {
                    model = new Johnny.CMS.OM.SeH.Channel(sdr.GetInt32(0), sdr.GetString(1), sdr.GetInt32(2));
                }
                else
                {
                    model = new Johnny.CMS.OM.SeH.Channel();
                }
            }
            return(model);
        }
Exemplo n.º 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                string  strId   = ((Label)row.FindControl(STR_LABEL_ID)).Text;
                TextBox uptName = (TextBox)row.FindControl("txtUptChannelName");

                //check name
                if (!CheckInputEmptyAndLength(uptName, "E00801", "E00802"))
                {
                    return;
                }

                //update
                Johnny.CMS.OM.SeH.Channel model = new Johnny.CMS.OM.SeH.Channel();
                model.ChannelId   = DataConvert.GetInt32(strId);
                model.ChannelName = uptName.Text;

                Johnny.CMS.BLL.SeH.Channel bll = new Johnny.CMS.BLL.SeH.Channel();
                bll.Update(model);
            }

            SetMessage(GetMessage("C00003"));

            //update grid
            getData();
        }
Exemplo n.º 8
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

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

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Channel_ChannelName");
                getData();
            }
        }
Exemplo n.º 9
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

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

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Channel_ChannelName");
                getData();
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Update one record
        /// </summary>
        public void Update(Johnny.CMS.OM.SeH.Channel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE [seh_channel] SET ");
            strSql.Append("[ChannelName]=@channelname");
            strSql.Append(" WHERE [ChannelId]=@channelid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@channelid",   SqlDbType.Int,       4),
                new SqlParameter("@channelname", SqlDbType.NVarChar, 50),
            };
            parameters[0].Value = model.ChannelId;
            parameters[1].Value = model.ChannelName;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>    	 
        public IList<Johnny.CMS.OM.SeH.Channel> GetList()
        {
            IList<Johnny.CMS.OM.SeH.Channel> list = new List<Johnny.CMS.OM.SeH.Channel>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [ChannelId], [ChannelName], [Sequence] ");
            strSql.Append(" FROM [seh_channel] ");
            strSql.Append(" ORDER BY [Sequence]");

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    Johnny.CMS.OM.SeH.Channel item = new Johnny.CMS.OM.SeH.Channel(sdr.GetInt32(0), sdr.GetString(1), sdr.GetInt32(2));
                    list.Add(item);
                }
            }
            return list;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>
        public IList <Johnny.CMS.OM.SeH.Channel> GetList()
        {
            IList <Johnny.CMS.OM.SeH.Channel> list = new List <Johnny.CMS.OM.SeH.Channel>();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [ChannelId], [ChannelName], [Sequence] ");
            strSql.Append(" FROM [seh_channel] ");
            strSql.Append(" ORDER BY [Sequence]");

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    Johnny.CMS.OM.SeH.Channel item = new Johnny.CMS.OM.SeH.Channel(sdr.GetInt32(0), sdr.GetString(1), sdr.GetInt32(2));
                    list.Add(item);
                }
            }
            return(list);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Method to get one recoder by primary key
        /// </summary>    	 
        public Johnny.CMS.OM.SeH.Channel GetModel(int channelid)
        {
            //Set up a return value
            Johnny.CMS.OM.SeH.Channel model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [ChannelId], [ChannelName], [Sequence] ");
            strSql.Append(" FROM [seh_channel] ");
            strSql.Append(" WHERE [ChannelId]=@channelid");
            SqlParameter[] parameters = {
					new SqlParameter("@channelid", SqlDbType.Int,4)};
            parameters[0].Value = channelid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                    model = new Johnny.CMS.OM.SeH.Channel(sdr.GetInt32(0), sdr.GetString(1), sdr.GetInt32(2));
                else
                    model = new Johnny.CMS.OM.SeH.Channel();
            }
            return model;
        }
Exemplo n.º 14
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //check category name
            if (!CheckInputEmptyAndLength(txtChannelName, "E00801", "E00802", false))
            {
                return;
            }

            Johnny.CMS.BLL.SeH.Channel bll   = new Johnny.CMS.BLL.SeH.Channel();
            Johnny.CMS.OM.SeH.Channel  model = new Johnny.CMS.OM.SeH.Channel();

            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.ChannelId   = Convert.ToInt32(Request.QueryString["id"]);
                model.ChannelName = txtChannelName.Text;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.ChannelName = txtChannelName.Text;

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtChannelName.Text = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// Update one record
 /// </summary>
 public void Update(Johnny.CMS.OM.SeH.Channel model)
 {
     dal.Update(model);
 }
Exemplo n.º 16
0
 /// <summary>
 /// Add one record
 /// </summary>
 public int Add(Johnny.CMS.OM.SeH.Channel model)
 {
     return(dal.Add(model));
 }