/// <summary>
        ///     Inserts a record into the ReportingParty table on the database.
        /// </summary>
        /// <param name="name" />
        /// <param name="email" />
        /// <param name="phone" />
        /// <param name="phoneTypeId" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetInsertDbCommand(string name, string email, string phone, int?phoneTypeId)
        {
            var command = new SqlCommand("ReportingParty_Insert");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Name", SqlDbType.NVarChar, name));
            if (!string.IsNullOrEmpty(email))
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Email", SqlDbType.NVarChar, email));
            }
            else
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Email", SqlDbType.NVarChar, null));
            }
            if (!string.IsNullOrEmpty(phone))
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@phone", SqlDbType.NVarChar, phone));
            }
            else
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@phone", SqlDbType.NVarChar, null));
            }
            if (phoneTypeId != null)
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@phoneTypeId", SqlDbType.Int,
                                                                                phoneTypeId));
            }
            else
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@phoneTypeId", SqlDbType.Int, null));
            }

            command.Connection = (SqlConnection)ReportingPartyDbConnectionHolder.Connection;
            return(command);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Updates one or more records from the Complaint table
        /// </summary>
        /// <param name="complaintTypeId" />
        /// <param name="description" />
        /// <param name="locationDetails" />
        /// <param name="reportingPartyId" />
        /// <param name="id" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetUpdateDbCommand(int complaintTypeId, string description, string locationDetails,
                                             int reportingPartyId, int id)
        {
            var command = new SqlCommand("Complaint_Update");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@ComplaintTypeId", SqlDbType.Int,
                                                                            complaintTypeId));
            if (!string.IsNullOrEmpty(description))
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Description", SqlDbType.NVarChar,
                                                                                description));
            }
            else
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Description", SqlDbType.NVarChar, null));
            }
            if (!string.IsNullOrEmpty(locationDetails))
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@LocationDetails", SqlDbType.NVarChar,
                                                                                locationDetails));
            }
            else
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@LocationDetails", SqlDbType.NVarChar,
                                                                                null));
            }
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@ReportingPartyId", SqlDbType.Int,
                                                                            reportingPartyId));
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Id", SqlDbType.Int, id));
            command.Connection = (SqlConnection)ComplaintDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Deletes one or more records from the ComplaintType table
        /// </summary>
        /// <param name="id" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetDeleteDbCommand(int id)
        {
            var command = new SqlCommand("ComplaintType_Delete");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Id", SqlDbType.Int, id));
            command.Connection = (SqlConnection)ComplaintTypeDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Inserts a record into the PhoneType table on the database.
        /// </summary>
        /// <param name="name" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetInsertDbCommand(string name)
        {
            var command = new SqlCommand("PhoneType_Insert");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Name", SqlDbType.NVarChar, name));
            command.Connection = (SqlConnection)PhoneTypeDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Function  GetDataById returns a IDataReader for PhoneType
        /// </summary>
        /// <param name="id" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetGetDataByIdDbCommand(int id)
        {
            var command = new SqlCommand("PhoneType_GetDataById");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Id", SqlDbType.Int, id));
            command.Connection = (SqlConnection)PhoneTypeDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Function GetRowCount returns the row count for ReportingParty
        /// </summary>
        /// <param name="phoneTypeId" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetGetDataByPhoneTypeIdRowCountDbCommand(int phoneTypeId)
        {
            var command = new SqlCommand("ReportingParty_GetDataByPhoneTypeIdRowCount");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@phoneTypeId", SqlDbType.Int, phoneTypeId));
            command.Connection = (SqlConnection)ReportingPartyDbConnectionHolder.Connection;
            return(command);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Function GetDataByReportingPartyId returns a IDataReader for Complaint
        /// </summary>
        /// <param name="reportingPartyId" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetGetDataByReportingPartyIdDbCommand(int reportingPartyId)
        {
            var command = new SqlCommand("Complaint_GetDataByReportingPartyId");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@ReportingPartyId", SqlDbType.Int,
                                                                            reportingPartyId));
            command.Connection = (SqlConnection)ComplaintDbConnectionHolder.Connection;
            return(command);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Function GetRowCount returns the row count for Complaint
        /// </summary>
        /// <param name="complaintTypeId" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetGetDataByComplaintTypeIdRowCountDbCommand(int complaintTypeId)
        {
            var command = new SqlCommand("Complaint_GetDataByComplaintTypeIdRowCount");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@ComplaintTypeId", SqlDbType.Int,
                                                                            complaintTypeId));
            command.Connection = (SqlConnection)ComplaintDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Function GetDataPageable returns a IDataReader populated with a subset of data from ComplaintType
        /// </summary>
        /// <param name="sortExpression" />
        /// <param name="page" />
        /// <param name="pageSize" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetGetDataPageableDbCommand(string sortExpression, int page, int pageSize)
        {
            var command = new SqlCommand("ComplaintType_GetDataPageable");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@sortExpression", SqlDbType.VarChar,
                                                                            sortExpression));
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@page", SqlDbType.Int, page));
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@pageSize", SqlDbType.Int, pageSize));
            command.Connection = (SqlConnection)ComplaintTypeDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Search for ReportingParty
        /// </summary>
        /// <param name="searchValue" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetSearchDbCommand(string searchValue)
        {
            var command = new SqlCommand("ReportingParty_Search")
            {
                CommandType = CommandType.StoredProcedure
            };

            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@SearchValue", SqlDbType.VarChar,
                                                                            searchValue));
            command.Connection = (SqlConnection)ReportingPartyDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Function GetDataBy GetDataByPhoneTypeIdPageable returns a IDataReader populated with a subset of data from
        ///     ReportingParty
        /// </summary>
        /// <param name="phoneTypeId" />
        /// <param name="sortExpression" />
        /// <param name="page" />
        /// <param name="pageSize" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetGetDataByPhoneTypeIdPageableDbCommand(int phoneTypeId, string sortExpression, int page,
                                                                   int pageSize)
        {
            var command = new SqlCommand("ReportingParty_GetDataByPhoneTypeIdPageable");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@phoneTypeId", SqlDbType.Int, phoneTypeId));
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@sortExpression", SqlDbType.VarChar,
                                                                            sortExpression));
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@page", SqlDbType.Int, page));
            command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@pageSize", SqlDbType.Int, pageSize));
            command.Connection = (SqlConnection)ReportingPartyDbConnectionHolder.Connection;
            return(command);
        }
        /// <summary>
        ///     Inserts a record into the ComplaintType table on the database.
        /// </summary>
        /// <param name="name" />
        /// <returns></returns>
        /// <remarks></remarks>
        public IDbCommand GetInsertDbCommand(string name)
        {
            var command = new SqlCommand("ComplaintType_Insert");

            command.CommandType = CommandType.StoredProcedure;
            if (!string.IsNullOrEmpty(name))
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Name", SqlDbType.NVarChar, name));
            }
            else
            {
                command.Parameters.Add(SqlParameterFactory.CreateInputParameter("@Name", SqlDbType.NVarChar, null));
            }
            command.Connection = (SqlConnection)ComplaintTypeDbConnectionHolder.Connection;
            return(command);
        }