/// <summary>
        /// Processes incoming service related request for appropriate action
        /// </summary>
        /// <param name="serviceRequestInfo"></param>
        private void ManageServiceRequest(ServiceDetails serviceRequestInfo)
        {
            ServiceDetails serviceDetails = null;

            // Find Actual Service object
            foreach (var service in _services)
            {
                if (service.ServiceName.Equals(serviceRequestInfo.ServiceName))
                {
                    serviceDetails = service;
                    break;
                }
            }

            if (serviceDetails == null)
            {
                return;
            }


            if (serviceDetails.Status.Equals(ServiceStatus.Starting))
            {
                _servicesController.StartService(serviceDetails);
            }
            else if (serviceDetails.Status.Equals(ServiceStatus.Stopping))
            {
                _servicesController.StopService(serviceDetails);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Populate Intial Services information
        /// </summary>
        private void PopulateServiceDetails()
        {
            // Create Service Details
            ServiceDetails marketServiceDetails   = new ServiceDetails(GetEnumDescription.GetValue(Common.Constants.Services.MarketDataService), ServiceStatus.Disabled);
            ServiceDetails orderServiceDetails    = new ServiceDetails(GetEnumDescription.GetValue(Common.Constants.Services.OrderExecutionService), ServiceStatus.Disabled);
            ServiceDetails positionServiceDetails = new ServiceDetails(GetEnumDescription.GetValue(Common.Constants.Services.PositionService), ServiceStatus.Disabled);

            // Set Display names
            marketServiceDetails.ServiceDisplayName = marketServiceDetails.ServiceName.Replace("TradeHub", "");
            marketServiceDetails.ServiceDisplayName = marketServiceDetails.ServiceDisplayName.Replace("Service", "");

            orderServiceDetails.ServiceDisplayName = orderServiceDetails.ServiceName.Replace("TradeHub", "");
            orderServiceDetails.ServiceDisplayName = orderServiceDetails.ServiceDisplayName.Replace("Service", "");

            positionServiceDetails.ServiceDisplayName = positionServiceDetails.ServiceName.Replace("TradeHub", "");
            positionServiceDetails.ServiceDisplayName = positionServiceDetails.ServiceDisplayName.Replace("Service", "");

            // Add details to collection
            _serviceDetailsCollection.Add(marketServiceDetails);
            _serviceDetailsCollection.Add(orderServiceDetails);
            _serviceDetailsCollection.Add(positionServiceDetails);

            // Get Actual Service Status
            marketServiceDetails.Status = GetServiceStatus(marketServiceDetails.ServiceName);
            orderServiceDetails.Status  = GetServiceStatus(orderServiceDetails.ServiceName);
        }
Esempio n. 3
0
        public void Can_pass_parent_type_as_string_param_to_dependency()
        {
            var container = new Container();

            container.Register <MyService>();
            container.Register <ConnectionStringProvider>(Reuse.Singleton);
            container.Register <IConnectionStringProvider, ConnectionNamingConnectionStringProvider>(
                made: Made.Of(parameters: request => parameter =>
            {
                if (parameter.ParameterType != typeof(string))
                {
                    return(null);
                }
                var targetType = request.Parent.ImplementationType;
                var targetName = string.Format("{0}.{1}", targetType.Namespace, targetType.Name);
                return(ParameterServiceInfo.Of(parameter)
                       .WithDetails(ServiceDetails.Of(defaultValue: targetName)));
            }));


            var service = container.Resolve <MyService>();

            var provider = service.ConnectionProvider as ConnectionNamingConnectionStringProvider;

            Assert.IsNotNull(provider);
            Assert.AreEqual("Me.MyService", provider.TargetName);
        }
Esempio n. 4
0
        public async Task <IActionResult> OnPost()
        {
            CarServiceVM.Service.DateAdded = DateTime.Now;
            CarServiceVM.Service.CarId     = CarServiceVM.Car.Id;

            CarServiceVM.ServiceShoopingCarts = db.ServiceShoopingCarts.Include(m => m.ServiceType)
                                                .Where(m => m.CarId == CarServiceVM.Car.Id).ToList();

            foreach (var item in CarServiceVM.ServiceShoopingCarts)
            {
                CarServiceVM.Service.TotalPrice += item.ServiceType.Price;
            }

            await db.Services.AddAsync(CarServiceVM.Service);

            await db.SaveChangesAsync();

            foreach (var item in CarServiceVM.ServiceShoopingCarts)
            {
                ServiceDetails serviceDetails = new ServiceDetails()
                {
                    ServiceId     = CarServiceVM.Service.Id,
                    SerivceName   = item.ServiceType.Name,
                    SerivcePrice  = item.ServiceType.Price,
                    ServiceTypeId = item.ServiceTypeId
                };

                db.ServiceDetails.Add(serviceDetails);
            }

            db.ServiceShoopingCarts.RemoveRange(CarServiceVM.ServiceShoopingCarts);
            await db.SaveChangesAsync();

            return(RedirectToPage("../Cars/Index", new { userId = CarServiceVM.Car.UserId }));
        }
Esempio n. 5
0
        /// <summary>
        /// Restarts Given Service
        /// </summary>
        /// <param name="serviceDetails"></param>
        public void RestartService(ServiceDetails serviceDetails)
        {
            ServiceController controller = new ServiceController(serviceDetails.ServiceName);

            try
            {
                int      millisec1 = Environment.TickCount;
                TimeSpan timeout   = TimeSpan.FromMilliseconds(_timeout);
                if (!controller.Status.ToString().Equals(ServiceStatus.Stopped.ToString()))
                {
                    controller.Stop();
                    controller.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
                    // count the rest of the timeout
                    int millisec2 = Environment.TickCount;
                    timeout = TimeSpan.FromMilliseconds(_timeout - (millisec2 - millisec1));
                }

                controller.Start();
                controller.WaitForStatus(ServiceControllerStatus.Running, timeout);

                Logger.Info("Restarting service " + serviceDetails.ServiceName, _type.FullName, "StopService");
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "RestartService");
            }
        }
Esempio n. 6
0
        public IActionResult Create(int ServicioId, string Name, string Description, string Cost, int ServiceCategoryId)
        {
            Servicio servicio = new Servicio();

            servicio.ServicioId        = ServicioId;
            servicio.Name              = Name;
            servicio.Description       = Description;
            servicio.Cost              = Cost;
            servicio.ServiceCategoryId = ServiceCategoryId;

            if (ModelState.IsValid)
            {
                _context.Add(servicio);
                _context.SaveChanges();
            }
            ViewData["ServiceCategoryId"] = new SelectList(_context.categories, "ServiceCategoryId", "ServiceCategoryId", servicio.ServiceCategoryId);

            ServiceDetails sd1 = new ServiceDetails();

            sd1.Servicio   = _context.servicios.Find(ServicioId);
            sd1.ServicioId = servicio.ServicioId;
            sd1.Supplier   = _context.suppliers.Find(1);
            sd1.SupplierId = 1;
            _context.Add(sd1);
            _context.SaveChanges();

            return(RedirectToAction(nameof(Index)));
        }
        private void DurationTimePicker_OkButtonClicked(object sender, SelectionChangedEventArgs e)
        {
            ObservableCollection <object> todaycollection       = new ObservableCollection <object>();
            ObservableCollection <object> todaycollectionBuffer = new ObservableCollection <object>();

            todaycollection = (ObservableCollection <Object>)e.NewValue;



            string EserviceId;
            string EserviceName;
            string EserviceCost;
            string EserviceBufferTime;

            EserviceId         = Convert.ToString(Application.Current.Properties["EserviceId"]);
            EserviceName       = Convert.ToString(Application.Current.Properties["EditServiceName"]);
            EserviceCost       = Convert.ToString(Application.Current.Properties["EditServiceCost"]);
            EserviceBufferTime = Convert.ToString(Application.Current.Properties["EserviceBufferTime"]);

            ServiceDetails service = new ServiceDetails();

            service.Id   = Convert.ToInt32(EserviceId);
            service.Name = EserviceName;
            service.Cost = EserviceCost;
            service.BufferTimeInMinutes = EserviceBufferTime;
            Navigation.PushAsync(new EditServiceDetails(service, todaycollection, todaycollectionBuffer));


            throw new NotImplementedException();
        }
        /// <summary>
        /// Sends request to stop the given service
        /// </summary>
        /// <param name="serviceName"></param>
        private void StopService(string serviceName)
        {
            ServiceDetails serviceDetails = null;

            foreach (var service in _services)
            {
                if (service.ServiceName.Equals(serviceName))
                {
                    serviceDetails = service;
                    break;
                }
            }

            if (serviceDetails == null)
            {
                return;
            }

            ////NOTE: Test code to simulate Service Start
            //// BEGIN:
            //serviceDetails.Status = ServiceStatus.Stopping;
            //serviceDetails.Status = ServiceStatus.Stopped;
            //return;
            //// :END

            _servicesController.StopService(serviceDetails);
        }
Esempio n. 9
0
        /// <summary>
        /// AutoSearch
        /// Calls [usp_autosearch_Service]
        /// </summary>
        public override List <ServiceDetails> AutoSearch(System.Int32?clientId, System.String nameSearch)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_autosearch_Service", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 60;
                cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value        = clientId;
                cmd.Parameters.Add("@NameSearch", SqlDbType.NVarChar).Value = nameSearch;
                cn.Open();
                DbDataReader          reader = ExecuteReader(cmd);
                List <ServiceDetails> lst    = new List <ServiceDetails>();
                while (reader.Read())
                {
                    ServiceDetails obj = new ServiceDetails();
                    obj.ServiceId   = GetReaderValue_Int32(reader, "ServiceId", 0);
                    obj.ServiceName = GetReaderValue_String(reader, "ServiceName", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Services", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Esempio n. 10
0
        private static ServiceDetails GetImportExternalDetails(Type serviceType, Attribute[] attributes, Request request)
        {
            var import = GetSingleAttributeOrDefault <ImportExternalAttribute>(attributes);

            if (import == null)
            {
                return(null);
            }

            var container = request.Container;

            serviceType = import.ContractType ?? container.UnwrapServiceType(serviceType);
            var serviceKey = import.ContractKey;

            if (!container.IsRegistered(serviceType, serviceKey))
            {
                var implementationType = import.ImplementationType ?? serviceType;

                var reuseAttr = GetSingleAttributeOrDefault <ReuseAttribute>(attributes);
                var reuseType = reuseAttr == null ? DefaultReuseType : reuseAttr.ReuseType;
                var reuseName = reuseAttr == null ? null : reuseAttr.ReuseName;
                var reuse     = GetReuse(reuseType, reuseName);

                var impl = import.ConstructorSignature == null ? null
                    : Made.Of(t => t.GetConstructorOrNull(args: import.ConstructorSignature));

                container.Register(serviceType, implementationType, reuse, impl,
                                   Setup.With(metadata: import.Metadata), IfAlreadyRegistered.Keep, serviceKey);
            }

            return(ServiceDetails.Of(serviceType, serviceKey));
        }
Esempio n. 11
0
        public void SearchbyFiltersOnSite()
        {
            //Read data from Excel file
            ExcelLib.PopulateInCollection(ExcelPath, "SearchSkills");
            string searchSkill = ExcelLib.ReadData(3, "SearchSkills");

            //Search by skill first
            var searchSkillsObj = new SearchSkills();

            searchSkillsObj.ClickSearch();

            searchSkillsObj.InputSearchSkills(searchSkill);

            //Filter by Onsite
            searchSkillsObj.FilterbyOnsite();
            //Validate the result in ServiceDetails Pag
            for (int i = 0; i < searchSkillsObj.ServiceDetailsLinks.Count(); i++)
            {
                Actions builder = new Actions(Driver);
                builder.KeyDown(Keys.Shift).Click(searchSkillsObj.ServiceDetailsLinks[i]).KeyUp(Keys.Shift).Build().Perform();
                var serviceDetailsObj = new ServiceDetails();
                var windowList        = Driver.WindowHandles;
                Driver.SwitchTo().Window(windowList[1]);
                Thread.Sleep(2000);
                Assert.AreEqual("On-Site", serviceDetailsObj.LocationType.Text, "Filter by Onsite failed");
                Driver.Close();
                Driver.SwitchTo().Window(windowList[0]);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Gets the file paths to all services with the specified service name.
        /// </summary>
        /// <param name="serviceName">The name of the service</param>
        /// <returns>The path to each service with the supplied service name</returns>
        public static IEnumerable <ServiceDetails> GetServiceDetails(string serviceName = null)
        {
            String query;

            if (serviceName == null)
            {
                query = "SELECT Name,DisplayName,PathName,ServiceType,StartMode FROM Win32_Service WHERE (NAME IS NOT NULL)";
            }
            else
            {
                query = "SELECT Name,DisplayName,PathName,ServiceType,StartMode FROM Win32_Service WHERE Name = \"" + serviceName + "\"";
            }

            using (ManagementObjectSearcher mos = new ManagementObjectSearcher(query))
            {
                foreach (ManagementObject mo in mos.Get())
                {
                    yield return(ServiceDetails.Create(
                                     (mo["Name"] != null ? mo["Name"].ToString() : null),
                                     (mo["DisplayName"] != null ? mo["DisplayName"].ToString() : null),
                                     (mo["PathName"] != null ? mo["PathName"].ToString() : null),
                                     (mo["ServiceType"] != null ? mo["ServiceType"].ToString() : null),
                                     (mo["StartMode"] != null ? mo["StartMode"].ToString() : null)));
                }
            }
        }
        public string GetOwnerPhone()
        {
            string input        = null;
            bool   isValidInput = true;

            Console.WriteLine("->Insert owner phone number(no more then 10 digits)");
            do
            {
                try
                {
                    input        = Console.ReadLine();
                    isValidInput = ServiceDetails.IsValidPhoneNumber(input);
                }
                catch (FormatException)
                {
                    InvalidInputTryAgainMsg();
                    isValidInput = false;
                }
                catch (ValueOutOfRangeException ofr)
                {
                    Console.WriteLine(ofr.Message);
                    Console.WriteLine("try again");
                    isValidInput = false;
                }
            }while (!isValidInput);

            return(input);
        }
Esempio n. 14
0
        public void SearchbyCategory()
        {
            //Read data from Excel file
            ExcelLib.PopulateInCollection(ExcelPath, "SearchSkills");
            string category    = ExcelLib.ReadData(2, "Category");
            string subcategory = ExcelLib.ReadData(2, "SubCategory");

            //Search by category and subcategory
            var searchSkillsObj = new SearchSkills();

            searchSkillsObj.ClickSearch();
            searchSkillsObj.ClickCategory(category, subcategory);

            //Validate the result in ServiceDetails Page
            for (int i = 0; i < searchSkillsObj.ServiceDetailsLinks.Count(); i++)
            {
                Actions builder = new Actions(Driver);
                builder.KeyDown(Keys.Shift).Click(searchSkillsObj.ServiceDetailsLinks[i]).KeyUp(Keys.Shift).Build().Perform();
                var serviceDetailsObj = new ServiceDetails();
                var windowList        = Driver.WindowHandles;
                Driver.SwitchTo().Window(windowList[1]);
                Thread.Sleep(2000);
                Assert.Multiple(() =>
                {
                    Assert.AreEqual(category, serviceDetailsObj.Category.Text);
                    Assert.AreEqual(subcategory, serviceDetailsObj.SubCategory.Text);
                });
                Assert.AreEqual("Online", serviceDetailsObj.LocationType.Text);
                Driver.Close();
                Driver.SwitchTo().Window(windowList[0]);
            }
        }
Esempio n. 15
0
        public void ThenTheSearchResultsShouldBeUpdatedByCategoryAndSubcategory()
        {
            //Validate the result in ServiceDetails Page
            var searchSkillsObj = (SearchSkills)_scenarioContext["searchSkillsObj"];

            for (int i = 0; i < searchSkillsObj.ServiceDetailsLinks.Count(); i++)
            {
                Actions builder = new Actions(Driver);
                builder.KeyDown(Keys.Shift).Click(searchSkillsObj.ServiceDetailsLinks[i]).KeyUp(Keys.Shift).Build().Perform();
                var serviceDetailsObj = new ServiceDetails();
                var windowList        = Driver.WindowHandles;
                Driver.SwitchTo().Window(windowList[1]);
                Thread.Sleep(2000);

                var category    = (string)_scenarioContext["category"];
                var subcategory = (string)_scenarioContext["subcategory"];
                Assert.Multiple(() =>
                {
                    Assert.AreEqual(category, serviceDetailsObj.Category.Text);
                    Assert.AreEqual(subcategory, serviceDetailsObj.SubCategory.Text);
                });

                Assert.AreEqual("Online", serviceDetailsObj.LocationType.Text);
                Driver.Close();
                Driver.SwitchTo().Window(windowList[0]);
            }
        }
        /// <summary>
        ///     The event handler of this entity container which occurs on each
        ///     Request sent to the serivce. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ZGWSAMPLE_SRV_SendingRequest(object sender, System.Data.Services.Client.SendingRequestEventArgs e)
        {   
            HttpWebRequest webRequest = e.Request as HttpWebRequest;

            //ADN Modif
            ServiceDetails serviceDetail = null; // ConfigurationReaderHandler.Instance.GetServiceDetails("ZGWSAMPLE_SRV");
            
            if (serviceDetail == null)
            {
                serviceDetail = new ServiceDetails { Url = @"https://sapes1.sapdevcenter.com:443/sap/opu/odata/sap/ZGWSAMPLE_SRV/", Client = "", SSO = "BASIC" };
            }
			string language = System.Globalization.CultureInfo.CurrentUICulture.Name;
            webRequest.Headers["Accept-Language"] = language;
            BusinessConnectivityHelper.HandleSAPConnectivity(serviceDetail,ref webRequest);

			//The Below section helps you handle delta token. If you wish to use the details then pass the AtomDeltaToken back to your application.
            //To enable this section please set the value of "EnableDeltaToken" for the corresponding service to "Enabled".
            if (serviceDetail.HandleDeltaTokenDecision)
				{
					DataService dataService = new DataService();
					if (webRequest.Method == "GET")
						{
							HttpWebRequest clonedWebRequest = webRequest.CloneRequestForXSRFToken(webRequest.RequestUri.AbsoluteUri);
							HttpWebResponse webResponse = clonedWebRequest.GetResponse() as HttpWebResponse;
							if (webResponse.StatusCode == HttpStatusCode.OK)
								{
									string response = webResponse.ReadResponse();
									this.AtomDeltaToken = dataService.ReadResponse<AtomDeltaTokens>(response);
								}
						}
				}
			}
Esempio n. 17
0
        /// <summary>
        /// Start given service
        /// </summary>
        /// <param name="serviceDetails"></param>
        public async void StartService(ServiceDetails serviceDetails)
        {
            var controller = new ServiceController(serviceDetails.ServiceName);

            try
            {
                if (!controller.Status.ToString().Equals(ServiceStatus.Running.ToString()))
                {
                    TimeSpan timeout = TimeSpan.FromMilliseconds(_timeout);
                    controller.Start();
                    controller.WaitForStatus(ServiceControllerStatus.Running, timeout);

                    Logger.Info("Starting service " + serviceDetails.ServiceName, _type.FullName, "StartService");

                    UpdateServiceStatus(null, null);
                }
                else
                {
                    Logger.Info("Service " + serviceDetails.ServiceName + " :" + controller.Status.ToString(),
                                _type.FullName, "StartService");
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "StartService");
            }
        }
Esempio n. 18
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                CarServiceViewModel.ServiceHeader.DateAdded  = DateTime.Now;
                CarServiceViewModel.ServiceShoppingCart      = _db.ServiceShoppingCart.Include(c => c.ServiceType).Where(c => c.CarId == CarServiceViewModel.Car.Id).ToList();
                CarServiceViewModel.ServiceHeader.TotalPrice = CarServiceViewModel.ServiceShoppingCart.Sum(s => s.ServiceType.Price);
                CarServiceViewModel.ServiceHeader.CarId      = CarServiceViewModel.Car.Id;

                _db.ServiceHeader.Add(CarServiceViewModel.ServiceHeader);
                await _db.SaveChangesAsync();

                foreach (var detail in CarServiceViewModel.ServiceShoppingCart)
                {
                    ServiceDetails serviceDetails = new ServiceDetails
                    {
                        ServiceHeaderId = CarServiceViewModel.ServiceHeader.Id,
                        ServiceName     = detail.ServiceType.Name,
                        ServicePrice    = detail.ServiceType.Price,
                        ServiceTypeId   = detail.ServiceTypeId
                    };

                    _db.ServiceDetails.Add(serviceDetails);
                }
                _db.ServiceShoppingCart.RemoveRange(CarServiceViewModel.ServiceShoppingCart);
                await _db.SaveChangesAsync();

                return(RedirectToPage("../Cars/Index", new { userId = CarServiceViewModel.Car.UserId }));
            }
            return(Page());
        }
Esempio n. 19
0
        public ServiceDetails GetServiceDetails(string serviceID)
        {
            ServiceDetails details = new ServiceDetails();

            try
            {
                DbCommand mycommand = ThirdPartyDB.GetStoredProcCommand("GetServiceCode", serviceID);
                DataTable dt        = ThirdPartyDB.ExecuteDataSet(mycommand).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    details.MerchantID        = dt.Rows[0]["ServiceID"].ToString();
                    details.ServiceName       = dt.Rows[0]["ServiceName"].ToString();
                    details.ServiceCode       = dt.Rows[0]["ServiceCode"].ToString();
                    details.ServiceType       = dt.Rows[0]["ServiceID"].ToString();
                    details.StatusCode        = "0";
                    details.StatusDescription = "SUCCESS";
                }
                else
                {
                    details.StatusCode        = "100";
                    details.StatusDescription = "NOT FOUND";
                }
                return(details);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool RegisterServiceDetail(ServiceDetailsDTO entity)
        {
            try
            {
                ServiceCategory sc1 = new ServiceCategory();
                sc1 = context.categories.Single(o => o.CategoryName == entity.CategoryName);

                Servicio s1 = new Servicio();
                s1.Cost              = entity.Cost;
                s1.Description       = entity.Description;
                s1.Name              = entity.ServiceName;
                s1.ServiceCategoryId = sc1.ServiceCategoryId;
                s1.ServiceCategory   = sc1;

                context.Add(s1);
                context.SaveChanges();

                ServiceDetails sv1 = new ServiceDetails();
                sv1.SupplierId = entity.SupplierId;
                sv1.Supplier   = context.suppliers.Find(entity.SupplierId);
                sv1.ServicioId = context.servicios.OrderByDescending(o => o.ServicioId).First().ServicioId;
                sv1.Servicio   = s1;

                context.Add(sv1);

                context.SaveChanges();
            }
            catch (System.Exception)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 21
0
        private static PropertyOrFieldServiceInfo GetImportedPropertiesAndFields(MemberInfo m, Request req)
        {
            var import = (ImportAttribute)m.GetAttributes(typeof(ImportAttribute)).FirstOrDefault();

            return(import == null ? null : PropertyOrFieldServiceInfo.Of(m)
                   .WithDetails(ServiceDetails.Of(import.ContractType, import.ContractName)));
        }
        public IHttpActionResult AddPartToService(PartOrderServicesViewModel viewModel)
        {
            var partInServiceCenter = _context.PartsInServiceCenters
                                      .Include(p => p.Part)
                                      .SingleOrDefault(p => p.ServiceCenterId == viewModel.ServiceCenterId && p.PartId == viewModel.PartId);

            if (partInServiceCenter == null)
            {
                return(NotFound());
            }

            if (partInServiceCenter.Quantity < viewModel.Quantity)
            {
                return(BadRequest("Недостатня кількість запчастин на складі."));
            }

            var orderServiceInDb = _context.OrderServices.Find(viewModel.OrderServiceId);

            orderServiceInDb.TotalServicePrice += partInServiceCenter.Part.Price * viewModel.Quantity;


            var serviceDetails = new ServiceDetails()
            {
                OrderServiceId        = viewModel.OrderServiceId,
                PartInServiceCenterId = partInServiceCenter.Id,
                Quantity = viewModel.Quantity
            };

            partInServiceCenter.Quantity -= viewModel.Quantity;

            _context.ServiceDetails.Add(serviceDetails);
            _context.SaveChanges();

            return(Ok());
        }
Esempio n. 23
0
        public ServiceDetailsPage()
        {
            try
            {
                InitializeComponent();
                var Servicedata = GetSelectedService();
                ServiceId  = Application.Current.Properties["ServiceID"].ToString();
                service    = new ServiceDetails();
                service.Id = Servicedata.Id;
                var dHour   = Servicedata.DurationInHours * 60;
                var dMinute = Servicedata.DurationInMinutes + dHour;
                service.DurationInMinutes = dMinute + " " + "min";

                //service.DurationInMinutes = Servicedata.DurationInHours + " " + "hrs" + " " + Servicedata.DurationInMinutes + " " + "min";
                service.BufferTimeInMinutes = Servicedata.Buffer + " " + "min";
                service.Cost = "$" + Servicedata.Cost;
                service.Name = Servicedata.Name;
                var category       = GetCategoriesAssignedtoService();
                var CategoryString = "";
                foreach (var item in category)
                {
                    if (item.Confirmed == true)
                    {
                        CategoryString = CategoryString + item.Name + ",";
                    }
                }
                if (CategoryString.Length > 0)
                {
                    service.Categories = CategoryString.Substring(0, CategoryString.Length - 1);
                }
                else
                {
                    service.Categories = "No Category";
                }

                var provider = GetServiceProvider();

                var ProviderString = "";
                foreach (var item in provider)
                {
                    if (item.confirmed == true)
                    {
                        ProviderString = ProviderString + item.FirstName + ",";
                    }
                }
                if (ProviderString.Length > 0)
                {
                    service.ServiceProviders = ProviderString.Substring(0, ProviderString.Length - 1);
                }
                else
                {
                    service.Categories = "No Service";
                }
                BindingContext = service;
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }
Esempio n. 24
0
        void serviceList_SelectedValueChanged(object sender, EventArgs e)
        {
            var service = serviceList.SelectedItem as ServiceDetails;

            if (service == null)
            {
                return;
            }

            dabRadioGraph.Stop();

            if (currentService != null)
            {
                controller.Delete(currentService);
                currentService = null;
            }

            controller.Add(service);
            currentService = service;
            Thread.Sleep(800);

            var result = controller.QueryConnect();

            if (result != FmResult.Ok)
            {
                return;
            }
            dabRadioGraph.Play();
        }
Esempio n. 25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     oServiceDetail   = new ServiceDetails(0, dsn);
     oService         = new Services(0, dsn);
     oResourceRequest = new ResourceRequest(0, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
     }
     if (Request.QueryString["parent"] != null && Request.QueryString["parent"] != "")
     {
         intParent = Int32.Parse(Request.QueryString["parent"]);
     }
     if (Request.QueryString["service"] != null && Request.QueryString["service"] != "")
     {
         intService = Int32.Parse(Request.QueryString["service"]);
     }
     if (Request.QueryString["add"] != null && Request.QueryString["add"] != "")
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add", "<script type=\"text/javascript\">window.parent.navigate(window.parent.location);<" + "/" + "script>");
     }
     if (Request.QueryString["update"] != null && Request.QueryString["update"] != "")
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "update", "<script type=\"text/javascript\">window.parent.navigate(window.parent.location);<" + "/" + "script>");
     }
     if (Request.QueryString["delete"] != null && Request.QueryString["delete"] != "")
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "delete", "<script type=\"text/javascript\">window.parent.navigate(window.parent.location);<" + "/" + "script>");
     }
     if (!IsPostBack)
     {
         if (intID > 0)
         {
             DataSet ds = oServiceDetail.Get(intID);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 lblService.Text    = oService.GetName(intService);
                 lblParent.Text     = (intParent == 0 ? "No Parent" : oServiceDetail.GetName(intParent));
                 txtName.Text       = ds.Tables[0].Rows[0]["name"].ToString();
                 txtHours.Text      = double.Parse(ds.Tables[0].Rows[0]["hours"].ToString()).ToString("F");
                 chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                 btnSave.Text       = "Update";
                 btnSave.Enabled    = true;
                 btnDelete.Enabled  = true;
                 btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this task?');");
             }
         }
         else if (intService > 0)
         {
             lblService.Text = oService.GetName(intService);
             lblParent.Text  = (intParent == 0 ? "No Parent" : oServiceDetail.GetName(intParent));
             btnSave.Text    = "Add";
             btnSave.Enabled = true;
         }
         btnSave.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a task name')" +
                                " && ValidateNumber('" + txtHours.ClientID + "','Please enter a valid number')" +
                                ";");
     }
 }
        public IActionResult GetServiceRequestedList(int VehicleId)
        {
            List <ServiceDetails> serviceDetail = new List <ServiceDetails>();

            try
            {
                DataTable dt = Data.Services.GetServiceRequestListByVehicleId(VehicleId);
                // string row = dt.Tables[0].Rows[0]["ErrorMessage"].ToString();
                //if (row == "Success")
                //{
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        ServiceDetails service = new ServiceDetails();
                        service.ServiceID = (dt.Rows[i]["ServiceID"] == DBNull.Value ? 0 : (int)dt.Rows[i]["ServiceID"]);
                        //service.ServicePlanID = (dt.Rows[i]["ServicePlanID"] == DBNull.Value ? 0 : (int)dt.Rows[i]["ServicePlanID"]);
                        service.ServicePriceChartId = (dt.Rows[i]["ServicePriceChartId"] == DBNull.Value ? 0 : (int)dt.Rows[i]["ServicePriceChartId"]);
                        service.PlanType            = (dt.Rows[i]["PlanType"] == DBNull.Value ? "-" : dt.Rows[i]["PlanType"].ToString());
                        service.Price     = (dt.Rows[i]["Price"] == DBNull.Value ? 0 : (decimal)dt.Rows[i]["Price"]);
                        service.VehicleId = (dt.Rows[i]["VehicleId"] == DBNull.Value ? 0 : (int)dt.Rows[i]["VehicleId"]);
                        service.UserId    = (dt.Rows[i]["UserId"] == DBNull.Value ? 0 : (int)dt.Rows[i]["UserId"]);
                        //service.RemainderMinutes = (dt.Rows[i]["RemainderMinutes"] == DBNull.Value ? 0 : (int)dt.Rows[i]["RemainderMinutes"]);
                        //service.LocationID = (dt.Rows[i]["LocationID"] == DBNull.Value ? 0 : (int)dt.Rows[i]["LocationID"]);
                        //service.IsTeamsandConditionsAccepted = (dt.Rows[i]["IsTeamsandConditionsAccepted"] == DBNull.Value ? false : (bool)dt.Rows[i]["IsTeamsandConditionsAccepted"]);
                        service.PromoCodeApplied     = (dt.Rows[i]["PromoCodeApplied"] == DBNull.Value ? false : (bool)dt.Rows[i]["PromoCodeApplied"]);
                        service.Status               = (dt.Rows[i]["Status"] == DBNull.Value ? "-" : dt.Rows[i]["Status"].ToString());
                        service.Comments             = (dt.Rows[i]["Comments"] == DBNull.Value ? "-" : dt.Rows[i]["Comments"].ToString());
                        service.ScheduleID           = (dt.Rows[i]["ScheduleID"] == DBNull.Value ? 0 : (int)dt.Rows[i]["ScheduleID"]);
                        service.RequestedServiceDate = (dt.Rows[i]["RequestedServiceDate"] == DBNull.Value ? "-" : dt.Rows[i]["RequestedServiceDate"].ToString());
                        service.ActualServiceDate    = (dt.Rows[i]["ActualServiceDate"] == DBNull.Value ? "-" : dt.Rows[i]["ActualServiceDate"].ToString());
                        service.ServiceOutDate       = (dt.Rows[i]["ServiceOutDate"] == DBNull.Value ? "-" : dt.Rows[i]["ServiceOutDate"].ToString());
                        service.ServiceName          = (dt.Rows[i]["ServiceName"] == DBNull.Value ? "-" : dt.Rows[i]["ServiceName"].ToString());
                        service.Description          = (dt.Rows[i]["Description"] == DBNull.Value ? "-" : dt.Rows[i]["Description"].ToString());
                        service.IsAvailable          = (dt.Rows[i]["IsAvailable"] == DBNull.Value ? false : (bool)dt.Rows[i]["IsAvailable"]);


                        serviceDetail.Add(service);
                    }

                    return(StatusCode((int)HttpStatusCode.OK, serviceDetail));
                }

                //}

                else
                {
                    return(StatusCode((int)HttpStatusCode.Forbidden, new { }));
                }
            }


            catch (Exception e)
            {
                string SaveErrorLog = Data.Common.SaveErrorLog("SaveServiceRequest", e.Message);

                return(StatusCode((int)HttpStatusCode.InternalServerError, new { error = new { message = e.Message.ToString() } }));
            }
        }
