Esempio n. 1
0
        /// <summary>
        /// Adds a new parameter to the specified command.
        /// </summary>
        /// <param name="cmd">The <see cref="System.Data.SqlCommand"/> object to add the parameter to.</param>
        /// <param name="paramName">The name of the parameter.</param>
        /// <param name="value">The value of the parameter.</param>
        /// <returns>A reference to the added parameter.</returns>
        protected virtual SqlParameter AddParameter(SqlCommand cmd, string paramName, object value)
        {
            SqlParameter parameter;

            switch (paramName)
            {
            case "DoctorIDD":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "Name":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            case "Address":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            case "Phone":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            default:
                throw new ArgumentException("Unknown parameter name (" + paramName + ").");
            }
            return(parameter);
        }
        /// <summary>
        /// Adds a new parameter to the specified command.
        /// </summary>
        /// <param name="cmd">The <see cref="System.Data.SqlCommand"/> object to add the parameter to.</param>
        /// <param name="paramName">The name of the parameter.</param>
        /// <param name="value">The value of the parameter.</param>
        /// <returns>A reference to the added parameter.</returns>
        protected virtual SqlParameter AddParameter(SqlCommand cmd, string paramName, object value)
        {
            SqlParameter parameter;

            switch (paramName)
            {
            case "Id":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "PatientType":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "DoctorId":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "BedId":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "DateofVisit":
                parameter = _db.AddParameter(cmd, paramName, DbType.DateTime, value);
                break;

            case "DateofDischarge":
                parameter = _db.AddParameter(cmd, paramName, DbType.DateTime, value);
                break;

            case "Symptoms":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            case "Disease":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            case "Treatment":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            default:
                throw new ArgumentException("Unknown parameter name (" + paramName + ").");
            }
            return(parameter);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds a new parameter to the specified command.
        /// </summary>
        /// <param name="cmd">The <see cref="System.Data.SqlCommand"/> object to add the parameter to.</param>
        /// <param name="paramName">The name of the parameter.</param>
        /// <param name="value">The value of the parameter.</param>
        /// <returns>A reference to the added parameter.</returns>
        protected virtual SqlParameter AddParameter(SqlCommand cmd, string paramName, object value)
        {
            SqlParameter parameter;

            switch (paramName)
            {
            case "Id":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "Name":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            case "Address":
                parameter = _db.AddParameter(cmd, paramName, DbType.AnsiString, value);
                break;

            case "DateOfBirth":
                parameter = _db.AddParameter(cmd, paramName, DbType.DateTime, value);
                break;

            case "Phone":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "EmergencyContact":
                parameter = _db.AddParameter(cmd, paramName, DbType.Int32, value);
                break;

            case "DateOfRegistration":
                parameter = _db.AddParameter(cmd, paramName, DbType.DateTime, value);
                break;

            default:
                throw new ArgumentException("Unknown parameter name (" + paramName + ").");
            }
            return(parameter);
        }