コード例 #1
0
        public int Add(MarqueeItems obj)
        {
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = INSERTMarqueeItems;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_ID, SqlDbType.Int);
            parameterID.Value = obj.ID;
            parameterID.Direction = ParameterDirection.Output;
            _command.Parameters.Add(parameterID);
            SqlParameter parameterName = new SqlParameter(PN_NAME, SqlDbType.NVarChar);
            parameterName.Value = obj.Name;
            parameterName.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterName);
            SqlParameter parameterDetails = new SqlParameter(PN_DETAILS, SqlDbType.NVarChar);
            parameterDetails.Value = obj.Details;
            parameterDetails.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterDetails);
            SqlParameter parameterIsDeleted = new SqlParameter(PN_ISDELETED, SqlDbType.Int);
            parameterIsDeleted.Value = obj.IsDeleted;
            parameterIsDeleted.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterIsDeleted);
            SqlParameter parameterCategoryID = new SqlParameter(PN_CATEGORYID, SqlDbType.Int);
            parameterCategoryID.Value = obj.CategoryID;
            parameterCategoryID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterCategoryID);
            SqlParameter parameterUrl = new SqlParameter(PN_URL, SqlDbType.NVarChar);
            parameterUrl.Value = obj.Url;
            parameterUrl.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterUrl);
            SqlParameter parameterUrlType = new SqlParameter(PN_URLTYPE, SqlDbType.Int);
            parameterUrlType.Value = Convert.ToInt32(obj.UrlType);
            parameterUrlType.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterUrlType);
            SqlParameter parameterText = new SqlParameter(PN_TEXT, SqlDbType.NVarChar);
            parameterText.Value = obj.Text;
            parameterText.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterText);

            SqlParameter parameterImage = new SqlParameter(PN_IMAGE, SqlDbType.NVarChar);
            parameterImage.Value = obj.Image;
            parameterImage.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterImage);
            #endregion;

            _connection.Open();
            _command.ExecuteNonQuery();
            _connection.Close();
            obj.ID = Convert.ToInt32(parameterID.Value);
            return obj.ID;
        }
コード例 #2
0
        private void EditMode()
        {
            if (ObjectID > 0)
            {
                MarqueeItems marqueeItems = new MarqueeItems();
                marqueeItems = MarqueeItemsManager.GetByID(ObjectID);
                if (null == marqueeItems)
                    return;
                txtDetails.Text = marqueeItems.Details;
                txtName.Text = marqueeItems.Name;
                txtText.Text = marqueeItems.Text;
                if (marqueeItems.UrlType == RootEnums.MarqueeItemURLType.External)
                {
                    txtURL.Text = marqueeItems.Url;
                    trDetails.Visible
                        = false;
                    trURL.Visible = true;
                }
                else
                {
                    txtURL.Text = marqueeItems.Url;
                    trDetails.Visible
                       = true;
                    trURL.Visible = false;
                }
                ddlMarqueeType.SelectedValue = Convert.ToInt32(marqueeItems.UrlType).ToString();
                ddlCategories.SelectedValue = marqueeItems.CategoryID.ToString();
                plcControls.Visible = true;

            }
        }
コード例 #3
0
        void btnSaveUpdate_Click(object sender, EventArgs e)
        {

            MarqueeItems marqueeItems = new MarqueeItems();
            if (ObjectID <= 0)
            {
                try
                {
                    marqueeItems.Name = txtName.Text;

                    marqueeItems.Details = txtDetails.Text;
                    marqueeItems.CategoryID = Convert.ToInt32(ddlCategories.SelectedValue);

                    marqueeItems.Details = txtDetails.Text;
                    marqueeItems.IsDeleted = false;
                    marqueeItems.Image = UtilitiesManager.GetSavedFile(fUploader, true);
                    marqueeItems.UrlType = (TG.ExpressCMS.DataLayer.Enums.RootEnums.MarqueeItemURLType)Convert.ToInt32(ddlMarqueeType.SelectedValue);
                    marqueeItems.Text = txtText.Text;

                    marqueeItems.Url = string.Empty;
                    MarqueeItemsManager.Add(marqueeItems);
                    if (marqueeItems.UrlType == RootEnums.MarqueeItemURLType.External || marqueeItems.UrlType == RootEnums.MarqueeItemURLType.TextOnly)
                    {
                        marqueeItems.Url = txtURL.Text;
                    }
                    else
                        marqueeItems.Url = ResolveUrl(ExpressoConfig.MarqueeConfigElement.GetDefaultDetailsPage) + ConstantsManager.MarqueeID + "=" + marqueeItems.ID.ToString();
                    MarqueeItemsManager.Update(marqueeItems);
                    AddMode();
                    dvProblems.InnerText = "Saved Successfully";
                }
                catch (Exception ex)
                {
                    dvProblems.InnerText = ex.ToString();
                }

            }
            else
            {
                try
                {
                    marqueeItems = MarqueeItemsManager.GetByID(ObjectID);
                    if (null == marqueeItems)
                    {
                        dvProblems.InnerText = Resources.ExpressCMS.ResourceManager.GetString(ConstantsManager.UnknowErronOccures);
                        return;
                    }
                    marqueeItems.Name = txtName.Text;
                    marqueeItems.Text = txtText.Text;
                    marqueeItems.Details = txtDetails.Text;
                    marqueeItems.CategoryID = Convert.ToInt32(ddlCategories.SelectedValue);
                    marqueeItems.Url = txtURL.Text;
                    marqueeItems.IsDeleted = false;
                    marqueeItems.Image = UtilitiesManager.GetSavedFile(fUploader, true);
                    marqueeItems.UrlType = (TG.ExpressCMS.DataLayer.Enums.RootEnums.MarqueeItemURLType)Convert.ToInt32(ddlMarqueeType.SelectedValue);
                    if (marqueeItems.UrlType == RootEnums.MarqueeItemURLType.External || marqueeItems.UrlType == RootEnums.MarqueeItemURLType.TextOnly)
                    {
                        marqueeItems.Url = txtURL.Text;
                    }
                    else
                        marqueeItems.Url = ResolveUrl(ExpressoConfig.MarqueeConfigElement.GetDefaultDetailsPage) + ConstantsManager.MarqueeID + "=" + marqueeItems.ID.ToString();
                    MarqueeItemsManager.Update(marqueeItems);
                    EditMode();
                    upnlGrid.Update();
                    dvProblems.InnerText = "Saved Successfully";
                }
                catch (Exception ex)
                {
                    dvProblems.InnerText = ex.ToString();
                }
            }
            BindGrid(string.Empty);
        }
コード例 #4
0
ファイル: DataMapperBase.cs プロジェクト: yalhami/eXpresso
        public void PopulateMarqueeItems(SqlDataReader _dtr, MarqueeItems obj)
        {
            int columnIndex = 0;
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.ID = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_NAME);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Name = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_DETAILS);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Details = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_ISDELETED);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.IsDeleted = _dtr.GetBoolean((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_CATEGORYID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.CategoryID = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_URL);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Url = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_URLTYPE);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.UrlType = (TG.ExpressCMS.DataLayer.Enums.RootEnums.MarqueeItemURLType)_dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_TEXT);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Text = _dtr.GetString((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(MarqueeItemsDataMapper.CN_IMAGE);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Image = _dtr.GetString((columnIndex));
            }
        }
コード例 #5
0
        private string GetImageSeperator(MarqueeItems _marqueeItems)
        {
            string _item = string.Empty;

            _item += "<img src=" + GetFullImagePath(_Category.Image) + " width=" + ImageSeperatorWidth + " Height=" + ImageSeperatorHeight + "/>";

            return _item;
        }
コード例 #6
0
        private string GetEntityMarquee(MarqueeItems _marqueeItems)
        {
            string _item = string.Empty;

            _item += "<a href=" + _marqueeItems.Url + ">" + _marqueeItems.Text + "</a>";

            return _item;
        }
コード例 #7
0
        public static void Update(MarqueeItems obj)
        {
            MarqueeItemsDataMapper objCaller = new MarqueeItemsDataMapper();

            objCaller.Update(obj);
        }
コード例 #8
0
        public static int Add(MarqueeItems obj)
        {
            MarqueeItemsDataMapper objCaller = new MarqueeItemsDataMapper();

            return objCaller.Add(obj);
        }
コード例 #9
0
 public MarqueeItems GetMarqueeItems(SqlDataReader _dtr, IList<MarqueeItems> colobj)
 {
     MarqueeItems obj = colobj.Where(t => t.ID == Convert.ToInt32(_dtr[CN_ID].ToString())).SingleOrDefault();
     if (null == obj)
     {
         obj = new MarqueeItems();
         colobj.Add(obj);
     }
     return obj;
 }
コード例 #10
0
        public IList<MarqueeItems> GetByCategoryID(int catID)
        {

            MarqueeItems obj = null;

            IList<MarqueeItems> colobj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTALLMarqueeItemsByCatID;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_CATEGORYID, SqlDbType.Int);
            parameterID.Value = catID;
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new MarqueeItems();
                        colobj = new List<MarqueeItems>();
                        while (_dtreader.Read())
                        {
                            obj = GetMarqueeItems(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
コード例 #11
0
        public IList<MarqueeItems> GetAll()
        {

            MarqueeItems obj = null;

            IList<MarqueeItems> colobj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTALLMarqueeItems;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new MarqueeItems();
                        colobj = new List<MarqueeItems>();
                        while (_dtreader.Read())
                        {
                            obj = GetMarqueeItems(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
コード例 #12
0
 private void GetEntityFromReader(SqlDataReader _dtr, MarqueeItems obj)
 {
     PopulateMarqueeItems(_dtr, obj);
 }
コード例 #13
0
        public MarqueeItems GetByID(int ID)
        {

            MarqueeItems obj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTMarqueeItems;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_ID, SqlDbType.Int);
            parameterID.Value = ID;
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new MarqueeItems();
                        if (_dtreader.Read())
                            GetEntityFromReader(_dtreader, obj);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return obj;
        }