Пример #1
0
        public async Task <List <Friends> > GetFriendsByUserIdAsync(int userId)
        {
            using (var con = new SqlConnection(_configuration["ConnectionString"]))
            {
                var sqlCmd = @$ "SELECT Id,
										UsuarioId,
                                        UsuarioAmigoId,
										Pendencia
                                FROM
										Amigos
                                WHERE
										UsuarioId='{userId}' and Pendencia=0;"                                        ;

                using (var cmd = new SqlCommand(sqlCmd, con))
                {
                    cmd.CommandType = CommandType.Text;
                    con.Open();

                    var reader = await cmd
                                 .ExecuteReaderAsync()
                                 .ConfigureAwait(false);

                    var userFriends = new List <Friends>();


                    while (reader.Read())
                    {
                        var friends = new Friends(int.Parse(reader["Id"].ToString()),
                                                  int.Parse(reader["UsuarioId"].ToString()),
                                                  int.Parse(reader["UsuarioAmigoId"].ToString()),
                                                  int.Parse(reader["Pendencia"].ToString()));

                        userFriends.Add(friends);
                    }

                    return(userFriends);
                }
            }
Пример #2
0
 public override NDArray Cos(in NDArray nd, Type dtype) => Cos(nd, dtype?.GetTypeCode());
Пример #3
0
 public override NDArray ASin(in NDArray nd, Type dtype) => ASin(nd, dtype?.GetTypeCode());
Пример #4
0
 public override NDArray Sqrt(in NDArray nd, Type dtype) => Sqrt(nd, dtype?.GetTypeCode());
Пример #5
0
 public override (NDArray Fractional, NDArray Intergral) ModF(in NDArray nd, Type dtype) => ModF(nd, dtype?.GetTypeCode());
Пример #6
0
 public override NDArray Log1p(in NDArray nd, Type dtype) => Log10(nd, dtype?.GetTypeCode());
        public async Task <List <NBRoomNumberandShortFormDto> > GetShortForm(string date, string session)
        {
            var roomnumbers = await this.GetRoomNumber(date, session);

            List <NBRoomNumberandShortFormDto> NBRoomNumberandShortFormList = new List <NBRoomNumberandShortFormDto>();

            foreach (var roomnumber in roomnumbers)
            {
                List <string> ShortForm    = new List <string>();
                List <int>    Countlist    = new List <int>();
                List <string> SubjectCodes = new List <string>();

                using (var command = _context.Database.GetDbConnection().CreateCommand())
                {
                    command.CommandText = @$ "select ShortForm,SubjectCode,Count(s.SeatingId) as Count from seatings
                                        join seatingexams s on seatings.Id = s.SeatingId
                                        join exams e on s.ExamId = e.Id
                                        join seatingrooms s2 on s.SeatingId = s2.SeatingId
                                        join rooms r on s2.RoomId = r.Id
                                        join roomexams r2 on s.ExamId = r2.ExamId and s2.RoomId = r2.RoomId
                                        join departments d2 on seatings.DepartmentId = d2.Id
                                        where e.Date = '{date}' AND e.Session = '{session}' and RoomNumber = '{roomnumber}'
Пример #8
0
 public override NDArray Exp2(in NDArray nd, Type dtype) => Exp2(nd, dtype?.GetTypeCode());
Пример #9
0
 public override NDArray Floor(in NDArray nd, Type dtype) => Floor(nd, dtype?.GetTypeCode());
Пример #10
0
 public override NDArray Tanh(in NDArray nd, Type dtype) => Tanh(nd, dtype?.GetTypeCode());
Пример #11
0
 public override NDArray Round(in NDArray nd, Type dtype) => Round(nd, dtype?.GetTypeCode());
Пример #12
0
 return(AMin(nd, axis, dtype != null ? dtype.GetTypeCode() : default(NPTypeCode?), keepdims));
Пример #13
0
        private way ConvertFeatureToOSMWay(IFeature currentFeature, IWorkspace featureWorkspace, IFeatureClass pointFeatureClass, int osmIDPointFieldIndex, int tagsFieldIndex, int osmIDFieldIndex, int changesetIDFieldIndex, int osmVersionFieldIndex, int userIDFieldIndex, int userNameFieldIndex, int timeStampFieldIndex, int visibleFieldIndex, int extensionVersion)
        {

            if (currentFeature == null)
                throw new ArgumentNullException("currentFeature");

            way osmWay = new way();
            object featureValue = DBNull.Value;

            List<nd> vertexIDs = new List<nd>();

            if (currentFeature.Shape.IsEmpty == false)
            {
                IPointCollection pointCollection = currentFeature.Shape as IPointCollection;

                if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
                {
                    for (int pointIndex = 0; pointIndex < pointCollection.PointCount - 1; pointIndex++)
                    {
                        nd vertex = new nd();
                        vertex.@ref = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDPointFieldIndex, extensionVersion, pointCollection.get_Point(pointIndex));
                        vertexIDs.Add(vertex);
                    }

                    // the last node is the first one again even though it doesn't have an internal ID
                    nd lastVertex = new nd();
                    lastVertex.@ref = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDPointFieldIndex, extensionVersion, pointCollection.get_Point(0));
                    vertexIDs.Add(lastVertex);

                }
                else
                {
                    for (int pointIndex = 0; pointIndex < pointCollection.PointCount; pointIndex++)
                    {
                        nd vertex = new nd();
                        vertex.@ref = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDPointFieldIndex, extensionVersion, pointCollection.get_Point(pointIndex));
                        vertexIDs.Add(vertex);
                    }
                }

                osmWay.nd = vertexIDs.ToArray();
            }

            if (osmIDFieldIndex != -1)
            {
                osmWay.id = Convert.ToString(currentFeature.get_Value(osmIDFieldIndex));
            }

            if (changesetIDFieldIndex != -1)
            {
                featureValue = currentFeature.get_Value(changesetIDFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmWay.changeset = Convert.ToString(currentFeature.get_Value(changesetIDFieldIndex));
                }
            }

            if (osmVersionFieldIndex != -1)
            {
                featureValue = currentFeature.get_Value(osmVersionFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmWay.version = Convert.ToString(featureValue);
                }
            }

            if (userIDFieldIndex != -1)
            {
                featureValue = currentFeature.get_Value(userIDFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmWay.uid = Convert.ToString(featureValue);
                }
            }

            if (userNameFieldIndex != -1)
            {
                featureValue = currentFeature.get_Value(userNameFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmWay.user = Convert.ToString(featureValue);
                }
            }

            if (timeStampFieldIndex != -1)
            {
                featureValue = currentFeature.get_Value(timeStampFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    osmWay.timestamp = Convert.ToDateTime(featureValue).ToUniversalTime().ToString("u");
                }
            }

            if (visibleFieldIndex != -1)
            {
                featureValue = currentFeature.get_Value(visibleFieldIndex);

                if (featureValue != DBNull.Value)
                {
                    try
                    {
                        osmWay.visible = (wayVisible)Enum.Parse(typeof(wayVisible), Convert.ToString(featureValue));
                    }
                    catch
                    {
                        osmWay.visible = wayVisible.@true;
                    }
                }
            }

            if (tagsFieldIndex > -1)
            {
                tag[] tags = null;
                tags = _osmUtility.retrieveOSMTags((IRow)currentFeature, tagsFieldIndex, featureWorkspace);

                if (tags.Length != 0)
                {
                    osmWay.tag = tags;
                }
            }

            return osmWay;
        }
Пример #14
0
 public NPTypeCode ResolveUnaryReturnType(in NDArray nd, Type @override) => ResolveUnaryReturnType(nd, @override?.GetTypeCode());