public Stream FindByCityLocationLon(string cityLocationLon)
        {
            IFindCityBusinessService businessService = (IFindCityBusinessService)BusinessFactory.Create(Keywords.FindCity);
            OperationResult          result          = businessService.FindByCityLocationLon((float)Convert.ToDouble(cityLocationLon));

            return(result.ToJsonStream());
        }
        public Stream FindByDefaultWallpaper(string defaultWallpaper)
        {
            IFindThemeBusinessService businessService = (IFindThemeBusinessService)BusinessFactory.Create(Keywords.FindTheme);
            OperationResult           result          = businessService.FindByDefaultWallpaper(Convert.ToString(defaultWallpaper));

            return(result.ToJsonStream());
        }
        public Stream FindByTaskbarMenuColor(string taskbarMenuColor)
        {
            IFindThemeBusinessService businessService = (IFindThemeBusinessService)BusinessFactory.Create(Keywords.FindTheme);
            OperationResult           result          = businessService.FindByTaskbarMenuColor(Convert.ToString(taskbarMenuColor));

            return(result.ToJsonStream());
        }
        public Stream FindByThemeInfo(string themeInfo)
        {
            IFindThemeBusinessService businessService = (IFindThemeBusinessService)BusinessFactory.Create(Keywords.FindTheme);
            OperationResult           result          = businessService.FindByThemeInfo(Convert.ToString(themeInfo));

            return(result.ToJsonStream());
        }
        public Stream FindByLoadingAnimationAudio(string loadingAnimationAudio)
        {
            IFindThemeBusinessService businessService = (IFindThemeBusinessService)BusinessFactory.Create(Keywords.FindTheme);
            OperationResult           result          = businessService.FindByLoadingAnimationAudio(Convert.ToString(loadingAnimationAudio));

            return(result.ToJsonStream());
        }
        public Stream GetCity(string idCity)
        {
            BaseBusinessService <City> businessService = (BaseBusinessService <City>)BusinessFactory.Create(Keywords.FindCity);
            OperationResult            result          = businessService.Get(idCity);

            return(result.ToJsonStream());
        }
