示例#1
0
 /// <summary>
 /// This method is used to save Current Position
 /// </summary>
 /// <returns></returns>
 public OperationStatus SaveMyCurrentPosition(TrackMyPositionCustomModel model)
 {
     using (objDAL = new TrackMyPositionRepo())
     {
         return(objDAL.SaveMyCurrentPosition(model));
     }
 }
示例#2
0
 /// <summary>
 /// This method is used to fetch Current Position
 /// </summary>
 /// <returns>all position</returns>
 public object GetMyAllPosition(TrackMyPositionCustomModel model)
 {
     using (objDAL = new TrackMyPositionRepo())
     {
         return(objDAL.GetMyAllPosition(model));
     }
 }
        public object GetMyCurrentPosition(TrackMyPositionCustomModel model)
        {
            List <TrackMyPositionCustomModel> PositionListModel = new List <TrackMyPositionCustomModel>();

            using (response = new Response())
            {
                using (dbcontext = new AlertBackEntities())
                {
                    try
                    {
                        response.success = true;
                        var rs = dbcontext.tblTrackMyPositions.Where(x => x.IsDeleted == false &&
                                                                     x.MemberId == model.MemberId
                                                                     )
                                 .Select(x => new TrackMyPositionCustomModel
                        {
                            Id          = x.Id,
                            MemberId    = x.MemberId,
                            MemberName  = x.tblMember != null ? x.tblMember.Name : "",
                            Title       = x.Title,
                            Description = x.Description,
                            Image       = x.Image,
                            DDate       = x.DDate,
                            Longitude   = x.Longitude,
                            Latitude    = x.Latitude,
                            Place       = x.Place,

                            IsActive     = x.IsActive,
                            IsDeleted    = x.IsDeleted,
                            CreatedBy    = x.CreatedBy,
                            CreatedDate  = x.CreatedDate,
                            ModifiedBy   = x.ModifiedBy,
                            ModifiedDate = x.ModifiedDate
                        }).OrderByDescending(x => x.Id).FirstOrDefault();

                        return(rs);
                    }
                    catch (Exception ex)
                    {
                        response.success = false;
                        response.message = ex.Message;
                        return(response);
                    }
                }
            }
        }
        public OperationStatus SaveMyCurrentPosition(TrackMyPositionCustomModel model)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new AlertBackEntities())
                {
                    if (model.Id == 0)
                    {
                        tblTrackMyPosition _addMyPosition = new tblTrackMyPosition
                        {
                            MemberId    = model.MemberId,
                            Title       = model.Title,
                            Description = model.Description,
                            Image       = model.Image,
                            DDate       = model.DDate,
                            Longitude   = model.Longitude,
                            Latitude    = model.Latitude,
                            Place       = model.Place,

                            IsActive     = true,
                            IsDeleted    = false,
                            CreatedDate  = DateTime.Now,
                            CreatedBy    = model.CreatedBy,
                            ModifiedDate = DateTime.Now,
                            ModifiedBy   = model.ModifiedBy
                        };
                        dbcontext.tblTrackMyPositions.Add(_addMyPosition);
                        dbcontext.SaveChanges();
                        status = OperationStatus.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
        public Response GetMyAllPosition(TrackMyPositionCustomModel model)
        {
            _response = new Response();
            TrackMyPositionBusiness objBDS = new TrackMyPositionBusiness();

            try
            {
                _response.responseData = objBDS.GetMyAllPosition(model);
                _response.message      = "Records loaded successfully !!";
                _response.success      = true;
            }
            catch (Exception ex)
            {
                _response.success = false;
                _response.message = ex.Message.ToString();
            }
            finally
            {
                objBDS = null;
            }
            return(_response);
        }