Ejemplo n.º 1
0
        internal ZoneUsersResponse Process(string roleName, string tradeLicence, string licenseAuthority)
        {
            ZoneUsersResponse    response = new ZoneUsersResponse();
            ZoneCompanyRepoModel company  = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, tradeLicence, licenseAuthority);

            if (company != null)
            {
                response.Users = company.Users.Where(u => u.Status.ToLower() == "active").ToList();

                response.ResponseMessage      = "SUCCESS";
                response.responseCode         = ResponseCode.SUCCESS;
                response.ValidationErrorsList = new List <NameSet>();
                response.TimeStamp            = DateTime.Now;
            }
            else
            {
                response.ResponseMessage      = "Trade License not found.";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Trade License not found", ArabicName = "Trade License not found"
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }
        internal ZoneUserResponse Process(string roleName, string emiratesId)
        {
            ZoneUserResponse     response = new ZoneUserResponse();
            ZoneCompanyRepoModel company  = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, emiratesId);

            if (company != null)
            {
                response.Company = new ZoneCompanyLite
                {
                    EmailAddress     = company.Company.EmailAddress,
                    LicenceAuthority = company.Company.LicenceAuthority,
                    LicenceExpiry    = company.Company.LicenceExpiry,
                    LicenceIssuedOn  = company.Company.LicenceIssuedOn,
                    LicenceNumber    = company.Company.LicenceNumber,
                    Name             = company.Company.Name,
                    PhoneNumber      = company.Company.PhoneNumber,
                    Role             = company.Company.Role,
                    Status           = company.Company.Status
                };

                ZoneUserModel user = company.Users.First(u => u.EmiratesId == emiratesId);
                response.User = new ZoneUserLite
                {
                    BirthDate    = user.BirthDate,
                    EmailAddress = user.EmailAddress,
                    EmiratesId   = user.EmiratesId,
                    MobileNumber = user.MobileNumber,
                    Name         = user.Name,
                    Role         = user.Role,
                    Status       = user.Status,
                    UserId       = user.UserId,
                    UserName     = user.UserName
                };

                response.ResponseMessage      = "SUCCESS";
                response.responseCode         = ResponseCode.SUCCESS;
                response.ValidationErrorsList = new List <NameSet>();
                response.TimeStamp            = DateTime.Now;
            }
            else
            {
                response.ResponseMessage      = "Emiartes Id not found for given role";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Emiartes Id not found", ArabicName = "Emiartes Id not found"
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }
Ejemplo n.º 3
0
        internal ZoneCompanyActionResponse Process(string roleName, ZoneCompanyActionRequest company)
        {
            ZoneCompanyActionResponse response     = new ZoneCompanyActionResponse();
            ZoneCompanyRepoModel      companyCheck = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, company.Company.LicenceNumber, company.Company.LicenceAuthority);

            if (companyCheck == null)
            {
                company.Company.Status = "Active";
                company.Admin.Status   = "Active";
                company.Admin.UserId   = 1;


                var companyModel = ZoneAuthorityRepository.Instance.CreateZoneCompany(company.Company, company.Admin);


                response.Company = new ZoneCompanyLite
                {
                    EmailAddress     = companyModel.Company.EmailAddress,
                    LicenceAuthority = companyModel.Company.LicenceAuthority,
                    LicenceExpiry    = companyModel.Company.LicenceExpiry,
                    LicenceIssuedOn  = companyModel.Company.LicenceIssuedOn,
                    LicenceNumber    = companyModel.Company.LicenceNumber,
                    Name             = companyModel.Company.Name,
                    PhoneNumber      = companyModel.Company.PhoneNumber,
                    Role             = companyModel.Company.Role,
                    Status           = companyModel.Company.Status
                };

                response.RequestTrackingNumber = string.Format("{1}-{0}", company.Company.LicenceNumber, roleName);

                response.ResponseMessage      = "SUCCESS";
                response.responseCode         = ResponseCode.SUCCESS;
                response.ValidationErrorsList = new List <NameSet>();
                response.TimeStamp            = DateTime.Now;
            }
            else
            {
                response.ResponseMessage      = "Trade license is already exist.";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Trade license is already exist.", ArabicName = "Trade license is already exist."
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }
Ejemplo n.º 4
0
        internal ZoneUserActionResponse Process(string roleName, string tradeLicence, string licenseAuthority, string emiratesId)
        {
            ZoneUserActionResponse response = new ZoneUserActionResponse();
            ZoneCompanyRepoModel   company  = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, tradeLicence, licenseAuthority);

            if (company != null)
            {
                var userCheck = company.Users.Where(u => u.Status.ToLower() == "active" && (u.EmiratesId == emiratesId) && u.Role.ToLower() != "admin").ToList();

                if (userCheck.Count == 1)
                {
                    var subject = userCheck.First();

                    subject.Status = "Delete";

                    response.User                 = subject;
                    response.ResponseMessage      = "SUCCESS";
                    response.responseCode         = ResponseCode.SUCCESS;
                    response.ValidationErrorsList = new List <NameSet>();
                    response.TimeStamp            = DateTime.Now;
                }
                else
                {
                    response.ResponseMessage      = "Emirates Id is not exist.";
                    response.responseCode         = ResponseCode.FAILURE;
                    response.ValidationErrorsList = new List <NameSet>()
                    {
                        new NameSet {
                            EnglishName = "Emirates Id is not exist.", ArabicName = "Emirates Id is not exist."
                        }
                    };
                    response.TimeStamp = DateTime.Now;
                }
            }
            else
            {
                response.ResponseMessage      = "Trade License not found.";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Trade License not found", ArabicName = "Trade License not found"
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }
Ejemplo n.º 5
0
        internal ZoneUserActionResponse Process(string roleName, string tradeLicence, string licenseAuthority, ZoneUserActionRequest user)
        {
            ZoneUserActionResponse response = new ZoneUserActionResponse();
            ZoneCompanyRepoModel   company  = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, tradeLicence, licenseAuthority);

            if (company != null)
            {
                var userCheck = company.Users.Count(u => u.Status.ToLower() == "active" && (u.EmiratesId == user.User.EmiratesId || u.EmailAddress.ToLower() == user.User.EmailAddress.ToLower()));

                if (userCheck == 0)
                {
                    user.User.UserId = company.Users.Count + 10;
                    user.User.Status = "Active";
                    company.Users.Add(user.User);

                    response.User                 = user.User;
                    response.ResponseMessage      = "SUCCESS";
                    response.responseCode         = ResponseCode.SUCCESS;
                    response.ValidationErrorsList = new List <NameSet>();
                    response.TimeStamp            = DateTime.Now;
                }
                else
                {
                    response.ResponseMessage      = "Emirates Id or Email is already exist.";
                    response.responseCode         = ResponseCode.FAILURE;
                    response.ValidationErrorsList = new List <NameSet>()
                    {
                        new NameSet {
                            EnglishName = "Emirates Id or Email is already exist.", ArabicName = "Emirates Id or Email is already exist."
                        }
                    };
                    response.TimeStamp = DateTime.Now;
                }
            }
            else
            {
                response.ResponseMessage      = "Trade License not found.";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Trade License not found", ArabicName = "Trade License not found"
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }
        internal ZoneCompanyResponse Process(string roleName, string tradeLicence, string licenseAuthority)
        {
            ZoneCompanyResponse  response = new ZoneCompanyResponse();
            ZoneCompanyRepoModel company  = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, tradeLicence, licenseAuthority);

            if (company != null)
            {
                response.Company = new ZoneCompanyLite
                {
                    EmailAddress     = company.Company.EmailAddress,
                    LicenceAuthority = company.Company.LicenceAuthority,
                    LicenceExpiry    = company.Company.LicenceExpiry,
                    LicenceIssuedOn  = company.Company.LicenceIssuedOn,
                    LicenceNumber    = company.Company.LicenceNumber,
                    Name             = company.Company.Name,
                    PhoneNumber      = company.Company.PhoneNumber,
                    Role             = company.Company.Role,
                    Status           = company.Company.Status
                };

                response.ResponseMessage      = "SUCCESS";
                response.responseCode         = ResponseCode.SUCCESS;
                response.ValidationErrorsList = new List <NameSet>();
                response.TimeStamp            = DateTime.Now;
            }
            else
            {
                response.ResponseMessage      = "Trade License not found for given role";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Trade License not found", ArabicName = "Trade License not found"
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }
Ejemplo n.º 7
0
        internal ZoneUserActionResponse Process(string roleName, string tradeLicence, string licenseAuthority, string emiratesId, ZoneUserActionRequest user)
        {
            ZoneUserActionResponse response = new ZoneUserActionResponse();
            ZoneCompanyRepoModel   company  = ZoneAuthorityRepository.Instance.GetZoneCompany(roleName, tradeLicence, licenseAuthority);

            if (company != null)
            {
                var userCheck = company.Users.Where(u => u.Status.ToLower() == "active" && (u.EmiratesId == user.User.EmiratesId)).ToList();

                if (userCheck.Count == 1)
                {
                    var subject = userCheck.First();

                    subject.BirthDate           = user.User.BirthDate;
                    subject.Designation         = user.User.Designation;
                    subject.EmailAddress        = user.User.EmailAddress;
                    subject.EmiratesIdExpiresOn = user.User.EmiratesIdExpiresOn;
                    subject.Gender       = user.User.Gender;
                    subject.MobileNumber = user.User.MobileNumber;
                    subject.Name         = user.User.Name;
                    subject.Nationality  = user.User.Nationality;

                    subject.PassportCountry   = user.User.PassportCountry;
                    subject.PassportExpiresOn = user.User.PassportExpiresOn;
                    subject.PassportIssuedOn  = user.User.PassportIssuedOn;

                    subject.PassportNumber = user.User.PassportNumber;
                    subject.PostOfficeBox  = user.User.PostOfficeBox;
                    subject.Role           = user.User.Role;
                    subject.Status         = string.IsNullOrEmpty(user.User.Status) ? subject.Status: user.User.Status;

                    response.User                 = subject;
                    response.ResponseMessage      = "SUCCESS";
                    response.responseCode         = ResponseCode.SUCCESS;
                    response.ValidationErrorsList = new List <NameSet>();
                    response.TimeStamp            = DateTime.Now;
                }
                else
                {
                    response.ResponseMessage      = "Emirates Id is not exist.";
                    response.responseCode         = ResponseCode.FAILURE;
                    response.ValidationErrorsList = new List <NameSet>()
                    {
                        new NameSet {
                            EnglishName = "Emirates Id is not exist.", ArabicName = "Emirates Id is not exist."
                        }
                    };
                    response.TimeStamp = DateTime.Now;
                }
            }
            else
            {
                response.ResponseMessage      = "Trade License not found.";
                response.responseCode         = ResponseCode.FAILURE;
                response.ValidationErrorsList = new List <NameSet>()
                {
                    new NameSet {
                        EnglishName = "Trade License not found", ArabicName = "Trade License not found"
                    }
                };
                response.TimeStamp = DateTime.Now;
            }

            return(response);
        }