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

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [OpenSourceId], [OpenSourceName], [ShortDescription], [Description], [URL], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_opensource] ");
            strSql.Append(" WHERE [OpenSourceId]=@opensourceid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OpenSourceid", SqlDbType.Int, 4)
            };
            parameters[0].Value = OpenSourceid;
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
            {
                if (sdr.Read())
                {
                    model = new Johnny.CMS.OM.SeH.OpenSource(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetString(3), sdr.GetString(4), sdr.GetInt32(5), sdr.GetBoolean(6), sdr.GetDateTime(7), sdr.GetInt32(8), sdr.GetString(9), sdr.GetDateTime(10), sdr.GetInt32(11), sdr.GetString(12), sdr.GetInt32(13));
                }
                else
                {
                    model = new Johnny.CMS.OM.SeH.OpenSource();
                }
            }
            return(model);
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("OpenSource_Title");
                litOpenSourceName.Text = GetLabelText("Opensource_OpenSourceName");
                txtOpenSourceName.ToolTip = GetLabelText("Opensource_OpenSourceName");
                litShortDescription.Text = GetLabelText("Opensource_ShortDescription");
                txtShortDescription.ToolTip = GetLabelText("Opensource_ShortDescription");
                litContent.Text = GetLabelText("Opensource_Description");
                litURL.Text = GetLabelText("Opensource_URL");
                txtURL.ToolTip = GetLabelText("Opensource_URL");
                litHits.Text = GetLabelText("Opensource_Hits");
                txtHits.ToolTip = GetLabelText("Opensource_Hits");
                litIsDisplay.Text = GetLabelText("Opensource_IsDisplay");
                rdbDisplay0.Text = GetLabelText("Common_Yes");
                rdbDisplay1.Text = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Opensource_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 OpenSourceId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.SeH.OpenSource bll = new Johnny.CMS.BLL.SeH.OpenSource();
                    Johnny.CMS.OM.SeH.OpenSource model = new Johnny.CMS.OM.SeH.OpenSource();
                    model = bll.GetModel(OpenSourceId);


                    txtOpenSourceName.Text = model.OpenSourceName;
                    txtShortDescription.Text = model.ShortDescription;
                    fckContent.Value = model.Description;
                    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;
                }
                else
                {
                    rdbDisplay0.Checked = true;
                    txtHits.Text = "0";
                }
            }
        }
