Beispiel #1
0
        public SigmaResultType AddSigmaMsg(TypeSigmaMsg objSigmaMsg)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@MsgStr", objSigmaMsg.MsgStr));
            paramList.Add(new SqlParameter("@CreatedBy", objSigmaMsg.CreatedBy));
            SqlParameter outParam = new SqlParameter("@NewId", SqlDbType.Int);
            outParam.Direction = ParameterDirection.Output;
            paramList.Add(outParam);

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "usp_AddSigmaMsg", paramList.ToArray());
                result.IsSuccessful = true;
                result.ScalarValue = (int)outParam.Value;
                scope.Complete();

            }

            return result;
        }
Beispiel #2
0
        public SigmaResultType UpdateSigmaMsg(TypeSigmaMsg objSigmaMsg)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@MsgStr", objSigmaMsg.MsgStr),
                    new SqlParameter("@CreatedBy", objSigmaMsg.CreatedBy),
                    new SqlParameter("@UpdatedBy", objSigmaMsg.UpdatedBy),
                };

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateSigmaMsg", parameters);
                result.IsSuccessful = true;
                scope.Complete();

            }

            return result;
        }