Esempio n. 1
0
        private SqlParameter[] GetSqlParameters(SqlParamtersType type, int id = 0)
        {
            var sqlParameters = new List <SqlParameter>()
            {
                new SqlParameter("@prescriptionid", DbType.Int32)
                {
                    Value = (object)PrescriptionID ?? DBNull.Value
                },
                new SqlParameter("@medicineid", DbType.Int32)
                {
                    Value = MedicineID
                },
                new SqlParameter("@date", DbType.DateTime)
                {
                    Value = Date
                },
                new SqlParameter("@amount", DbType.Decimal)
                {
                    Value = Amount
                },
            };

            if (type == SqlParamtersType.AllWithIdValue)
            {
                sqlParameters.Add(new SqlParameter("@id", DbType.Int32)
                {
                    Value = id
                });
                return(sqlParameters.ToArray());
            }

            if (type == SqlParamtersType.OnlyIdWithValue)
            {
                return(new SqlParameter[] { new SqlParameter("@id", DbType.Int32)
                                            {
                                                Value = id
                                            } });
            }

            //SqlParamtersType.AllWithoutId;
            return(sqlParameters.ToArray());
        }
Esempio n. 2
0
        private SqlParameter[] GetSqlParameters(SqlParamtersType type, int id = 0)
        {
            var sqlParameters = new List <SqlParameter>()
            {
                new SqlParameter("@customername", DbType.String)
                {
                    Value = CustomerName
                },
                new SqlParameter("@pesel", DbType.String)
                {
                    Value = PESEL
                },
                new SqlParameter("@prescriptionnumber", DbType.String)
                {
                    Value = PrescriptionNumber
                },
            };

            if (type == SqlParamtersType.AllWithIdValue)
            {
                sqlParameters.Add(new SqlParameter("@id", DbType.Int32)
                {
                    Value = id
                });
                return(sqlParameters.ToArray());
            }

            if (type == SqlParamtersType.OnlyIdWithValue)
            {
                return(new SqlParameter[] { new SqlParameter("@id", DbType.Int32)
                                            {
                                                Value = id
                                            } });
            }

            //SqlParamtersType.AllWithoutId;
            return(sqlParameters.ToArray());
        }