Example #3
0
        /// <summary>
        /// Add one record
        /// </summary>
        public int Add(Johnny.CMS.OM.SeH.OpenSource model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("DECLARE @Sequence int");
            strSql.Append(" SELECT @Sequence=(max(Sequence)+1) FROM [seh_OpenSource]");
            strSql.Append(" if @Sequence is NULL");
            strSql.Append(" Set @Sequence=1");
            strSql.Append("INSERT INTO [seh_OpenSource](");
            strSql.Append("[OpenSourceName],[ShortDescription],[Description],[URL],[Hits],[IsDisplay],[CreatedTime],[CreatedById],[CreatedByName],[UpdatedTime],[UpdatedById],[UpdatedByName],[Sequence]");
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append("@OpenSourcename,@shortdescription,@description,@url,@hits,@isdisplay,@createdtime,@createdbyid,@createdbyname,@updatedtime,@updatedbyid,@updatedbyname,@sequence");
            strSql.Append(")");
            strSql.Append(";SELECT @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OpenSourcename",   SqlDbType.NVarChar,   50),
                new SqlParameter("@shortdescription", SqlDbType.NVarChar,  200),
                new SqlParameter("@description",      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.OpenSourceName;
            parameters[1].Value  = model.ShortDescription;
            parameters[2].Value  = model.Description;
            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[9].Value  = model.UpdatedTime;
            parameters[10].Value = model.UpdatedById;
            parameters[11].Value = model.UpdatedByName;

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

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

            strSql.Append("UPDATE [seh_OpenSource] SET ");
            strSql.Append("[OpenSourceName]=@OpenSourcename,");
            strSql.Append("[ShortDescription]=@shortdescription,");
            strSql.Append("[Description]=@description,");
            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 [OpenSourceId]=@OpenSourceid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OpenSourceid",     SqlDbType.Int,         4),
                new SqlParameter("@OpenSourcename",   SqlDbType.NVarChar,   50),
                new SqlParameter("@shortdescription", SqlDbType.NVarChar,  200),
                new SqlParameter("@description",      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.OpenSourceId;
            parameters[1].Value = model.OpenSourceName;
            parameters[2].Value = model.ShortDescription;
            parameters[3].Value = model.Description;
            parameters[4].Value = model.URL;
            parameters[5].Value = model.Hits;
            parameters[6].Value = model.IsDisplay;
            //parameters[7].Value = model.CreatedTime;
            //parameters[8].Value = model.CreatedById;
            //parameters[9].Value = model.CreatedByName;
            parameters[7].Value = model.UpdatedTime;
            parameters[8].Value = model.UpdatedById;
            parameters[9].Value = model.UpdatedByName;

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

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

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

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

            if (!IsPostBack)
            {
                myManageGridView.Columns[2].HeaderText = GetLabelText("Opensource_OpenSourceName");
                myManageGridView.Columns[3].HeaderText = GetLabelText("Opensource_ShortDescription");
                myManageGridView.Columns[4].HeaderText = GetLabelText("Opensource_URL");
                getData();
            }
        }
Example #7
0
        /// <summary>
        /// Method to get recoders with condition
        /// </summary>    	 
        public IList<Johnny.CMS.OM.SeH.OpenSource> GetList()
        {
            IList<Johnny.CMS.OM.SeH.OpenSource> list = new List<Johnny.CMS.OM.SeH.OpenSource>();

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

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

            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT [OpenSourceId], [OpenSourceName], [ShortDescription], [Description], [URL], [Hits], [IsDisplay], [CreatedTime], [CreatedById], [CreatedByName], [UpdatedTime], [UpdatedById], [UpdatedByName], [Sequence] ");
            strSql.Append(" FROM [seh_opensource] ");
            strSql.Append(" ORDER BY [Sequence]");

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

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

            Johnny.CMS.BLL.SeH.OpenSource bll   = new Johnny.CMS.BLL.SeH.OpenSource();
            Johnny.CMS.OM.SeH.OpenSource  model = new Johnny.CMS.OM.SeH.OpenSource();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.OpenSourceId     = Convert.ToInt32(Request.QueryString["id"]);
                model.OpenSourceName   = txtOpenSourceName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description      = 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.OpenSourceName   = txtOpenSourceName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description      = 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"));
                    txtOpenSourceName.Text   = "";
                    txtShortDescription.Text = "";
                    fckContent.Value         = "";
                    txtURL.Text           = "";
                    txtHits.Text          = "0";
                    rdbDisplay0.Checked   = true;
                    lblCreatedTime.Text   = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text   = "";
                    lblUpdatedByName.Text = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }
Example #11
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text           = GetLabelText("OpenSource_Title");
                litOpenSourceName.Text      = GetLabelText("Opensource_OpenSourceName");
                txtOpenSourceName.ToolTip   = GetLabelText("Opensource_OpenSourceName");
                litShortDescription.Text    = GetLabelText("Opensource_ShortDescription");
                txtShortDescription.ToolTip = GetLabelText("Opensource_ShortDescription");
                litContent.Text             = GetLabelText("Opensource_Description");
                litURL.Text           = GetLabelText("Opensource_URL");
                txtURL.ToolTip        = GetLabelText("Opensource_URL");
                litHits.Text          = GetLabelText("Opensource_Hits");
                txtHits.ToolTip       = GetLabelText("Opensource_Hits");
                litIsDisplay.Text     = GetLabelText("Opensource_IsDisplay");
                rdbDisplay0.Text      = GetLabelText("Common_Yes");
                rdbDisplay1.Text      = GetLabelText("Common_No");
                litRdbDisplayTip.Text = GetLabelText("Opensource_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 OpenSourceId = Convert.ToInt32(Request.QueryString["id"]);

                    Johnny.CMS.BLL.SeH.OpenSource bll   = new Johnny.CMS.BLL.SeH.OpenSource();
                    Johnny.CMS.OM.SeH.OpenSource  model = new Johnny.CMS.OM.SeH.OpenSource();
                    model = bll.GetModel(OpenSourceId);


                    txtOpenSourceName.Text   = model.OpenSourceName;
                    txtShortDescription.Text = model.ShortDescription;
                    fckContent.Value         = model.Description;
                    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;
                }
                else
                {
                    rdbDisplay0.Checked = true;
                    txtHits.Text        = "0";
                }
            }
        }
Example #12
0
 /// <summary>
 /// Update one record
 /// </summary>
 public void Update(Johnny.CMS.OM.SeH.OpenSource model)
 {
     dal.Update(model);
 }
Example #13
0
 /// <summary>
 /// Add one record
 /// </summary>
 public int Add(Johnny.CMS.OM.SeH.OpenSource model)
 {
     return(dal.Add(model));
 }
Example #14
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtOpenSourceName, "E00901", "E00902", false))
                return;
            if (!CheckInputEmptyAndLength(txtHits, "E00901", "E00902", false))
                return;

            Johnny.CMS.BLL.SeH.OpenSource bll = new Johnny.CMS.BLL.SeH.OpenSource();
            Johnny.CMS.OM.SeH.OpenSource model = new Johnny.CMS.OM.SeH.OpenSource();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.OpenSourceId = Convert.ToInt32(Request.QueryString["id"]);
                model.OpenSourceName = txtOpenSourceName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description = 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.OpenSourceName = txtOpenSourceName.Text;
                model.ShortDescription = txtShortDescription.Text;
                model.Description = 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"));
                    txtOpenSourceName.Text = "";
                    txtShortDescription.Text = "";
                    fckContent.Value = "";
                    txtURL.Text = "";
                    txtHits.Text = "0";
                    rdbDisplay0.Checked = true;
                    lblCreatedTime.Text = "";
                    lblCreatedByName.Text = "";
                    lblUpdatedTime.Text = "";
                    lblUpdatedByName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }