ParameterCollection

Namespace: Exceptionless
We found 10 examples in language CSharp for this search. You will see 53 fragments of code.

Other methods


		/// <summary>
		/// Adds the elements of another ParameterCollection to the end of this ParameterCollection.
		/// </summary>
		/// <param name="items">
		/// The ParameterCollection whose elements are to be added to the end of this ParameterCollection.
		/// </param>
		public virtual void AddRange(ParameterCollection items)
		{
			foreach (Parameter item in items)
			{
				List.Add(item);
			}
		}

		[Test]
		public void Constructor()
		{
			ParameterCollection p = new ParameterCollection();
			Assert.IsNotNull (p,"Collection should not be 'null'");
			Assert.AreEqual(0,p.Count,"Lenght should be '0'");
		}
		
		
		[Test]
		public void CurrentCulture ()
		{
			ParameterCollection p = new ParameterCollection();
			Assert.AreEqual(System.Globalization.CultureInfo.CurrentCulture,ParameterCollection.Culture,
			                "Culture should be 'CurrentCulture'");
		}
		
		
		[Test]
		public void Add2Elements()
		{
			ParameterCollection p = this.CollectionWith2Parameters();
			Assert.AreEqual(2,p.Count,"Count should be '2'");
		}
		
		
		[Test]
		public void AddParamToExistingList()
		{
			ParameterCollection p = this.CollectionWith2Parameters();
			p.Add (new BasicParameter("p3","Parameter3"));
			Assert.AreEqual(3,p.Count,"Count should be '3'");
		}
		
		[Test]
		public void NameNotExist ()
		{
			ParameterCollection p = this.CollectionWith3Parameters();
			BasicParameter c = p.Find("noexist");
			Assert.IsNull(c,"Column should be 'null'");
		}
		
		
		[Test]
		public void FindByName()
		{
			ParameterCollection p = this.CollectionWith3Parameters();
			BasicParameter bp = p.Find("p2");
			Assert.IsNotNull(bp);
			Assert.AreEqual(bp.ParameterValue,"Parameter2","Find should return valid element");
		}


        public void AddSubject(SubjectModel objsub)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Subject", objsub.Subject_Name));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Year", objsub.Year));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Programme", objsub.Programme));
                SQLHandler SQLH = new SQLHandler();
                SQLH.ExecuteNonQuery("[dbo].[SP_AddSubject]", ParaMeterCollection);
            }
            catch
            {
                throw;
            }
        }
        public void AddObjQuestionandAnswer(ObjAnswerModel objAns)
        {
            try
            {

                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@ObjectiveQuestion", objAns.ObjectiveQue));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@SubjectID", objAns.SubjectID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Answer1", objAns.Answer1));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Answer2", objAns.Answer2));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Answer3", objAns.Answer3));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Answer4", objAns.Answer4));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Status1", objAns.Status1));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Status2", objAns.Status2));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Status3", objAns.Status3));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Status4", objAns.Status4));





                SQLHandler SQLH = new SQLHandler();
                SQLH.ExecuteNonQuery("[dbo].[SP_AddObjQuestionandAnswer]", ParaMeterCollection);
            }
            catch
            {
                throw;
            }


        }
        public List<SubjectModel> GetAllSubjects()
        {
            try
            {
                SQLHandler SQLH = new SQLHandler();
                List<SubjectModel> objsubject = SQLH.ExecuteAsList<SubjectModel>("[dbo].[SP_GetAllSubjects]");
                return objsubject;
            }
            catch (Exception)
            {

                throw;
            }
        }

        public ExamsModel AddExamName(ExamsModel objExam)
        {
            objExam.NoticePublishDate = DateTime.Now;
            objExam.NoticeMessege = "Exam Notice: For " + objExam.Year + "year " + objExam.Programme + " students. Exam " + objExam.ExamName + "has been scheduled on " + objExam.ScheduleExam.ToString();
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@ExamName", objExam.ExamName));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", objExam.IsActive));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Year", objExam.Year));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@ExamDuration", objExam.ExamDuration));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Programme", objExam.Programme));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@ScheduleExam", objExam.ScheduleExam));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@ExamType", objExam.ExamType));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@NoticeMessege", objExam.NoticeMessege));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@NoticePublishDate", objExam.NoticePublishDate));


                SQLHandler SQLH = new SQLHandler();
                ExamsModel objEM = SQLH.ExecuteAsObject<ExamsModel>("[dbo].[SP_AddExamName]", ParaMeterCollection);
                return objEM;
            }
            catch (Exception)
            {

                throw;
            }
        }


        public void AddQuestionsInExam(ObjQuestionsModel objQue)
        {
            try
            {

                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@QuestionID", objQue.ObjectiveQue_ID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@ExamID", objQue.ExamID));
                SQLHandler SQLH = new SQLHandler();
                SQLH.ExecuteNonQuery("[dbo].[SP_AddQuestionsInExam]", ParaMeterCollection);
            }
            catch
            {
                throw;
            }


        }

        public List<ObjQuestionsModel> GetAllQuestionBySubjectID(ObjQuestionsModel objQue)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@SubjectID", objQue.SubjectID));
                SQLHandler SQLH = new SQLHandler();

                List<ObjQuestionsModel> data = SQLH.ExecuteAsList<ObjQuestionsModel>("[dbo].[SP_GetQuestionsBySubjectID]", ParaMeterCollection);
                return data;
            }
            catch (Exception)
            {

                throw;
            }
        }

        public string AddUser(UserModel objUser)
        {
            
            objUser.AddedOn = DateTime.Now;
            objUser.IsActive = false;
            var umodel = CheckUserName(objUser.UserName);
            if (umodel==null)
            {
                try
                {

                    List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", objUser.UserName));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@Email", objUser.Email));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@Password", objUser.Password));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedOn", objUser.AddedOn));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@Gender", objUser.Gender));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", objUser.IsActive));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserRoleID", objUser.UserRoleID));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@Year", objUser.Year));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@Programme", objUser.Programme));
                    ParaMeterCollection.Add(new KeyValuePair<string, object>("@FullName", objUser.FullName));

                    SQLHandler SQLH = new SQLHandler();
                    SQLH.ExecuteNonQuery("[dbo].[SP_UserRegistration]", ParaMeterCollection);
                    return null;
                }
                catch (Exception)
                {

                    throw;
                }
            }
            else
            {
                return "Already Present";
            }
           
        }
        public UserModel CheckUserName(string UserName)
        {

            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", UserName));
                SQLHandler SQLH = new SQLHandler();
                UserModel objusr = (SQLH.ExecuteAsObject<UserModel>("[dbo].[SP_GetAllFromUserName]", ParaMeterCollection));
                return objusr;
            }
            catch (Exception)
            {

                throw;
            }
        }
        public UserModel LoginUser(UserModel objUser)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", objUser.UserName));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Password", objUser.Password));




                SQLHandler SQLH = new SQLHandler();
                UserModel objusr = (SQLH.ExecuteAsObject<UserModel>("[dbo].[SP_UserLogin]", ParaMeterCollection));
                return objusr;
            }
            catch (Exception)
            {

                throw;
            }
        }

      

        public List<UserModel> GetAllUsers()
        {
            try
            {
                SQLHandler SQLH = new SQLHandler();
                List<UserModel> objuser = SQLH.ExecuteAsList<UserModel>("[dbo].[SP_GetAllUser]");
                return objuser;
            }
            catch (Exception)
            {

                throw;
            }
        }

        

         public void ApproveUserByUserID(UserModel objApprove)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserID", objApprove.UserID));
                SQLHandler SQLH = new SQLHandler();
                SQLH.ExecuteNonQuery("[dbo].[SP_MakeUserActive]", ParaMeterCollection);
            }
            catch (Exception)
            {

                throw;
            }

        }

        //Get users which are not approved
        public List<UserModel> GetUnaprrovedUsers()
        {
            try
            {
                SQLHandler SQLH = new SQLHandler();
                List<UserModel> objuser = SQLH.ExecuteAsList<UserModel>("[dbo].[SP_GetUnaprrovedUsers]");
                return objuser;
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// Connects to database and deletes HTML comments by commentID
        /// </summary>
        /// <param name="HTMLCommentID">HTMLCommentID</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="DeletedBy">HTML deleted user's name</param>
        public void HTMLCommentDeleteByCommentID(int HTMLCommentID, int PortalID, string DeletedBy)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLCommentID", HTMLCommentID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@DeletedBy", DeletedBy));
                SQLHandler sq = new SQLHandler();
                sq.ExecuteNonQuery("dbo.sp_HtmlCommentDeleteByCommentID", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and returns HTML comments by HTMLCommentID
        /// </summary>
        /// <param name="PortalID">portalID</param>
        /// <param name="HTMLCommentID">HTMLCommentID</param>
        /// <returns>Returns HTML Comments</returns>
        public HTMLContentInfo HtmlCommentGetByHTMLCommentID(int PortalID, int HTMLCommentID)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLCommentID", HTMLCommentID));
                SQLHandler sq = new SQLHandler();
                return sq.ExecuteAsObject<HTMLContentInfo>("dbo.sp_HtmlCommentGetByHTMLCommentID", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and adds html comment
        /// </summary>
        /// <param name="HTMLTextID">HTMLTextID</param>
        /// <param name="Comment">Comment</param>
        /// <param name="IsApproved">Set true if the html comment is approve</param>
        /// <param name="IsActive">Set true if the html comment is active</param>
        /// <param name="AddedOn">Added Date</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="AddedBy">Added by</param>
        public void HtmlCommentAdd(string HTMLTextID, string Comment, bool IsApproved, bool IsActive, DateTime AddedOn, int PortalID, string AddedBy)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLTextID", HTMLTextID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Comment", Comment));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsApproved", IsApproved));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", IsActive));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedOn", AddedOn));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedBy", AddedBy));
                SQLHandler sq = new SQLHandler();
                sq.ExecuteNonQuery("dbo.sp_HtmlCommentAdd", ParaMeterCollection, "@HTMLCommentID");
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and updates html comment.
        /// </summary>
        /// <param name="HTMLCommentID">HTMLCommentID</param>
        /// <param name="Comment">Comment</param>
        /// <param name="IsApproved">Set true if the comment is approved</param>
        /// <param name="IsActive">Set true if the comment is active</param>
        /// <param name="IsModified">Set true if the  comment is modified</param>
        /// <param name="UpdatedOn">Date on which the comment is updated</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="UpdatedBy">Updated user's name</param>
        public void HtmlCommentUpdate(object HTMLCommentID, string Comment, bool IsApproved, bool IsActive, bool IsModified, DateTime UpdatedOn, int PortalID, string UpdatedBy)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLCommentID", HTMLCommentID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Comment", Comment));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsApproved", IsApproved));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", IsActive));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsModified", IsModified));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UpdatedOn", UpdatedOn));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UpdatedBy", UpdatedBy));
                SQLHandler sq = new SQLHandler();
                sq.ExecuteNonQuery("dbo.sp_HtmlCommentUpdate", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and checks if the user is authentcate to edit HTML
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="Username">userName</param>
        /// <param name="PortalID">portalID</param>
        /// <returns>returns true if the user has permission to edit</returns>
        public bool IsAuthenticatedToEdit(int UserModuleID, string Username, int PortalID)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PermissionKey", "EDIT"));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", UserModuleID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", Username));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                SQLHandler sagesql = new SQLHandler();
                return sagesql.ExecuteAsScalar<bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and returns the HTML content  for given portal , username and culture
        /// </summary>
        /// <param name="PortalID">portalID</param>
        /// <param name="UsermoduleID">usermoduleID</param>
        /// <param name="CultureName">Culturename</param>
        /// <returns>returns HTMLContentInfo object</returns>
        public HTMLContentInfo GetHTMLContent(int PortalID, int UsermoduleID, string CultureName)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UsermoduleID", UsermoduleID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@CultureName", CultureName));
                SQLHandler sagesql = new SQLHandler();
                HTMLContentInfo objHtmlInfo = sagesql.ExecuteAsObject<HTMLContentInfo>("dbo.sp_HtmlTextGetByPortalAndUserModule", ParaMeterCollection);
                return objHtmlInfo;
            }
            catch (Exception e)
            {
                throw e;
            }
        }

		public MySqlDataReader GetReader(Command command)
		{
			MySqlConnection connection = Connector.GetConnection();

			MySqlCommand cmd = new MySqlCommand(command.SqlStatement, connection);
			cmd.CommandTimeout = 65535;
			if (command.ParameterCollection != null && command.ParameterCollection.Parameters.Any())
			{
				cmd.Parameters.AddRange(command.ParameterCollection.Parameters);
			}

			connection.Open();

			MySqlDataReader dataReader;
			try
			{
				dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection|CommandBehavior.SequentialAccess);
			}
			catch (Exception eError)
			{
				throw new Exception(string.Format("{0}:{1}", eError.Message, eError.StackTrace));
			}
			return dataReader;
		}

		private object ExecuteScalarQuery(Command command)
		{
			MySqlConnection connection = Connector.GetConnection();

			MySqlCommand cmd = new MySqlCommand(command.SqlStatement, connection);
			cmd.CommandTimeout = 65535;
			if (command.ParameterCollection != null && command.ParameterCollection.Parameters.Any())
			{
				cmd.Parameters.AddRange(command.ParameterCollection.Parameters);
			}

			connection.Open();

			object selectedValue;

			try
			{
				selectedValue = cmd.ExecuteScalar();
			}
			catch (Exception eError)
			{
				throw new Exception(string.Format("{0}:{1}", eError.Message, eError.StackTrace));
			}
			finally
			{
				connection.Close();
			}

			return selectedValue;
		}

		public string GetStringValue(Command command)
		{
			object selectedValue = ExecuteScalarQuery(command);

			return selectedValue == null ? string.Empty : (string)selectedValue;
		}

		public int GetIntValue(Command command)
		{
			object selectedValue = ExecuteScalarQuery(command);

			return selectedValue == null ? 0 : int.Parse(selectedValue.ToString());
		}


        public override DbCommand CreateCommand()
        {
            return new ProxyCommand(Activator.CreateInstance<TCommand>());
        }

        public override DbCommandBuilder CreateCommandBuilder()
        {
            return null;
        }

        public override DbConnection CreateConnection()
        {
            return new ProxyConnection(Activator.CreateInstance<TConnection>());
        }

        public override DbConnectionStringBuilder CreateConnectionStringBuilder()
        {
            return null;
        }

        public override DbDataAdapter CreateDataAdapter()
        {
            return Activator.CreateInstance<TDataAdapter>() as DbDataAdapter;
        }

        public override DbDataSourceEnumerator CreateDataSourceEnumerator()
        {
            return null;
        }


        /// <summary>
        /// Connects to database and deletes HTML comments by commentID
        /// </summary>
        /// <param name="HTMLCommentID">HTMLCommentID</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="DeletedBy">HTML deleted user's name</param>
        public void HTMLCommentDeleteByCommentID(int HTMLCommentID, int PortalID, string DeletedBy)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLCommentID", HTMLCommentID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@DeletedBy", DeletedBy));
                SQLHandler sq = new SQLHandler();
                sq.ExecuteNonQuery("dbo.sp_HtmlCommentDeleteByCommentID", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and returns HTML comments by HTMLCommentID
        /// </summary>
        /// <param name="PortalID">portalID</param>
        /// <param name="HTMLCommentID">HTMLCommentID</param>
        /// <returns>Returns HTML Comments</returns>
        public HTMLContentInfo HtmlCommentGetByHTMLCommentID(int PortalID, int HTMLCommentID)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLCommentID", HTMLCommentID));
                SQLHandler sq = new SQLHandler();
                return sq.ExecuteAsObject<HTMLContentInfo>("dbo.sp_HtmlCommentGetByHTMLCommentID", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and adds html comment
        /// </summary>
        /// <param name="HTMLTextID">HTMLTextID</param>
        /// <param name="Comment">Comment</param>
        /// <param name="IsApproved">Set true if the html comment is approve</param>
        /// <param name="IsActive">Set true if the html comment is active</param>
        /// <param name="AddedOn">Added Date</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="AddedBy">Added by</param>
        public void HtmlCommentAdd(string HTMLTextID, string Comment, bool IsApproved, bool IsActive, DateTime AddedOn, int PortalID, string AddedBy)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLTextID", HTMLTextID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Comment", Comment));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsApproved", IsApproved));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", IsActive));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedOn", AddedOn));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedBy", AddedBy));
                SQLHandler sq = new SQLHandler();
                sq.ExecuteNonQuery("dbo.sp_HtmlCommentAdd", ParaMeterCollection, "@HTMLCommentID");
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and updates html comment.
        /// </summary>
        /// <param name="HTMLCommentID">HTMLCommentID</param>
        /// <param name="Comment">Comment</param>
        /// <param name="IsApproved">Set true if the comment is approved</param>
        /// <param name="IsActive">Set true if the comment is active</param>
        /// <param name="IsModified">Set true if the  comment is modified</param>
        /// <param name="UpdatedOn">Date on which the comment is updated</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="UpdatedBy">Updated user's name</param>
        public void HtmlCommentUpdate(object HTMLCommentID, string Comment, bool IsApproved, bool IsActive, bool IsModified, DateTime UpdatedOn, int PortalID, string UpdatedBy)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@HTMLCommentID", HTMLCommentID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Comment", Comment));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsApproved", IsApproved));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", IsActive));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsModified", IsModified));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UpdatedOn", UpdatedOn));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UpdatedBy", UpdatedBy));
                SQLHandler sq = new SQLHandler();
                sq.ExecuteNonQuery("dbo.sp_HtmlCommentUpdate", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and checks if the user is authentcate to edit HTML
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="Username">userName</param>
        /// <param name="PortalID">portalID</param>
        /// <returns>returns true if the user has permission to edit</returns>
        public bool IsAuthenticatedToEdit(int UserModuleID, string Username, int PortalID)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PermissionKey", "EDIT"));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", UserModuleID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", Username));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                SQLHandler sagesql = new SQLHandler();
                return sagesql.ExecuteAsScalar<bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection);
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and returns the HTML content  for given portal , username and culture
        /// </summary>
        /// <param name="PortalID">portalID</param>
        /// <param name="UsermoduleID">usermoduleID</param>
        /// <param name="CultureName">Culturename</param>
        /// <returns>returns HTMLContentInfo object</returns>
        public HTMLContentInfo GetHTMLContent(int PortalID, int UsermoduleID, string CultureName)
        {
            try
            {
                List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@UsermoduleID", UsermoduleID));
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@CultureName", CultureName));
                SQLHandler sagesql = new SQLHandler();
                HTMLContentInfo objHtmlInfo = sagesql.ExecuteAsObject<HTMLContentInfo>("dbo.sp_HtmlTextGetByPortalAndUserModule", ParaMeterCollection);
                return objHtmlInfo;
            }
            catch (Exception e)
            {
                throw e;
            }
        }

        /// <summary>
        /// Connects to database and add folder for given object of Folder class.
        /// </summary>
        /// <param name="folder">Object of Folder class.</param>
        public static void AddFolder(Folder folder)
        {
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalId", folder.PortalId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@ParentFolderID", folder.ParentID));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@FolderPath", folder.FolderPath));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@StorageLocation", folder.StorageLocation));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@UniqueId", folder.UniqueId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@VersionGuid", folder.VersionGuid));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", folder.IsActive));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedBy", folder.AddedBy));
            SQLHandler sagesql = new SQLHandler();
            sagesql.ExecuteNonQuery("usp_FileManagerAddFolder", ParaMeterCollection);

        }
        /// <summary>
        /// Connects to database and add root folder for given object of Folder class.
        /// </summary>
        /// <param name="folder">Object of Folder class.</param>
        public static void AddRootFolder(Folder folder)
        {
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalId", folder.PortalId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@FolderPath", folder.FolderPath));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@StorageLocation", folder.StorageLocation));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@UniqueId", folder.UniqueId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@VersionGuid", folder.VersionGuid));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", folder.IsActive));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedBy", folder.AddedBy));
            SQLHandler sagesql = new SQLHandler();
            sagesql.ExecuteNonQuery("usp_FileManagerAddRootFolder", ParaMeterCollection);
        }

        /// <summary>
        /// Connects to database and inserts folder and returns its ID.
        /// </summary>
        /// <param name="folder">Object of Folder Class.</param>
        /// <returns>FolderID if the folder is inserted succesfully</returns>
        public static int AddFolderReturnFolderID(Folder folder)
        {
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalId", folder.PortalId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@ParentFolderID", folder.ParentID));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@FolderPath", folder.FolderPath));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@StorageLocation", folder.StorageLocation));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@UniqueId", folder.UniqueId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@VersionGuid", folder.VersionGuid));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", folder.IsActive));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedBy", folder.AddedBy));
            SQLHandler sagesql = new SQLHandler();
            int FolderID = sagesql.ExecuteNonQueryAsGivenType<int>("[usp_FileManagerAddFolderRetFolderID]", ParaMeterCollection, "@FolderID");

            return FolderID;

        }
        /// <summary>
        /// Connects to database and add file for given object of ATTFile class.
        /// </summary>
        /// <param name="file">Object of ATTFile class.</param>
        public static void AddFile(ATTFile file)
        {
            List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>();
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalId", file.PortalId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@UniqueId", file.UniqueId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@VersionGuid", file.VersionGuid));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@FileName", file.FileName));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@Extension", file.Extension));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@Size", file.Size));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@ContentType", file.ContentType));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@Folder", file.Folder));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@FolderId", file.FolderId));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@IsActive", file.IsActive));
            ParaMeterCollection.Add(new KeyValuePair<string, object>("@AddedBy", file.AddedBy));
            if (file.StorageLocation == 2)
            {
                ParaMeterCollection.Add(new KeyValuePair<string, object>("@Content", file.Content));
                SQLHandler sagesql = new SQLHandler();
                sagesql.ExecuteNonQuery("usp_FileManagerAddDatabaseFile", ParaMeterCollection);
            }
            else
            {
                SQLHandler sagesql = new SQLHandler();
                sagesql.ExecuteNonQuery("usp_FileManagerAddFile", ParaMeterCollection);

            }
        }
        /// <summary>
        /// Connects to database and obtains FolderId,FolderPath and StorageLocation.
        /// </summary>
        /// <returns>List of Folder class containing FolderId,FolderPath and StorageLocation.  </returns>
        public static List<Folder> GetFolders()
        {
            List<Folder> lstFolders = new List<Folder>();
            string StoredProcedureName = "usp_FileManagerGetFolders";
            SqlDataReader SQLReader = null;
            SQLHandler sagesql = new SQLHandler();
            try
            {

                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName);
                while (SQLReader.Read())
                {
                    Folder obj = new Folder();
                    obj.FolderId = int.Parse(SQLReader["FolderId"].ToString());
                    obj.FolderPath = SQLReader["FolderPath"].ToString();
                    obj.StorageLocation = int.Parse(SQLReader["StorageLocation"].ToString());
                    lstFolders.Add(obj);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (SQLReader != null)
                {
                    SQLReader.Close();
                }
            }


            return lstFolders;
        }
        /// <summary>
        /// Connnects to database and obtains root folders.
        /// </summary>
        /// <returns>List of Folder class containing FolderId,FolderPath,StorageLocation and IsActive.</returns>
        public static List<Folder> GetRootFolders()
        {
            List<Folder> lstFolders = new List<Folder>();
            string StoredProcedureName = "usp_FileManagerGetRootFolders";
            SqlDataReader SQLReader = null;
            try
            {

                SQLHandler sagesql = new SQLHandler();
                SQLReader = sagesql.ExecuteAsDataReader(StoredProcedureName);
                while (SQLReader.Read())
                {
                    Folder obj = new Folder();
                    obj.FolderId = int.Parse(SQLReader["FolderId"].ToString());
                    obj.FolderPath = SQLReader["FolderPath"].ToString();
                    obj.StorageLocation = int.Parse(SQLReader["StorageLocation"].ToString());
                    obj.IsEnabled = bool.Parse(SQLReader["IsActive"].ToString());
                    lstFolders.Add(obj);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (SQLReader != null)
                {
                    SQLReader.Close();
                }
            }
            return lstFolders;
        }


        /// <summary>
        /// Creates the list of rootships to chose from
        /// </summary>
        public void Root_Ship_List ()
        {
            for ( ShipType ship = 0; ship <= ShipType.ColonyShip; ship++ )
            {
                SetParamaters_RootShipSelection_CheckBox.Items.Add ( ShipCollection.ShipsInCollection [(int) ship].Name );
            }
        }

        /// <summary>
        /// When the text is changed inside a textbox
        /// </summary>
        /// <param name="_sender">The textbox</param>
        /// <param name="_e">The event</param>
        public void On_Text_Changed ( object _sender, EventArgs _e )
        {
            TextBox textBox = (TextBox) _sender;

            //  If the value of the textbox is not an integer replace it with a zero
            if ( !int.TryParse ( textBox.Text, out int value ) && textBox.Text != "" )
            {
                textBox.Text = "0";
            }

            //  if the value of the textbox is not empty proceed to create the balance object
            if ( textBox.Text != "" && SetParamaters_RootShipSelection_CheckBox.SelectedItems.Count != 0 )
            {

                #region Test Fleet values
                Fleet fleet = new Fleet ( "Test Fleet" );
                fleet.Add_ship ( ShipType.LightFighter, 500 );
                fleet.Add_ship ( ShipType.Cruiser, 500 );
                #endregion



                Fleet balance = new Balance ( int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.SmallCargoShip ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.LargeCargoShip ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.LightFighter ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.HeavyFighter ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Cruiser ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Battleship ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Battlecruiser ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Destroyer ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Deathstar ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Bomber ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.Recycler ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.EspionageProbe ).Text ), int.Parse ( ParameterCollection.Get_Parameters ( "Balance_Parameters" ).Get_ParameterBox ( ShipType.ColonyShip ).Text ) ).Calculate_Balance ( Create_Fleet (), (ShipType) SetParamaters_RootShipSelection_CheckBox.SelectedIndex );
                FleetCost__MetalAmount_TextBox.Text = balance.Total_Fleet_Cost ().MetalCost.ToString ();
                FleetCost_CrystalAmount_TextBox.Text = balance.Total_Fleet_Cost ().CrystalCost.ToString ();
                FleetCost_DeuteriumAmount_TextBox.Text = balance.Total_Fleet_Cost ().DeuteriumCost.ToString ();

                Make_Balanced_Fleet (balance);

                //MessageBox.Show ( balance.Format_To_Console () );
            }
        }

        private Fleet Create_Fleet ()
        {
            Fleet fleet = new Fleet ( "New Flet" );

            for ( ShipType type = 0; type <= ShipType.ColonyShip; type++ )
            {
                fleet.Add_ship ( type, int.Parse ( ParameterCollection.Get_Parameters ( "Fleet_Parameters" ).Get_ParameterBox ( type ).Text ) );
            }

            return fleet;

        }

        private void Make_Balanced_Fleet ( Fleet fleet )
        {
            for ( ShipType type = 0; type <= ShipType.ColonyShip; type++ )
            {
                ParameterCollection.Get_Parameters ( "Balanced_Fleet" ).Get_ParameterBox ( type ).Text = fleet.Ships [(int) type].ToString ();
            }
        }

        /// <summary>
        /// When the textbox has ben focused
        /// </summary>
        /// <param name="_sender">THe textbox</param>
        /// <param name="_e">THe event</param>
        public void On_Focus ( object _sender, EventArgs _e )
        {
            TextBox textBox = (TextBox) _sender;

            //  If the value of the textbox is 0 on focus empty the textbox
            if ( textBox.Text == "0" )
            {
                textBox.Text = "";
            }

        }

        /// <summary>
        /// When the textbox is no longer in focus
        /// </summary>
        /// <param name="_sender">THe textbox</param>
        /// <param name="_e">The event</param>
        public void On_Unfocus ( object _sender, EventArgs _e )
        {
            TextBox textbox = (TextBox) _sender;

            //  If the value of the textbox is less or equal to zero when unfocused replace the empty string with a zero
            if ( textbox.Text.Length <= 0 )
            {
                textbox.Text = "0";
            }

        }

Exceptionless.Models.ParameterCollection : IList

Constructors :

public ParameterCollection()

Methods :

public Int32 get_Count()
public Parameter get_Item(Int32 index = )
public Void set_Item(Int32 index = , Parameter value = )
public Void Add(Parameter item = )
public Void Clear()
public Void CopyTo(Parameter[] array = , Int32 index = )
public Boolean Contains(Parameter item = )
public IEnumerator<Parameter> GetEnumerator()
public Int32 IndexOf(Parameter item = )
public Void Insert(Int32 index = , Parameter item = )
public Boolean Remove(Parameter item = )
public Void RemoveAt(Int32 index = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()