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

            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());
        }
        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 DeleteByCountryId(string countryId)
        {
            IDeleteCityBusinessService businessService = (IDeleteCityBusinessService)BusinessFactory.Create(Keywords.DeleteCity);
            OperationResult            result          = businessService.DeleteByCountryId(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 DeleteByLangID(string langID)
        {
            IDeleteCityBusinessService businessService = (IDeleteCityBusinessService)BusinessFactory.Create(Keywords.DeleteCity);
            OperationResult            result          = businessService.DeleteByLangID(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 Stream FindByCityLocationLon(string cityLocationLon)
        {
            IFindCityBusinessService businessService = (IFindCityBusinessService)BusinessFactory.Create(Keywords.FindCity);
            OperationResult          result          = businessService.FindByCityLocationLon((float)Convert.ToDouble(cityLocationLon));

            return(result.ToJsonStream());
        }
Esempio n. 10
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());
        }
Esempio n. 11
0
        public Stream FindByLanguageID(string languageID)
        {
            IFindGenderBusinessService businessService = (IFindGenderBusinessService)BusinessFactory.Create(Keywords.FindGender);
            OperationResult            result          = businessService.FindByLanguageID(Convert.ToString(languageID));

            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 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. 14
0
        public Stream FindByGenderIcon(string genderIcon)
        {
            IFindGenderBusinessService businessService = (IFindGenderBusinessService)BusinessFactory.Create(Keywords.FindGender);
            OperationResult            result          = businessService.FindByGenderIcon(Convert.ToString(genderIcon));

            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 FindByCityName(string cityName)
        {
            IFindCityBusinessService businessService = (IFindCityBusinessService)BusinessFactory.Create(Keywords.FindCity);
            OperationResult          result          = businessService.FindByCityName(Convert.ToString(cityName));

            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 FindByThemeInfo(string themeInfo)
        {
            IFindThemeBusinessService businessService = (IFindThemeBusinessService)BusinessFactory.Create(Keywords.FindTheme);
            OperationResult           result          = businessService.FindByThemeInfo(Convert.ToString(themeInfo));

            return(result.ToJsonStream());
        }
        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 <bool> > DeleteMasterProduct(int productId)
        {
            IBusiness <MasterProduct> productBusiness = BusinessFactory <MasterProduct> .Create();

            var result = await productBusiness.Delete(productId);

            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 <MasterProduct> > GetMasterProduct(long productId)
        {
            IBusiness <MasterProduct> productBusiness = BusinessFactory <MasterProduct> .Create();

            var result = await productBusiness.Select(productId);

            return(Ok(result));
        }
        public async Task <ActionResult <IEnumerable <MasterProduct> > > GetMasterProducts()
        {
            IBusiness <MasterProduct> productBusiness = BusinessFactory <MasterProduct> .Create();

            var result = await productBusiness.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 Stream FindCity(string keyword, string page, string max)
        {
            BaseBusinessService <City> businessService = (BaseBusinessService <City>)BusinessFactory.Create(Keywords.FindCity);

            SelectParam selectParam = new SelectParam();

            selectParam.Keyword = keyword;
            if (keyword.ToLower() == "all")
            {
                selectParam.Keyword = "";
            }
            OperationResult result = businessService.FindAll(selectParam, Convert.ToInt16(page), Convert.ToInt16(max));

            return(result.ToJsonStream());
        }
        public async Task <ActionResult <dynamic> > PutTransOrder(long orderId, TransOrder transOrder)
        {
            if (orderId != transOrder.OrderId)
            {
                return(BadRequest());
            }

            IBusiness <TransOrder> orderBusiness = BusinessFactory <TransOrder> .Create();

            bool isUpdate = false, isProductUpdate = false;
            var  orderModel = await orderBusiness.SingleOrDefaultAsync(x => x.OrderId == orderId);

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

            var productModel = await productBusiness.SingleOrDefaultAsync(x => (bool)x.Status && x.ProductId == transOrder.ProductId);

            if (orderModel != null && productModel != null && productModel.Availablity && productModel.Quantity >= orderModel.OrderedQuantity)
            {
                orderModel.OrderedQuantity = transOrder.OrderedQuantity;
                orderModel.TotalAmount     = transOrder.OrderedQuantity > 0 ? transOrder.OrderedQuantity * productModel.Price : 0;
                orderModel.PaymentMode     = transOrder.PaymentMode;
                orderModel.DeliveryAddress = transOrder.DeliveryAddress;
                orderModel.IsCancelled     = transOrder.IsCancelled;
                orderModel.CancelledDate   = DateTime.Now;
                orderModel.IsShipped       = transOrder.IsShipped;
                orderModel.ShippedDate     = DateTime.Now;
                orderModel.IsDelivered     = transOrder.IsDelivered;
                orderModel.DeliveredDate   = DateTime.Now;
                orderModel.IsReturned      = transOrder.IsReturned;
                orderModel.ReturnedDate    = DateTime.Now;
                orderModel.OrderedBy       = transOrder.OrderedBy;
                orderModel.OrderedDate     = DateTime.Now;
                isUpdate = await orderBusiness.Update(orderModel, orderId);
            }
            if (orderModel != null && productModel != null && ((orderModel.IsCancelled != null && (bool)orderModel.IsCancelled) ||
                                                               (orderModel.IsReturned != null && (bool)orderModel.IsReturned)))
            {
                productModel.Quantity   += orderModel.OrderedQuantity;
                productModel.Availablity = productModel.Quantity > 0;
                isProductUpdate          = await productBusiness.Update(productModel, transOrder.ProductId);
            }

            dynamic saveResult = new { isUpdate, isProductUpdate };

            return(Ok(saveResult));
        }
        public async Task <ActionResult <dynamic> > PostMasterProduct(MasterProduct masterProduct)
        {
            IBusiness <MasterProduct> productBusiness = BusinessFactory <MasterProduct> .Create();

            bool isInsert = false, isProductNameExisting = false;

            isProductNameExisting = await productBusiness.Any(x => (bool)x.Status && x.ProductName.ToLower() == masterProduct.ProductName.ToLower());

            if (!isProductNameExisting)
            {
                isInsert = await productBusiness.Insert(masterProduct);
            }

            dynamic result = new { isInsert, isProductNameExisting };

            return(Ok(result));
        }
Esempio n. 28
0
        public Stream Info(string username)
        {
            IFindUserLoginBusinessService businessService = (IFindUserLoginBusinessService)BusinessFactory.Create("Find.Common.Resources.UserLogin");
            OperationResult result = businessService.FindByUsername(username);

            List <UserLogin> logins = (List <UserLogin>)result.Data;

            if (logins.Count > 0)
            {
                Int64 userID = logins[0].IdUser;
                IFindUserInfoBusinessService bs = (IFindUserInfoBusinessService)BusinessFactory.Create("Find.Common.Resources.UserInfo");
                result = bs.FindByUserId(userID);
                List <UserInfo> userInfoes = (List <UserInfo>)result.Data;
                if (userInfoes.Count > 0)
                {
                    UserInfo info = userInfoes[0];
                    info.Username = username;
                }
            }

            return(result.ToJsonStream());
        }
Esempio n. 29
0
        public Stream HandleOAuthLogin(OAuthLoginForm loginForm)
        {
            IOAuthLoginBusinessService businessService = (IOAuthLoginBusinessService)BusinessFactory.Create("Tools.OAuthServerManager.OAuthLogin");
            OperationResult            result          = businessService.CheckAuthenticationSession(loginForm);

            if (result.Result)
            {
                result = businessService.GetAuthenticationServer(loginForm.ClientID);
                if (result.Result)
                {
                    //RegisteredApplication app = (RegisteredApplication)result.Data;
                    result = businessService.QueryAuthenticationServer((string)result.Data, loginForm.Username, loginForm.Password);
                    if (result.Result)
                    {
                        result = businessService.GenerateAuthorizationCode(result, loginForm.Username, loginForm.ClientID, loginForm.AuthorizationSessionID);
                        businessService.SaveAuthorizationCode((AuthenticationCode)result.Data);
                        result = businessService.CallCallbackUrlWithAuthorizationResult(loginForm.ClientID, ((AuthenticationCode)result.Data).AuthenticationCodeString);
                    }
                }
            }

            return(result.ToJsonStream());
        }
        public async Task <ActionResult <dynamic> > PostTransOrder(TransOrder transOrder)
        {
            IBusiness <TransOrder> orderBusiness = BusinessFactory <TransOrder> .Create();

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

            bool isOrderInsert = false, isProductUpdate = false;
            var  productModel = await productBusiness.SingleOrDefaultAsync(x => (bool)x.Status && x.ProductId == transOrder.ProductId && (bool)x.Availablity);

            if (productModel != null && productModel.Quantity >= transOrder.OrderedQuantity)
            {
                transOrder.ProductPrice = productModel.Price;
                transOrder.TotalAmount  = productModel.Price * transOrder.OrderedQuantity;
                isOrderInsert           = await orderBusiness.Insert(transOrder);

                productModel.Quantity   -= transOrder.OrderedQuantity;
                productModel.Availablity = productModel.Quantity > 0;
                isProductUpdate          = await productBusiness.Update(productModel, transOrder.ProductId);
            }

            dynamic result = new { isOrderInsert, isProductUpdate };

            return(Ok(result));
        }