Esempio n. 1
0
        public static MUserResponse ResponseMapping(MUser entity)
        {
            if (entity == null)
            {
                return(null);
            }
            var response = new MUserResponse();

            response.Id                = entity.Id;
            response.Username          = entity.Username;
            response.IdNumber          = entity.IdNumber;
            response.IdType            = entity.Type?.DescType;
            response.Name              = entity.Name;
            response.Email             = entity.Email;
            response.Address           = entity.Address;
            response.AddressKoordinat  = entity.AddressKoordinat;
            response.Occupation        = entity.Occupation;
            response.Handphone         = entity.Handphone;
            response.JobTitle          = entity.JobTitle;
            response.CompanyCoordinate = entity.Company?.AddressKoordinat;
            response.CompanyFixedCall  = entity.Company?.FixedCall;
            response.CompanyAddress    = entity.Company?.Address;
            response.CompanyName       = entity.Company?.CompanyName;
            response.CompanyId         = entity.Company?.Id;
            response.HoldingName       = entity.Company?.Holding.HoldingName;
            response.HoldingId         = entity.Company?.Holding.Id;
            response.Image             = entity.Image;
            response.ProvinsiId        = entity.ProvinsiId;
            response.KabKotaId         = entity.KabKotaId;
            return(response);
        }
Esempio n. 2
0
        public static MUserResponse FromData(MUser entity)
        {
            if (entity == null)
            {
                return(null);
            }
            var response = new MUserResponse()
            {
                Id                = entity.Id,
                Username          = entity.Username,
                IdNumber          = entity.IdNumber,
                IdType            = entity.Type.DescType,
                Name              = entity.Name,
                Email             = entity.Email,
                Address           = entity.Address,
                AddressKoordinat  = entity.AddressKoordinat,
                Occupation        = entity.Occupation,
                Handphone         = entity.Handphone,
                JobTitle          = entity.JobTitle,
                CompanyCoordinate = entity.Company.AddressKoordinat,
                CompanyFixedCall  = entity.Company.FixedCall,
                CompanyAddress    = entity.Company.Address,
                CompanyName       = entity.Company.CompanyName,
                CompanyId         = entity.Company.Id,
                HoldingName       = entity.Company.Holding.HoldingName,
                HoldingId         = entity.Company.Holding.Id,
            };

            return(response);
        }
Esempio n. 3
0
        public static LoginResponse FromData(MUser entity)
        {
            if (entity == null)
            {
                return(null);
            }
            var response = new LoginResponse()
            {
                Id          = entity.Id,
                Username    = entity.Username,
                IdNumber    = entity.IdNumber,
                Name        = entity.Name,
                Email       = entity.Email,
                Image       = entity.Image,
                PhoneNumber = entity.Handphone
            };

            if (entity.IdRole == 1)
            {
                response.Role = "Customer";
            }
            else if (entity.IdRole == 2)
            {
                response.Role      = "Supplier";
                response.CompanyId = entity.Company?.Id;
                response.HoldingId = entity.Company?.Holding.Id;
            }
            else if (entity.IdRole == 3)
            {
                response.Role = "Administrator";
            }
            return(response);
        }
Esempio n. 4
0
 public ActiveCustomer(MUser user, List <Interaction> interactions)
 {
     Name             = user.Name;
     TotalLike        = interactions.Count(x => x.IsLike == true && x.LikedBy == user.Id);
     TotalChat        = interactions.Count(x => x.IsChat == true && x.ChatBy == user.Id);
     TotalComment     = interactions.Count(x => x.IsComment == true && x.CommentBy == user.Id);
     TotalView        = interactions.Count(x => x.IsViewed == true && x.ViewedBy == user.Id);
     TotalInteraction = TotalChat + TotalComment + TotalLike;
 }
Esempio n. 5
0
 public AppointmentResponse(Appointment appointment, MUser user)
 {
     this.Id = appointment.Id;
     // this.MakerName = appointment.Maker.Name;
     // this.RecepientName = appointment.Recepient.Name;
     this.UserName    = user.Name;
     this.ProductName = appointment.Product.ProductName;
     this.Status      = appointment.Status;
     this.Date        = appointment.Date;
 }