Esempio n. 27
0
        private async Task ShowServiceDetailsSummary(ServiceDetails service)
        {
            await PopupNavigation.Instance.PushAsync(new ServiceHistoryPopUpView());

            /*await Application.Current.MainPage.DisplayAlert(
             *      service.ReqService, service.Date,
             *      "Ok");
             * return;*/
        }
Esempio n. 28
0
 private static PropertyOrFieldServiceInfo GetImportedProperties(MemberInfo m, Request req)
 {
     if (m.IsDefined(typeof(InjectAttribute), true))
     {
         return(PropertyOrFieldServiceInfo.Of(m)
                .WithDetails(ServiceDetails.Of(ifUnresolved: IfUnresolved.ReturnDefault), req));
     }
     return(null);
 }
Esempio n. 29
0
 public static Func <ParameterInfo, ParameterServiceInfo> GetServiceInfoFromImportAttribute(Request request)
 {
     return(parameter =>
     {
         var import = (ImportAttribute)parameter.GetAttributes(typeof(ImportAttribute)).FirstOrDefault();
         var details = import == null ? ServiceDetails.Default
             : ServiceDetails.Of(import.ContractType, import.ContractName);
         return ParameterServiceInfo.Of(parameter).WithDetails(details);
     });
 }
Esempio n. 30
0
        private CommandResult FindProducers(string[] arg)
        {
            RpcAgentConfiguration consumerConfig = new RpcAgentConfiguration
            {
                LogLevel    = "panic,fatal,error,warn,info,debug",
                LogFile     = new FileInfo("WPWithinConsumer.log"),
                ServicePort = 9096,
            };
            RpcAgentManager consumerAgent = new RpcAgentManager(consumerConfig);

            consumerAgent.StartThriftRpcAgentProcess();
            try
            {
                WPWithinService service = new WPWithinService(consumerConfig);
                service.SetupDevice("Scanner", $".NET Sample Producer scanner running on ${Dns.GetHostName()}");
                List <ServiceMessage> devices = service.DeviceDiscovery(10000).ToList();

                _output.WriteLine("Found total of {0} devices", devices.Count);
                for (int deviceIndex = 0; deviceIndex < devices.Count; deviceIndex++)
                {
                    ServiceMessage device = devices[deviceIndex];
                    _output.WriteLine(
                        $"Device {deviceIndex}) {device.ServerId} running on {device.Hostname}:{device.PortNumber}");
                    _output.WriteLine($"\tDescription: {device.DeviceDescription}, URL Prefix: {device.UrlPrefix}");
                    service.InitConsumer("http://", device.Hostname, device.PortNumber ?? 80, device.UrlPrefix,
                                         device.ServerId,
                                         new HceCard("Bilbo", "Baggins", "Card", "5555555555554444", 11, 2018, "113"));
                    try
                    {
                        List <ServiceDetails> services = service.RequestServices().ToList();
                        _output.WriteLine("\t{0} services found on device {1}", services.Count, deviceIndex);
                        for (int serviceIndex = 0; serviceIndex < services.Count; serviceIndex++)
                        {
                            ServiceDetails svc = services[serviceIndex];
                            _output.WriteLine($"\t\tService {serviceIndex}) {svc.ServiceId}: {svc.ServiceDescription}");
                            List <Price> prices = service.GetServicePrices(svc.ServiceId).ToList();
                            foreach (Price price in prices)
                            {
                                _output.WriteLine("\t\t\tPrice: {0}", price);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        _error.WriteLine(ex);
                    }
                }
            }
            finally
            {
                consumerAgent.StopThriftRpcAgentProcess();
            }
            return(CommandResult.Success);
        }
Esempio n. 31
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                CarServiceVM.ServiceHeader.DateAdded       = DateTime.Now;
                CarServiceVM.ServiceHeader.NextServiceDate = DateTime.Now.AddDays(90);

                CommonValues cv2 = _db.CommonValues.Find(1);

                CarServiceVM.ServiceShoppingCart = _db.ServiceShoppingCart.Include(c => c.ServiceType).Where(c => c.CarId == CarServiceVM.Car.Id).ToList();
                foreach (var item in CarServiceVM.ServiceShoppingCart)
                {
                    CarServiceVM.ServiceHeader.TotalPrice += item.ServiceType.Price * item.Quantity;
                    CarServiceVM.ServiceHeader.TotalPrice  = Math.Round(CarServiceVM.ServiceHeader.TotalPrice, 2);
                    CarServiceVM.ServiceHeader.Tax         = CarServiceVM.ServiceHeader.TotalPrice * cv2.iva;
                    CarServiceVM.ServiceHeader.Tax         = Math.Round(CarServiceVM.ServiceHeader.Tax, 2);
                    CarServiceVM.ServiceHeader.EnvCharge   = cv2.envCharge;
                    CarServiceVM.ServiceHeader.FullPrice   = CarServiceVM.ServiceHeader.Tax + CarServiceVM.ServiceHeader.TotalPrice + CarServiceVM.ServiceHeader.EnvCharge;
                    CarServiceVM.ServiceHeader.FullPrice   = Math.Round(CarServiceVM.ServiceHeader.FullPrice, 2);
                }
                CarServiceVM.ServiceHeader.CarId = CarServiceVM.Car.Id;

                _db.ServiceHeader.Add(CarServiceVM.ServiceHeader);
                await _db.SaveChangesAsync();

                foreach (var detail in CarServiceVM.ServiceShoppingCart)
                {
                    Console.WriteLine(detail.ServiceType.Price);

                    ServiceDetails serviceDetails = new ServiceDetails
                    {
                        ServiceHeaderId = CarServiceVM.ServiceHeader.Id,
                        ServiceName     = detail.ServiceType.Name,
                        ServicePrice    = detail.ServiceType.Price,
                        ServiceTypeId   = detail.ServiceTypeId,
                        Quantity        = detail.Quantity
                    };
                    _db.ServiceDetails.Add(serviceDetails);
                }

                _db.ServiceShoppingCart.RemoveRange(CarServiceVM.ServiceShoppingCart);

                //ACTUALIZACION DE MILLAS
                CarServiceVM.Car.Miles = CarServiceVM.ServiceHeader.Miles;
                _db.Car.Attach(CarServiceVM.Car);
                _db.Entry(CarServiceVM.Car).Property(x => x.Miles).IsModified = true;

                await _db.SaveChangesAsync();

                return(RedirectToPage("../Cars/Index", new { userId = CarServiceVM.Car.UserId }));
            }

            return(RedirectToPage("Create", new { carId = CarServiceVM.Car.Id }));
        }