Esempio n. 7
0
        public Stream Login(string username, string password)
        {
            ILoginBusinessService businessService = (ILoginBusinessService)BusinessFactory.Create("Find.Common.Resources.UserLogin");
            OperationResult       result          = businessService.FindByUsernameAndPassword(username, password);

            return(result.ToJsonStream());
        }
        public Stream DeleteByCountryId(string countryId)
        {
            IDeleteCityBusinessService businessService = (IDeleteCityBusinessService)BusinessFactory.Create(Keywords.DeleteCity);
            OperationResult            result          = businessService.DeleteByCountryId(Convert.ToInt16(countryId));

            return(result.ToJsonStream());
        }
        public Stream UpdateCity(City cityForm)
        {
            BaseBusinessService <City> businessService = (BaseBusinessService <City>)BusinessFactory.Create(Keywords.UpdateCity);
            OperationResult            result          = businessService.Update(cityForm);

            return(result.ToJsonStream());
        }
        public Stream DeleteByLangID(string langID)
        {
            IDeleteCityBusinessService businessService = (IDeleteCityBusinessService)BusinessFactory.Create(Keywords.DeleteCity);
            OperationResult            result          = businessService.DeleteByLangID(Convert.ToString(langID));

            return(result.ToJsonStream());
        }
        public Stream UpdateCountryId(string idCity, string countryId)
        {
            IUpdateCityBusinessService businessService = (IUpdateCityBusinessService)BusinessFactory.Create(Keywords.UpdateCity);
            OperationResult            result          = businessService.UpdateCountryId(Convert.ToInt64(idCity), Convert.ToInt16(countryId));

            return(result.ToJsonStream());
        }
        public Stream UpdateLangID(string idCity, string langID)
        {
            IUpdateCityBusinessService businessService = (IUpdateCityBusinessService)BusinessFactory.Create(Keywords.UpdateCity);
            OperationResult            result          = businessService.UpdateLangID(Convert.ToInt64(idCity), Convert.ToString(langID));

            return(result.ToJsonStream());
        }
        public Stream DeleteByCityLocationLat(string cityLocationLat)
        {
            IDeleteCityBusinessService businessService = (IDeleteCityBusinessService)BusinessFactory.Create(Keywords.DeleteCity);
            OperationResult            result          = businessService.DeleteByCityLocationLat((float)Convert.ToDouble(cityLocationLat));

            return(result.ToJsonStream());
        }
        public Stream UpdateCityLocationLat(string idCity, string cityLocationLat)
        {
            IUpdateCityBusinessService businessService = (IUpdateCityBusinessService)BusinessFactory.Create(Keywords.UpdateCity);
            OperationResult            result          = businessService.UpdateCityLocationLat(Convert.ToInt64(idCity), (float)Convert.ToDouble(cityLocationLat));

            return(result.ToJsonStream());
        }
        public async Task <ActionResult <dynamic> > PutMasterProduct(long productId, MasterProduct masterProduct)
        {
            if (productId != masterProduct.ProductId)
            {
                return(BadRequest());
            }

            IBusiness <MasterProduct> productBusiness = BusinessFactory <MasterProduct> .Create();

            bool isUpdate = false, isProductNameExisting = false;
            var  productModel = await productBusiness.SingleOrDefaultAsync(x => (bool)x.Status && x.ProductId == productId);

            if (productModel != null)
            {
                isProductNameExisting = await productBusiness.Any(x => x.ProductId != masterProduct.ProductId && (bool)x.Status && x.ProductName.ToLower() == masterProduct.ProductName.ToLower());

                if (!isProductNameExisting)
                {
                    productModel.ProductName = masterProduct.ProductName;
                    productModel.Quantity    = masterProduct.Quantity;
                    productModel.Price       = masterProduct.Price;
                    productModel.Availablity = masterProduct.Quantity <= 0 ? false : true;
                    productModel.Status      = masterProduct.Status;
                    productModel.EntryBy     = masterProduct.EntryBy;
                    productModel.EntryDate   = DateTime.Now;
                    isUpdate = await productBusiness.Update(productModel, productId);
                }
            }

            dynamic saveResult = new { isUpdate, isProductNameExisting };

            return(Ok(saveResult));
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            System.Console.WriteLine(" Please write your Number: ");
            var input = System.Console.ReadLine();

            while (input.All(char.IsNumber) && !string.IsNullOrEmpty(input))
            {
                var number = int.Parse(input);

                if (number < SpecialRomanKeys.MinRomanValue || number > SpecialRomanKeys.MaxRomanValue)
                {
                    System.Console.WriteLine($" -> Error: The number should be between {SpecialRomanKeys.MinRomanValue} and {SpecialRomanKeys.MaxRomanValue}. Please Try again..");
                }
                else
                {
                    try
                    {
                        System.Console.WriteLine($" Result: {BusinessFactory.Service<IRomanBO>().ConvertNumberToRomanNumeral(number)}");
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine($" -> Error: {ex.Message}");
                    }
                }

                System.Console.WriteLine("---------------------------");
                System.Console.WriteLine(" Please write your Number: ");
                input = System.Console.ReadLine();
            }
        }
        public Stream FindByCityName(string cityName)
        {
            IFindCityBusinessService businessService = (IFindCityBusinessService)BusinessFactory.Create(Keywords.FindCity);
            OperationResult          result          = businessService.FindByCityName(Convert.ToString(cityName));

            return(result.ToJsonStream());
        }
        public async Task <HttpResponseMessage> GetAllMenuPagesForRole(int roleId)
        {
            try
            {
                List <ModuleWisePageAccessModel> listModuleWisePageAccessModel = new List <ModuleWisePageAccessModel>();
                var menuPages = BusinessFactory.CreateAccountManagementBusinessInstance().GetModulewiseMenuAccessForRole(roleId);

                foreach (var menupage in menuPages)
                {
                    ModuleWisePageAccessModel moduleWisePageAccessModel = new ModuleWisePageAccessModel();
                    moduleWisePageAccessModel.Module            = new ModuleModel();
                    moduleWisePageAccessModel.Module.ModuleId   = menupage.Module.ModuleId;
                    moduleWisePageAccessModel.Module.ModuleName = menupage.Module.ModuleName;
                    foreach (var pageEntity in menupage.pageList)
                    {
                        PageModel page = new PageModel();

                        page.PageId   = pageEntity.PageId;
                        page.PageName = pageEntity.PageName;
                        page.PageUrl  = pageEntity.PageUrl;
                        moduleWisePageAccessModel.pageList.Add(page);
                    }
                    listModuleWisePageAccessModel.Add(moduleWisePageAccessModel);
                }
                return(Request.CreateResponse <List <ModuleWisePageAccessModel> >(HttpStatusCode.OK, listModuleWisePageAccessModel));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            // Return BadRequest if request is null
            if (WebOperationContext.Current == null)
            {
                throw new FaultException <UnAuthorisedException>(new UnAuthorisedException(), new FaultReason("User Unauthorised"));
            }
            // Get Token from header
            var token = WebOperationContext.Current.IncomingRequest.Headers["AUTH_TOKEN"];

            // Validate the Token
            ITokenProcess tokenBuilder = BusinessFactory.GetTokenProcess();

            if (!tokenBuilder.IsValid(token))
            {
                throw new FaultException <UnAuthorisedException>(new UnAuthorisedException(), new FaultReason("User Unauthorised"));
            }
            UserDTO user = BusinessFactory.GetUserProcess().GetUser(token);

            if (user == null)
            {
                throw new FaultException <UnAuthorisedException>(new UnAuthorisedException(), new FaultReason("User Unauthorised"));
            }
            // Add User ids to the header so the service has them if needed
            WebOperationContext.Current.IncomingRequest.Headers.Add("UserName", user.UserName);
            WebOperationContext.Current.IncomingRequest.Headers.Add("UserId", user.UserId.ToString());
            return(null);
        }
        public async Task <HttpResponseMessage> GetModulewisePages()
        {
            try
            {
                var AllModulesData = BusinessFactory.CreateAccountManagementBusinessInstance().GetAllModulesWisePermissions();
                List <ModuleWisePageAccessModel> listModuleWisePageAccessModel = new List <ModuleWisePageAccessModel>();

                foreach (var moduleWisePageAccessData in AllModulesData)
                {
                    ModuleWisePageAccessModel moduleWisePageAccess = new ModuleWisePageAccessModel();
                    moduleWisePageAccess.Module            = new ModuleModel();
                    moduleWisePageAccess.Module.ModuleId   = moduleWisePageAccessData.Module.ModuleId;
                    moduleWisePageAccess.Module.ModuleName = moduleWisePageAccessData.Module.ModuleName;
                    List <PageModel> listPageModel = new List <PageModel>();
                    foreach (var pageData in moduleWisePageAccessData.pageList)
                    {
                        PageModel pageModel = new PageModel();
                        pageModel.PageId   = pageData.PageId;
                        pageModel.PageName = pageData.PageName;
                        listPageModel.Add(pageModel);
                    }
                    moduleWisePageAccess.pageList = listPageModel;
                    listModuleWisePageAccessModel.Add(moduleWisePageAccess);
                }

                return(Request.CreateResponse <List <ModuleWisePageAccessModel> >(HttpStatusCode.OK, listModuleWisePageAccessModel));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
        public async Task <HttpResponseMessage> CreateUser(UserModel user)
        {
            try
            {
                UserEntity userEntity = new UserEntity();

                userEntity.Username     = user.Username;
                userEntity.Password     = user.Password;
                userEntity.EmailAddress = user.EmailAddress;
                userEntity.FirstName    = user.FirstName;
                userEntity.LastName     = user.LastName;
                userEntity.CreatedBy    = user.CreatedBy;
                userEntity.Role         = new RoleEntity();

                userEntity.Role.RoleId = user.Role.RoleId;

                BusinessFactory.CreateAccountManagementBusinessInstance().CreateUser(userEntity);


                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
        public async Task <HttpResponseMessage> UpdateUser()
        {
            try
            {
                var        user       = JsonConvert.DeserializeObject <UserEntity>(HttpContext.Current.Request.Form[0]);
                UserEntity userEntity = new UserEntity();
                userEntity.UserId       = user.UserId;
                userEntity.Username     = user.Username;
                userEntity.Password     = user.Password;
                userEntity.EmailAddress = user.EmailAddress;
                userEntity.FirstName    = user.FirstName;
                userEntity.LastName     = user.LastName;
                userEntity.ModifiedBy   = user.ModifiedBy;
                userEntity.Role         = new RoleEntity();

                userEntity.Role.RoleId = user.Role.RoleId;
                var postedFile = HttpContext.Current.Request.Files[0].FileName;
                userEntity.ProfilePicPath = Guid.NewGuid().ToString() + postedFile;
                var filePath = HttpContext.Current.Server.MapPath("~") + @"Content\ProfilePics\" + userEntity.ProfilePicPath;

                HttpContext.Current.Request.Files[0].SaveAs(filePath);

                BusinessFactory.CreateAccountManagementBusinessInstance().UpdateUser(userEntity);


                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.StackTrace));
            }
        }
        public async Task <HttpResponseMessage> GetAllUsers()
        {
            try
            {
                List <UserModel> listUserModel = new List <UserModel>();

                var users = BusinessFactory.CreateAccountManagementBusinessInstance().GetAllUsersEntity();

                foreach (var userenity in users)
                {
                    UserModel user = new UserModel();
                    user.UserId    = userenity.UserId;
                    user.Username  = userenity.Username;
                    user.FirstName = userenity.FirstName;
                    user.LastName  = userenity.LastName;

                    user.EmailAddress = userenity.EmailAddress;
                    user.Role         = new RoleModel();
                    user.Role.RoleId  = userenity.Role.RoleId;

                    user.Role.RoleName = userenity.Role.RoleName;
                    listUserModel.Add(user);
                }
                return(Request.CreateResponse <List <UserModel> >(HttpStatusCode.OK, listUserModel));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }
Esempio n. 24
0
        public Stream FindByLanguageID(string languageID)
        {
            IFindGenderBusinessService businessService = (IFindGenderBusinessService)BusinessFactory.Create(Keywords.FindGender);
            OperationResult            result          = businessService.FindByLanguageID(Convert.ToString(languageID));

            return(result.ToJsonStream());
        }
Esempio n. 25
0
        public Stream FindByGenderIcon(string genderIcon)
        {
            IFindGenderBusinessService businessService = (IFindGenderBusinessService)BusinessFactory.Create(Keywords.FindGender);
            OperationResult            result          = businessService.FindByGenderIcon(Convert.ToString(genderIcon));

            return(result.ToJsonStream());
        }
        public void Inicializar()
        {
            var factoryBusiness = new BusinessFactory <ICashbackBusiness>();

            regraDeNegocio = factoryBusiness.CriarRecurso(new ModelData.Model.Categoria {
                Nome = "Pop"
            });
        }
        public async Task <ActionResult <TransOrder> > GetOrder(long orderId)
        {
            IBusiness <TransOrder> orderBusiness = BusinessFactory <TransOrder> .Create();

            var result = await orderBusiness.Select(orderId);

            return(Ok(result));
        }
        public async Task <ActionResult <IEnumerable <TransOrder> > > GetOrders()
        {
            IBusiness <TransOrder> orderBusiness = BusinessFactory <TransOrder> .Create();

            var result = await orderBusiness.SelectAll();

            return(Ok(result));
        }
        public async Task <ActionResult <bool> > DeleteTransOrder(int productId)
        {
            IBusiness <TransOrder> orderBusiness = BusinessFactory <TransOrder> .Create();

            var result = await orderBusiness.Delete(productId);

            return(Ok(result));
        }
        public async Task <ActionResult <bool> > DeleteMasterProduct(int productId)
        {
            IBusiness <MasterProduct> productBusiness = BusinessFactory <MasterProduct> .Create();

            var result = await productBusiness.Delete(productId);

            return(Ok(result));
        }