Esempio n. 6
0
 public static MUser UpdatedUserMapping(MUser oldUser, MUser updateUser)
 {
     oldUser.Address          = updateUser.Address;
     oldUser.AddressKoordinat = updateUser.AddressKoordinat;
     oldUser.CompanyId        = updateUser.CompanyId;
     oldUser.JobTitle         = updateUser.JobTitle;
     oldUser.Occupation       = updateUser.Occupation;
     oldUser.ProvinsiId       = updateUser.ProvinsiId;
     oldUser.KabKotaId        = updateUser.KabKotaId;
     return(oldUser);
 }
 public ProductContact(MUser user)
 {
     Id               = user.Id;
     Name             = user.Name;
     Email            = user.Email;
     JobTitle         = user.JobTitle;
     Occupation       = user.Occupation;
     Handphone        = user.Handphone;
     Address          = user.Address;
     Image            = user.Image;
     AddressKoordinat = user.AddressKoordinat;
 }
Esempio n. 8
0
        public static ProductContact FromData(MUser user)
        {
            var productContact = new ProductContact()
            {
                Name       = user.Name,
                Email      = user.Email,
                JobTitle   = user.JobTitle,
                Occupation = user.Occupation,
                Handphone  = user.Handphone,
                Address    = user.Address,
                Foto       = "",
            };

            return(productContact);
        }
Esempio n. 9
0
        public static MUser RegisterMapping(RegisterRequest registerRequest)
        {
            var user = new MUser()
            {
                Username         = registerRequest.Username,
                Password         = registerRequest.Password,
                IdNumber         = registerRequest.IdNumber,
                IdType           = registerRequest.IdType,
                Name             = registerRequest.Name,
                Email            = registerRequest.Email,
                Address          = registerRequest.Address,
                AddressKoordinat = registerRequest.AddressKoordinat,
                Occupation       = registerRequest.Occupation,
                Handphone        = registerRequest.Handphone,
                JobTitle         = registerRequest.JobTitle,
                CompanyId        = registerRequest.CompanyId,
            };

            return(user);
        }
        public static RegisterResponse ResponseMapping(MUser entity)
        {
            if (entity == null)
            {
                return(null);
            }
            var response = new RegisterResponse()
            {
                Id               = entity.Id,
                Username         = entity.Username,
                IdNumber         = entity.IdNumber,
                IdType           = entity.Type.DescType,
                Name             = entity.Name,
                Email            = entity.Email,
                Address          = entity.Address,
                AddressKoordinat = entity.AddressKoordinat,
                Occupation       = entity.Occupation,
                Handphone        = entity.Handphone,
                JobTitle         = entity.JobTitle,
                CompanyName      = entity.Company.CompanyName
            };

            return(response);
        }
Esempio n. 11
0
        // public string HoldingName { get; set; }

        public static LoginResponse FromData(MUser entity)
        {
            if (entity == null)
            {
                return(null);
            }
            var response = new LoginResponse();

            response.Id       = entity.Id;
            response.Username = entity.Username;
            response.IdNumber = entity.IdNumber;
            // response.IdType = entity.Type.DescType;
            response.Name  = entity.Name;
            response.Email = entity.Email;
            // response.Address = entity.Address;
            // response.Occupation = entity.Occupation;
            // response.Handphone = entity.Handphone;
            // response.JobTitle = entity.JobTitle;
            // response.CompanyName = entity.Company.CompanyName;
            response.CompanyId = entity.Company.Id;
            // response.HoldingName = entity.Company.Holding.HoldingName;
            response.HoldingId = entity.Company.Holding.Id;
            return(response);
        }
 public ActiveSupplier(MUser user, List <Product> products)
 {
     Name         = user.Name;
     TotalProduct = products.Count(x => x.PosterId == user.Id);
 }
Esempio n. 13
0
 public MUserContactResponse(MUser user)
 {
     this.Id        = user.Id;
     this.Name      = user.Name;
     this.Handphone = user.Handphone;
 }