Пример #1
0
        public DataSet CreateUser(SignUpRequest request)
        {
            var cmd = new OracleCommand
            {
                Connection  = _conn,
                CommandText = "CreateUser"
            };
            var param1 = _infraDal.GetParameter("ID", OracleDbType.Varchar2, request.Id);
            var param2 = _infraDal.GetParameter("NAME", OracleDbType.Varchar2, request.Name);

            cmd.Parameters.Add(param1);
            cmd.Parameters.Add(param2);
            return(_infraDal.ExecSpQuery(cmd));
        }
        public DataSet CreateLiveWatchDoc(CreateLiveWatchDocRequest request)
        {
            var cmd = new OracleCommand
            {
                Connection  = _conn,
                CommandText = "CreateLiveWatchDoc"
            };
            var param1 = _infraDal.GetParameter("Doc", OracleDbType.Varchar2, request.DocId);
            var param2 = _infraDal.GetParameter("User", OracleDbType.Varchar2, request.UserId);

            cmd.Parameters.Add(param1);
            cmd.Parameters.Add(param2);
            return(_infraDal.ExecSpQuery(cmd));
        }
        public DocumentResponse GetDocument(Guid docID)
        {
            DocumentResponse retval = default;

            try
            {
                var param   = _SQLDAL.GetParameter("DocID", docID);
                var dataset = _SQLDAL.ExecSPQuery("GetDocument", con, param);
                if (dataset.Tables[0].Rows.Count != 0)
                {
                    retval = new DocumentResponse()
                    {
                        documentDTO = new List <DocumentDTO>()
                    };
                    retval.documentDTO.Add(new DocumentDTO()
                    {
                        DocID    = dataset.Tables[0].Rows[0].Field <Guid>("DocID"),
                        DocName  = dataset.Tables[0].Rows[0].Field <string>("DocName"),
                        ImageURL = dataset.Tables[0].Rows[0].Field <string>("ImageURL"),
                        UserID   = dataset.Tables[0].Rows[0].Field <string>("UserId")
                    });
                }
            }
            catch (Exception e)
            {
                //log
            }

            return(retval);
        }
        public IDBParameter ConvertToParameter(object dto, string parameterName)
        {
            IDBParameter retval = null;

            foreach (var property in dto.GetType().GetProperties())
            {
                var attribute = property.GetCustomAttribute <DBParameterAttribute>();
                if (attribute != null)//This property is a parameter
                {
                    if (attribute.ParameterName.Equals(parameterName))
                    {
                        var paramValue = property.GetValue(dto);
                        ///Create Parameter
                        retval = _dal.GetParameter(parameterName, paramValue);
                        break;
                    }
                }
            }
            return(retval);
        }
Пример #5
0
        public bool CreateUser(SignUpRequest request)
        {
            var email    = _infraDal.GetParameter("P_EMAIL", request.Login.Email);
            var username = _infraDal.GetParameter("P_USER_NAME", request.Login.Username);

            try
            {
                _infraDal.ExecuteSpQuery(_connection, "CREATE_USER", email, username);
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Пример #6
0
        public DataSet GetCoursesByFoodId(int id)
        {
            var cmd = new MySqlCommand
            {
                Connection  = _conn,
                CommandText = "getCoursesByFoodId"
            };
            var param = _infraDal.GetParameter("p_id", MySqlDbType.Int32, id);

            cmd.Parameters.Add(param);
            return(_infraDal.ExecSpQuery(cmd));
        }
Пример #7
0
        public DataSet CreateMarker(CreateMarkerRequest request)
        {
            var cmd = new OracleCommand
            {
                Connection  = _conn,
                CommandText = "CreateMarker"
            };
            var param1  = _infraDal.GetParameter("DocId", OracleDbType.Varchar2, request.Marker.DocId);
            var param2  = _infraDal.GetParameter("OutMarkerId", OracleDbType.Varchar2, request.Marker.MarkerId);
            var param3  = _infraDal.GetParameter("MarkerType", OracleDbType.Varchar2, request.Marker.MarkerType);
            var param4  = _infraDal.GetParameter("ForColor", OracleDbType.Varchar2, request.Marker.ForColor);
            var param5  = _infraDal.GetParameter("BackColor", OracleDbType.Varchar2, request.Marker.BackColor);
            var param6  = _infraDal.GetParameter("UserId", OracleDbType.Varchar2, request.Marker.UserId);
            var param7  = _infraDal.GetParameter("LocationX", OracleDbType.Double, request.Marker.LocationX);
            var param8  = _infraDal.GetParameter("LocationY", OracleDbType.Double, request.Marker.LocationY);
            var param9  = _infraDal.GetParameter("Width", OracleDbType.Double, request.Marker.Width);
            var param10 = _infraDal.GetParameter("Height", OracleDbType.Double, request.Marker.Height);

            cmd.Parameters.Add(param1);
            cmd.Parameters.Add(param2);
            cmd.Parameters.Add(param3);
            cmd.Parameters.Add(param4);
            cmd.Parameters.Add(param5);
            cmd.Parameters.Add(param6);
            cmd.Parameters.Add(param7);
            cmd.Parameters.Add(param8);
            cmd.Parameters.Add(param9);
            cmd.Parameters.Add(param10);
            return(_infraDal.ExecSpQuery(cmd));
        }
Пример #8
0
        public DataSet AddDocument(AddDocumentRequest request, string docId)
        {
            var cmd = new OracleCommand
            {
                Connection  = _conn,
                CommandText = "AddDocument "
            };
            var param1 = _infraDal.GetParameter("OwnerID", OracleDbType.Varchar2, request.Owner);
            var param2 = _infraDal.GetParameter("ImageUrl", OracleDbType.Varchar2, request.ImageUrl);
            var param3 = _infraDal.GetParameter("DocumentName", OracleDbType.Varchar2, request.DocumentName);
            var param4 = _infraDal.GetParameter("DocId", OracleDbType.Varchar2, docId);

            cmd.Parameters.Add(param1);
            cmd.Parameters.Add(param2);
            cmd.Parameters.Add(param3);
            cmd.Parameters.Add(param4);
            return(_infraDal.ExecSpQuery(cmd));
        }