Inheritance: IService
 public void Init(Service setService)
 {
     service = setService;
     viewModel = new ParticleEditorViewModel(service);
     DataContext = viewModel;
     AttachToUpdateEvents();
 }
    protected void VehicleSearchByClaim_Click(object sender, EventArgs e)
    {
        lstVehiClaim.Items.Clear();
        string claimNum = vehiClaim.Text;
        Service mysr = new Service();
        if(!mysr.loadDbs())
            return;
        int index = mysr.claimIndex(claimNum);
        if (index == -1)
        {
            claimNumlbl.Text = "Couldn't find the claim number";
            return;
        }
        MitchellClaimType RClaim = mysr.backing_store[index];

        for (int i = 0; i < RClaim.Vehicles.count; i++)
        {
            VehicleInfoType vehi = RClaim.Vehicles.VehiclesDetails[i];
            lstVehiClaim.Items.Add("Model Year:      " + vehi.ModelYear);
            lstVehiClaim.Items.Add("Make Description:        " + vehi.MakeDescription);
            lstVehiClaim.Items.Add("Model Description:       " + vehi.ModelDescription);
            lstVehiClaim.Items.Add("Engine Description:      " + vehi.EngineDescription);
            lstVehiClaim.Items.Add("Exterior Color:      " + vehi.ExteriorColor);
            lstVehiClaim.Items.Add("Vin:     " + vehi.Vin);
            lstVehiClaim.Items.Add("License Plate:       " + vehi.LicPlate);
            lstVehiClaim.Items.Add("License Plate State:     " + vehi.LicPlateState);
            lstVehiClaim.Items.Add("License Plate Expiration Date:       " + vehi.LicPlateExpDate);
            lstVehiClaim.Items.Add("Damage Description:      " + vehi.DamageDescription);
            lstVehiClaim.Items.Add("Mileage:     " + vehi.Mileage);
            lstVehiClaim.Items.Add("-----------------END----------------");
        }
    }
示例#3
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 512;

            // Increase disk quota for mbrace filesystem cache.
            string customTempLocalResourcePath = RoleEnvironment.GetLocalResource("LocalMBraceCache").RootPath;
            Environment.SetEnvironmentVariable("TMP", customTempLocalResourcePath);
            Environment.SetEnvironmentVariable("TEMP", customTempLocalResourcePath);

            bool result = base.OnStart();

            _config = Configuration.Default
                        .WithStorageConnectionString(CloudConfigurationManager.GetSetting("MBrace.StorageConnectionString"))
                        .WithServiceBusConnectionString(CloudConfigurationManager.GetSetting("MBrace.ServiceBusConnectionString"));

            _svc =
                RoleEnvironment.IsEmulated ?
                new Service(_config) : // Avoid long service names when using emulator
                new Service(_config, serviceId: RoleEnvironment.CurrentRoleInstance.Id.Split('.').Last());

            _svc.AttachLogger(new CustomLogger(s => Trace.WriteLine(String.Format("{0} : {1}", DateTime.UtcNow, s))));

            RoleEnvironment.Changed += RoleEnvironment_Changed;

            return result;
        }
        public USB_Rejoin(Service s, string sl)
        {
            InitializeComponent();

            service = s;
            serial.Text = sl;
        }
 public void Init(Service service)
 {
     DataContext = contentManagerViewModel = new ContentManagerViewModel(service);
     service.ContentUpdated += (type, name) =>
     {
         RefreshContentList();
         ContentLoader.RemoveResource(name);
         if (isContentReadyForUse)
             Dispatcher.Invoke(
                 new Action(
                     () =>
                         contentManagerViewModel.SelectedContent =
                             new ContentIconAndName(contentManagerViewModel.GetContentTypeIcon(type), name)));
     };
     service.ContentDeleted += name =>
     {
         RefreshContentList();
         ContentLoader.RemoveResource(name);
     };
     service.ProjectChanged += () =>
     {
         isContentReadyForUse = false;
         RefreshContentList();
     };
     service.ContentReady += () =>
     {
         Dispatcher.Invoke(new Action(contentManagerViewModel.ShowStartContent));
         isContentReadyForUse = true;
     };
 }
示例#6
0
 public int Run(IList<string> commandLineArguments, Memory memory, ProgressReporter reporter)
 {
     service = new Service(memory);
     ParseCommandLine(commandLineArguments, memory);
     new Interpreter(messenger, assemblyPaths, service).ProcessInstructions();
     return 0;
 }
        public static DisaSettings Load(Service ds)
        {
            var path = GetPath(ds);

            if (!File.Exists(path))
            {
                return null;
            }

            try
            {
                using (var sr = new StreamReader(path))
                {
                    var loadedObj = Load(sr, ds.Information.Settings);

                    return loadedObj;
                }
            }
            catch (Exception ex)
            {
                Utils.DebugPrint("Failed (exception) to load settings for "
                + ds.Information.ServiceName + ". Nuking!");
                File.Delete(path);
                return null;
            }
        }
        private MessageHeader CreateMessageHeader()
        {
            MessageHeader msgHeader = new MessageHeader();
            msgHeader.ConversationId = "TestSession";

            From from = new From();
            PartyId fromPartyId = new PartyId();
            PartyId[] fromPartyIdArr = new PartyId[1];
            fromPartyId.Value = "WebServiceClient";
            fromPartyIdArr[0] = fromPartyId;
            from.PartyId = fromPartyIdArr;
            msgHeader.From = from;

            To to = new To();
            PartyId toPartyId = new PartyId();
            PartyId[] toPartyIdArr = new PartyId[1];
            toPartyId.Value = "WebServiceSupplier";
            toPartyIdArr[0] = toPartyId;
            to.PartyId = toPartyIdArr;
            msgHeader.To = to;

            msgHeader.CPAId = "4REG";
            msgHeader.Action = "HotelPropertyDescriptionLLSRQ";
            Service service = new Service();
            service.Value = "HotelPropertyDescriptionLLSRQ";
            msgHeader.Service = service;

            MessageData msgData = new MessageData();
            msgData.MessageId = "mid:[email protected]";
            //msgData.Timestamp = tstamp;
            msgHeader.MessageData = msgData;
            return msgHeader;
        }
示例#9
0
        public AddWindow(Requests request, Service.Service service)
        {
            this.InitializeComponent();
            this.InitializeMembers(service);
            this.InitializeComboBoxes();

            // Fill TextBoxes
            this.textBoxClient.Text = request.Clients.FullName;
            this.textBoxAdress.Text = request.Address;
            this.textBoxComment.Text = request.Comment;

            // Fill ComboBoxes
            this.comboBoxServices.SelectedIndex     = this.comboBoxServices.FindStringExact(request.Services.Name);
            this.comboBoxOperators.SelectedIndex    = this.comboBoxOperators.FindStringExact(request.Operators.FullName);
            this.comboBoxMasters.SelectedIndex      = this.comboBoxMasters.FindStringExact(request.Masters.FullName);

            // Fill DateTimePickers
            this.dateTimePickerRequest.Value = request.RequestDate;
            this.dateTimePickerCloseRequest.Value = request.CloseDate ?? DateTime.Now;
            this.dateTimePickerDepature.Value = request.DateOfDeparture ?? DateTime.Now;

            this.buttonAdd.Text = "Изменить";
            this.isEditMode = true;
            this.requestToEdit = request;
        }
示例#10
0
文件: Input.cs 项目: vokac/F2B
        public InputProcessor(ProcessorElement config, Service service)
            : base(config, service)
        {
            itype = null;
            if (config.Options["type"] != null && !string.IsNullOrEmpty(config.Options["type"].Value))
            {
                itype = new Regex(config.Options["type"].Value);
            }

            input = null;
            if (config.Options["input"] != null && !string.IsNullOrEmpty(config.Options["input"].Value))
            {
                input = new Regex(config.Options["input"].Value);
            }

            selector = null;
            if (config.Options["selector"] != null && !string.IsNullOrEmpty(config.Options["selector"].Value))
            {
                selector = new Regex(config.Options["selector"].Value);
            }

            if (input == null && itype == null && selector == null)
            {
                Log.Warn("input type, input name and selector name regexp is empty (all events will pass this configuration)");
            }
        }
        private static DisaServiceUserSettings Load(Service service)
        {
            var path = GetPath(service);
            if (!File.Exists(path))
            {
                return null;
            }

            try
            {
                using (var sr = new StreamReader(path))
                {
                    var serializer = new XmlSerializer(typeof(DisaServiceUserSettings));
                    return (DisaServiceUserSettings) serializer.Deserialize(sr);
                }
            }
            catch (Exception ex)
            {
                Utils.DebugPrint("Failed to load service user settings for " + service.Information.ServiceName +
                    ". Corruption. Nuking... " + ex.Message);
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }

            return null;
        }
示例#12
0
        private void btnSyncNewWords_Click(object sender, EventArgs e)
        {
            var uid = Convert.ToInt32(txbUserId.Text);
            ShowMessage("读取用户生词本...");
            //读取用户不认识的词
            var newWordList = HujiangWebService.GetUserItems(uid, Convert.ToDateTime("2000-1-1"));

            ShowMessage("生词:" + newWordList.Count + "个");
            //dbOperator.SaveUserNewWords(newWordList);
            ShowMessage("读取用户背诵记录...");
            //读取用户背诵过的书和单元,得到用户已认识词列表
            var histories = new Dictionary<int, int>();
            var userBooks = HujiangWebService.GetPublicBooks(uid, "en");
            foreach (var userBook in userBooks)
            {
                var unitId = HujiangWebService.GetUserUnitMax(uid, userBook.BookID);
                if (unitId > 0)
                {
                    richTextBox1.AppendText(userBook.BookName + " UnitId:" + unitId + "\r\n");
                    histories.Add(userBook.BookID, unitId);
                }
            }
            //将用户记录写入数据库
            //dbOperator.SaveUserLearnHistory(histories);
            ShowMessage("统计用户的已知和未知词汇...");
            var list = CalcUserVocabulary(newWordList, histories);
            foreach (var vocabulary in list)
            {
                ShowMessage(vocabulary.ToString());
            }
            ShowMessage("开始同步到本地");
            Service service = new Service();
            service.SaveUserVocabulary(list,"开心词场");
            ShowMessage("同步完成");
        }
示例#13
0
 public Manager()
 {
     dbus_connection = Bus.GetSystemBus();
     dbus_service = Service.Get(dbus_connection, INTERFACE_NAME);
     manager = (ManagerProxy)dbus_service.GetObject(typeof(ManagerProxy), PATH_NAME);
     dbus_service.SignalCalled += OnSignalCalled;
 }
        public ActionResult AddCategory(Service.DTO.CategoryModel category, IEnumerable<HttpPostedFileBase> images)
        {
            if(!ModelState.IsValid)
            {
                return View(category);
            }

            //Service.DTO.ImageModel imageToSave = new Service.DTO.ImageModel();
            //category.Images = new List<Service.DTO.ImageModel>();
            //if (images != null)
            //{
            //    foreach (HttpPostedFileBase image in images)
            //    {

            //        if (image != null)
            //        {
            //            //TODO: Felmeddelande om filen inte är en bild
            //            if (IsImage(image) == false) return RedirectToAction("AddCategory");

            //            imageToSave = new Service.DTO.ImageModel();
            //            imageToSave.ImageData = new byte[image.ContentLength];
            //            imageToSave.ImageMimeType = image.ContentType;
            //            image.InputStream.Read(imageToSave.ImageData, 0, image.ContentLength);
            //            category.Images.Add(imageToSave);

            //        }
            //    }
            //}

            Service.DTO.CategoryModel cat = categoryService.SaveCategory(category);
            //TODO: Maybe check if 'cat' is null, meaning it wasn't saved

            return RedirectToAction("Category", new { id = cat.Id });
        }
        public MedicsWindow()
        {
            InitializeComponent();

            medico = new Medicos();

            medic = new Medic();
            service = new Service();
            speciality = new Speciality();


            medics = medic.GetAll();
            medicsGrid.ItemsSource = medics.ToArray();

            services = service.GetAll();
            foreach (ServicioMedico service in services)
            {
                comboService.Items.Add(service.nombre + " - " + service.descripcion);
            }

            specialities = speciality.GetAll();
            foreach (Especialidades speciality in specialities)
            {
                comboSpeciality.Items.Add(speciality.nombre + " - " + speciality.descripcion);
            }


        }
示例#16
0
        public static Service ToService(this IResolvableService service)
        {
            var entry = service.HostEntry;

            var found = new Service {
                Host = { Name = entry.HostName, Address = entry.AddressList[0].ToString() },
                Port = service.Port,
                Type = service.RegType,
                Domain = service.ReplyDomain,
                Name = service.Name
            };

            var records = service.TxtRecord;
            if (records != null && records.Count > 0) {
                foreach (TxtRecordItem record in records) {
                    found.Records.Add(
                        new TxtRecord {
                            Name = record.Key,
                            Value = record.ValueString
                        });
                }
            }

            return found;
        }
示例#17
0
        public EditWindow(Service.Service service, int rowIndex, object selectedItem, DataGrid grid)
        {
            InitializeComponent();
            this.selectedItem = selectedItem;
            this.service = service;
            this.rowIndex = rowIndex;
            this.grid = grid;
            this.grid.IsReadOnly = true;

            List<String> categories = new List<String>();
            categories.Add("Discount pris");
            categories.Add("Hverdags oste");
            categories.Add("Luxus oste");
            categories.Add("Eksklusive oste");
            categories.Add("Styk ost");
            categories.Add("Osteborde");

            comboBoxCategoryEdit.ItemsSource = categories.ToList();

            TxtName.Text = service.filldata(service.getProducts()).Rows[rowIndex]["name"].ToString();
            txtUnitprice.Text = service.filldata(service.getProducts()).Rows[rowIndex]["unitPrice"].ToString();
            txtCountAvailable.Text = service.filldata(service.getProducts()).Rows[rowIndex]["countAvailable"].ToString();
            txtCountry.Text = service.filldata(service.getProducts()).Rows[rowIndex]["country"].ToString();
            txtDescription.Text = service.filldata(service.getProducts()).Rows[rowIndex]["description"].ToString();
        }
        public void TestManyClientsConcurencyOnNamedPipe()
        {
            var address = @"net.pipe://127.0.0.1/testpipename" + MethodBase.GetCurrentMethod().Name;
            var srv = new Service();
            using (var server = new ServiceHost(srv, new Uri(address)))
            {
                server.AddServiceEndpoint(typeof(IService), new NetNamedPipeBinding { }, address);
                server.Open();
                var requests = new List<Task>();
                for (int i = 0; i < 20; i++)
                {

                    var task = new Task(
                        () =>
                        {
                            using (var channelFactory = new ChannelFactory<IService>(new NetNamedPipeBinding { }))
                            {
                                var client = channelFactory.CreateChannel(new EndpointAddress(address));
                                client.Execute();
                            }
                            });
                    requests.Add(task);
                }
                foreach (var request in requests)
                {
                    request.Start();
                }
                Task.WaitAll(requests.ToArray());
                Assert.AreEqual(20, srv.Count);
            }
        }
 public DependencyScopeExtensionsTests()
 {
     _resolverMock = new Mock<IDependencyScope>();
     _resolver = _resolverMock.Object;
     _service1 = new Service();
     _service2 = new Service();
 }
 /// <summary>
 /// Gets the service description for service.
 /// </summary>
 /// <param name="service">The service to get the cache for.</param>
 public ServiceDescription this[Service service]
 {
     get
     {
         return this[service.COMDevice, service.COMService];
     }
 }
示例#21
0
        public TmbCommand( Service.IVolumeManager volumeManager,
			Service.IImageEditorService imageEditorService, Config.IConnectorConfig config )
        {
            _volumeManager = volumeManager;
            _imageEditorService = imageEditorService;
            _config = config;
        }
示例#22
0
        private void Run()
        {
            Console.WriteLine("Run a ServiceHost via programmatic configuration...");
            Console.WriteLine();

            string baseAddress = "http://" + Environment.MachineName + ":8000/Service.svc";
            Console.WriteLine("BaseAddress: {0}", baseAddress);

            using (ServiceHost serviceHost = new ServiceHost(typeof(Service)))
            {
                Console.WriteLine("Opening the host");
                serviceHost.Open();

                try
                {
                    var service = new Service();
                    Console.WriteLine(service);
                    Console.WriteLine("The service is ready.");
                    Console.WriteLine("Press <ENTER> to terminate service.");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error on initializing the service host.");
                    Console.WriteLine(ex.Message);
                }

                Console.WriteLine();
                Console.ReadLine();
                serviceHost.Close();
            }
        }
示例#23
0
 public ComposeBubble(long time, BubbleDirection direction, Service service, 
     VisualBubble bubbleToSend, Contact.ID[] ids) 
     : base(time, direction, service)
 {
     Ids = ids;
     BubbleToSend = bubbleToSend;
 }
示例#24
0
 internal MessageIntradayTick(CorrelationID corr, Service service)
     : base(new Name("IntradayTickResponse"), corr, service)
 {
     this._parent = null;
     this._responseError = new ElementIntradayTickResponseError();
     this._isResponseError = true;
 }
 /// <summary>
 /// Registers the domain sync APIs in the provided service.
 /// </summary>
 /// <param name="service">The provided service.</param>
 public void RegisterDomainSyncAPI(Service service)
 {
     service["serverSync.getDoR"] = (Func<string>)GetDoR;
     service["serverSync.getDoI"] = (Func<string>)GetDoI;
     service["serverSync.updateDoI"] = (Action<Connection, string>)HandleRemoteDoIChanged;
     service["serverSync.updateDoR"] = (Action<Connection, string>)HandleRemoteDoRChanged;
 }
示例#26
0
文件: Sleep.cs 项目: vokac/F2B
        public SleepProcessor(ProcessorElement config, Service service)
            : base(config, service)
        {
            mode = SleepMode.Normal;
            if (config.Options["mode"] != null && !string.IsNullOrEmpty(config.Options["mode"].Value))
            {
                foreach (SleepMode item in Enum.GetValues(typeof(SleepMode)))
                {
                    if (item.ToString().ToLower().Equals(config.Options["mode"].Value.ToLower()))
                        mode = item;
                }
            }

            interval = null;
            if (config.Options["interval"] != null && !string.IsNullOrEmpty(config.Options["interval"].Value))
            {
                interval = config.Options["interval"].Value;
            }
            else
            {
                Log.Warn("sleep interval not defined");
            }

            if (mode == SleepMode.Random)
            {
                rnd = new Random();
            }
        }
示例#27
0
 internal MessageIntradayTick(CorrelationID corr, Service service, Dictionary<DateTime, Tuple<string, double, int>> ticks, bool includeConditionCodes)
     : base(new Name("IntradayTickResponse"), corr, service)
 {
     this._parent = new ElementIntradayTickDataParent(ticks, includeConditionCodes);
     this._responseError = null;
     this._isResponseError = false;
 }
示例#28
0
        private static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

            if (!Environment.UserInteractive) // Running as service
            {
                using (var service = new Service())
                    ServiceBase.Run(service);
            }
            else // Running as console app
            {
                var parameter = string.Concat(args);
                switch (parameter)
                {
                    case "--install":
                        ManagedInstallerClass.InstallHelper(new[]
                        {"/LogFile=", Assembly.GetExecutingAssembly().Location});
                        return;

                    case "--uninstall":
                        ManagedInstallerClass.InstallHelper(new[]
                        {"/LogFile=", "/u", Assembly.GetExecutingAssembly().Location});
                        return;
                }
                Start(args);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ComponentNotRegisteredException"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="innerException">The inner exception.</param>
 public ComponentNotRegisteredException(Service service, Exception innerException)
     : base(string.Format(CultureInfo.CurrentCulture,
     ComponentNotRegisteredExceptionResources.Message, 
     Enforce.ArgumentNotNull(service, "service")),
     innerException)
 {
 }
示例#30
0
文件: Base.cs 项目: vokac/F2B
 public BaseProcessor(ProcessorElement config, Service service)
 {
     Name = config.Name;
     goto_next = config.Goto.Next;
     goto_error = config.Goto.Error;
     Service = service;
 }
示例#31
0
 /// <summary>
 /// Registers the component sync APIs in the provided service.
 /// </summary>
 /// <param name="service">The provided service.</param>
 public void RegisterComponentSyncAPI(Service service)
 {
     service["serverSync.registerComponentDefinition"] =
         (Action <Connection, ComponentDef>)HandleRemoteRegisteredComponentDefinition;
 }
示例#32
0
 public override void OnEnter()
 {
     Service.Get <EventDispatcher>().DispatchEvent(default(QuestEvents.CancelQuestHint));
     Finish();
 }
示例#33
0
            private void _read()
            {
                _name        = new DomainName(m_io, this, m_root);
                _type        = ((DnsPacket.TypeType)m_io.ReadU2be());
                _answerClass = ((DnsPacket.ClassType)m_io.ReadU2be());
                _ttl         = m_io.ReadS4be();
                _rdlength    = m_io.ReadU2be();
                switch (Type)
                {
                case DnsPacket.TypeType.Mx: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new MxInfo(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Ptr: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new DomainName(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Soa: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new AuthorityInfo(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Cname: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new DomainName(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Aaaa: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new AddressV6(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Txt: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new TxtBody(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Ns: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new DomainName(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.Srv: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new Service(io___raw_payload, this, m_root);
                    break;
                }

                case DnsPacket.TypeType.A: {
                    __raw_payload = m_io.ReadBytes(Rdlength);
                    var io___raw_payload = new KaitaiStream(__raw_payload);
                    _payload = new Address(io___raw_payload, this, m_root);
                    break;
                }

                default: {
                    _payload = m_io.ReadBytes(Rdlength);
                    break;
                }
                }
            }
示例#34
0
 public EngineRuntime GetRuntime(string engineId)
 {
     return(Service?.GetOrCreateRuntime(engineId));
 }
        public IActionResult JoinDivision(int Page = 1, int Size = 25, string Order = "{}", [Bind(Prefix = "Select[]")] List <string> Select = null, string Keyword = "", string Filter = "{}")
        {
            try
            {
                Tuple <List <CategoryViewModel>, int, Dictionary <string, string> > Data = Service.JoinDivision(Page, Size, Order, Keyword, Filter);

                Dictionary <string, object> Result =
                    new ResultFormatter(ApiVersion, General.OK_STATUS_CODE, General.OK_MESSAGE)
                    .Ok <CategoryViewModel>(Data.Item1, Page, Size, Data.Item2, Data.Item1.Count, Data.Item3, new List <string>());

                return(Ok(Result));
            }
            catch (Exception e)
            {
                Dictionary <string, object> Result =
                    new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                    .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result));
            }
        }
示例#36
0
        protected virtual IDictionary ParseRequest(JsonReader input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            JsonReader        reader   = input; // alias for clarity
            JsonImportHandler importer = JsonImporter;

            JsonObject request      = new JsonObject();
            Method     method       = null;
            JsonReader paramsReader = null;
            object     args         = null;

            try
            {
                reader.ReadToken(JsonTokenClass.Object);

                while (reader.TokenClass != JsonTokenClass.EndObject)
                {
                    string memberName = reader.ReadMember();

                    switch (memberName)
                    {
                    case "id":
                    {
                        request["id"] = importer(AnyType.Value, reader);
                        break;
                    }

                    case "method":
                    {
                        string methodName = reader.ReadString();
                        request["method"] = methodName;
                        method            = Service.GetClass().GetMethodByName(methodName);

                        if (paramsReader != null)
                        {
                            //
                            // If the parameters were already read in and
                            // buffer, then deserialize them now that we know
                            // the method we're dealing with.
                            //

                            args         = ReadParameters(method, paramsReader, importer);
                            paramsReader = null;
                        }

                        break;
                    }

                    case "params":
                    {
                        //
                        // Is the method already known? If so, then we can
                        // deserialize the parameters right away. Otherwise
                        // we record them until hopefully the method is
                        // encountered.
                        //

                        if (method != null)
                        {
                            args = ReadParameters(method, reader, importer);
                        }
                        else
                        {
                            JsonRecorder recorder = new JsonRecorder();
                            recorder.WriteFromReader(reader);
                            paramsReader = recorder.CreatePlayer();
                        }

                        break;
                    }

                    default:
                    {
                        reader.Skip();
                        break;
                    }
                    }
                }

                reader.Read();

                if (args != null)
                {
                    request["params"] = args;
                }

                return(request);
            }
            catch (JsonException e)
            {
                throw new BadRequestException(e.Message, e, request);
            }
            catch (MethodNotFoundException e)
            {
                throw new BadRequestException(e.Message, e, request);
            }
        }
示例#37
0
    protected void btnIngresar_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtIngresoRut.Text == "")
            {
                return;
            }
            Formatos objFor = new Formatos();
            string   crut   = "";
            string   pasww;

            Validaciones objValida   = new Validaciones();
            string       RutValidado = objValida.ValidaRut(txtIngresoRut.Text);
            txtIngresoRut.Text       = RutValidado;
            Session["RutFormateado"] = RutValidado;
            if (RutValidado == "n")
            {
                Response.Write("<script>alert('Rut no valido')</script>");
                txtIngresoRut.Text = "";
            }
            else
            {
                crut = objFor.QuitaFormatoRut(txtIngresoRut.Text);

                txtIngresoRut.Text = Session["RutFormateado"].ToString();
                pasww = txtPasword.Text;
                string strXmlAutentica;
                //<ParametrosIn Rut="1106757" Paswword="1111" />
                //11067573
                strXmlAutentica = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
                strXmlAutentica = "<ParametrosIn Rut=\"" + crut + "\" Password=\"" + pasww + "\" />";

                //localhost.Service objService = new localhost.Service();
                //string XmlAutentica = objService.AutenticaUsuario(crut, pasww);

                Service  objService   = new Service();
                Encripta objEnc       = new Encripta();
                string   rutencr      = objEnc.Encrit(pasww);
                string   XmlAutentica = objService.AutenticaUsuario(crut, pasww);
                //string XmlAutentica = "<ParametrosOut><Autorizacion cCodigo=\"0\" Mensaje=\"Autorizado\"/><Perfiles><Perfil cPerfil=\"1\" tPetfil=\"Socio\"/><Perfil cPerfil=\"2\" tPetfil=\"Ahorrante\"/></Perfiles></ParametrosOut>";
                txtPasword.Text = XmlAutentica;
                ////////////////////////
                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(XmlAutentica);
                string      strMensaje = "";
                string      strcCodigo = "";
                XmlNodeList lista      = xDoc.GetElementsByTagName("Autorizacion");
                // XmlNodeList lista = ((XmlElement)personas[0]).GetElementsByTagName("Producto");
                foreach (XmlElement nodo in lista)
                {
                    strcCodigo = nodo.GetAttribute("cCodigo");
                    strMensaje = nodo.GetAttribute("Mensaje");
                    //cCodigo = 1 "aceptado 2 Rechazado
                }
                ////////////////////////
                string prueba = strcCodigo;
                if (strcCodigo == "0")
                {
                    //Response.Write("<script>alert('Socio existe')</script>");
                    //carga variables de session
                    string strXmlPersonas = objService.TraePersonas(Int32.Parse(crut));

                    xDoc.LoadXml(strXmlPersonas);

                    string      idCliente      = "";
                    string      NombreCompleto = "";
                    string      NumeroControl  = "";
                    XmlNodeList lista2         = xDoc.GetElementsByTagName("Persona");
                    XmlNodeList lista3         = ((XmlElement)lista2[0]).GetElementsByTagName("DatosPersonales");

                    foreach (XmlElement nodo in lista3)
                    {
                        XmlNodeList idCliente2 = nodo.GetElementsByTagName("IdCliente");
                        idCliente = idCliente2[0].InnerText;
                        XmlNodeList objNombre = nodo.GetElementsByTagName("NombreCompleto");
                        NombreCompleto = objNombre[0].InnerText;
                        XmlNodeList objControl = nodo.GetElementsByTagName("cControl");
                        NumeroControl = objControl[0].InnerText;
                    }
                    //Response.Write (NumeroControl);
                    //cargado Session["RutFormateado"];
                    Session["NombreCompleto"] = NombreCompleto;
                    Session["IdCliente"]      = idCliente;
                    Session["PaginaActiva"]   = "1";

                    Session["CargaPagina"] = "1";

                    //fin carga
                    //if (Int32.Parse(NumeroControl) == 1)
                    //    Response.Redirect("CambioPasword.aspx");

                    Response.Redirect("CargaSaldos.aspx?crut=" + crut);

                    //Response.Redirect("FondoInicio.aspx?crut=" + crut);
                }
                else
                {
                    // Response.Write("<script Language=\"javascript\" runat=\"server\">alert('Socio no existe');window.location.href='http://" + Session["IpServidor"].ToString() +"/sitiowebandescoop/default.aspx';</script>");
                    Response.Write("<script>alert('Usuario Incorrecto');window.location='default.aspx';</script>");
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "MensageTransaccionRuta('Usuario Incorrecto','default.aspx');", true);
                    return;
                }


                txtIngresoRut.Text = "";
                txtPasword.Text    = "";
                txtPasword.Focus();
            }
        }
        catch (Exception ex) {
            Response.Write("<script>alert('" + ex.Message.Normalize().Replace("'", "") + "');window.location='default.aspx';</script>");
        }
    }
        RegisterGeneratedFactory <TLimit>(ContainerBuilder builder, Type delegateType, Service service)
        {
            var activatorData = new GeneratedFactoryActivatorData(delegateType, service);

            var rb = new RegistrationBuilder <TLimit, GeneratedFactoryActivatorData, SingleRegistrationStyle>(
                new TypedService(delegateType),
                activatorData,
                new SingleRegistrationStyle());

            builder.RegisterCallback(cr => RegistrationBuilder.RegisterSingleComponent(cr, rb));

            return(rb.InstancePerLifetimeScope());
        }
 protected async override Task PutEntity(EntityImageViewModel model)
 => await Service.PutEntity(new Product { Id = model.Id, Name = model.Name, Image = model.Image });
        IEnumerator Start()
        {
            yield return(null);

            Service <SoundManager> .Get().PlayFx(_sound, _channel, IsInterrupt);
        }
示例#41
0
        private void btnShowRecords_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                WorkAsync(new WorkAsyncInfo
                {
                    Message = "Loading deleted records...",
                    Work    = (w, ev) =>
                    {
                        Guid selectedUser     = (Guid)ddlUsers.SelectedValue;
                        List <AuditItem> data = new List <Model.AuditItem>();
                        FetchExpression query = null;
                        Tuple <int, string, string> selectedEntity = (Tuple <int, string, string>)ddlEntities.SelectedItem;
                        string auditFetchXml;
                        if (selectedUser == Guid.Empty)
                        {
                            auditFetchXml = string.Format(ConnectionDetail.OrganizationMajorVersion < 8 ?
                                                          FetchXml.DeletedAuditLogs.Replace("regardingobject", "object") :
                                                          FetchXml.DeletedAuditLogs,
                                                          dateFrom.Value.ToString("yyyy-MM-dd"),
                                                          dateTo.Value.AddDays(1).ToString("yyyy-MM-dd"),
                                                          ddlEntities.SelectedValue);
                        }
                        else
                        {
                            auditFetchXml = string.Format(ConnectionDetail.OrganizationMajorVersion < 8 ?
                                                          FetchXml.DeleteAuditLogsByUser.Replace("regardingobject", "object") :
                                                          FetchXml.DeleteAuditLogsByUser,
                                                          dateFrom.Value.ToString("yyyy-MM-dd"),
                                                          dateTo.Value.AddDays(1).ToString("yyyy-MM-dd"),
                                                          ddlEntities.SelectedValue,
                                                          selectedUser);
                        }
                        query           = new FetchExpression(auditFetchXml);
                        var queryResult = Service.RetrieveMultiple(query);
                        foreach (Entity item in queryResult.Entities)
                        {
                            RetrieveAuditDetailsRequest auditDetailRequest = new RetrieveAuditDetailsRequest();
                            auditDetailRequest.AuditId            = item.Id;
                            RetrieveAuditDetailsResponse response = (RetrieveAuditDetailsResponse)Service.Execute(auditDetailRequest);
                            AttributeAuditDetail attributeDetail  = (AttributeAuditDetail)response.AuditDetail;
                            EntityMetadata metadata = entityMetadataList.FirstOrDefault(x => (x.ObjectTypeCode == selectedEntity.Item1));
                            AuditItem auditItem     = new Model.AuditItem()
                            {
                                AuditId      = item.Id,
                                DeletedBy    = ((EntityReference)item["userid"]).Name,
                                DeletionDate = (DateTime)item["createdon"],
                                Entity       = ((EntityReference)item["objectid"]).LogicalName,
                                RecordId     = ((EntityReference)item["objectid"]).Id,
                                AuditDetail  = attributeDetail,
                                Metadata     = metadata
                            };

                            if (selectedEntity.Item3 != null && attributeDetail.OldValue.Contains(selectedEntity.Item3))
                            {
                                auditItem.Name = attributeDetail.OldValue[selectedEntity.Item3].ToString();
                            }

                            data.Add(auditItem);
                        }

                        ev.Result = data.OrderByDescending(x => x.DeletionDate).ToList();
                    },
                    ProgressChanged = ev =>
                    {
                        // If progress has to be notified to user, use the following method:
                        SetWorkingMessage("Loading entities with auditing enabled...");
                    },
                    PostWorkCallBack = ev =>
                    {
                        GridDeletedRecords.DataSource = ev.Result;
                    },
                    AsyncArgument = null,
                    IsCancelable  = true,
                    MessageWidth  = 340,
                    MessageHeight = 150
                });
            }
        }
示例#42
0
        public async Task DeleteDataAsync(List <string> ids)
        {
            await DeleteAsync(ids);

            await Service.DeleteAsync <Base_RoleAction>(x => ids.Contains(x.RoleId));
        }
示例#43
0
        private void menuLoadEntities_Click(object sender, EventArgs e)
        {
            List <Tuple <int, string, string> > data = new List <Tuple <int, string, string> >();

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Loading entities with auditing enabled...",
                Work    = (w, ev) =>
                {
                    RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();
                    metaDataRequest.EntityFilters = EntityFilters.Attributes;

                    var metaDataResponse = (RetrieveAllEntitiesResponse)Service.Execute(metaDataRequest);

                    var entities = metaDataResponse.EntityMetadata;
                    foreach (var item in entities)
                    {
                        if (item.IsAuditEnabled.Value)
                        {
                            data.Add(new Tuple <int, string, string>(item.ObjectTypeCode.Value, item.DisplayName.UserLocalizedLabel.Label, item.PrimaryNameAttribute));
                            entityMetadataList.Add(item);
                        }
                    }

                    ev.Result = data.OrderBy(x => (x.Item2)).ToList();
                },
                ProgressChanged = ev =>
                {
                    // If progress has to be notified to user, use the following method:
                    SetWorkingMessage("Loading entities with auditing enabled...");
                },
                PostWorkCallBack = ev =>
                {
                    ddlEntities.DataSource    = ev.Result;
                    ddlEntities.DisplayMember = "Item2";
                    ddlEntities.ValueMember   = "Item1";
                },
                AsyncArgument = null,
                IsCancelable  = true,
                MessageWidth  = 340,
                MessageHeight = 150
            });

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Loading users...",
                Work    = (w, ev) =>
                {
                    List <KeyValuePair <Guid, string> > users = new List <KeyValuePair <Guid, string> >();

                    FetchExpression query = new FetchExpression(FetchXml.LicencedUsers);
                    var queryResult       = Service.RetrieveMultiple(query);
                    users.Add(new KeyValuePair <Guid, string>(Guid.Empty, "All Users"));
                    foreach (var item in queryResult.Entities)
                    {
                        users.Add(new KeyValuePair <Guid, string>(item.Id, item.Attributes["fullname"] != null ? item.Attributes["fullname"].ToString() : string.Empty));
                    }

                    ev.Result = users;
                },
                ProgressChanged = ev =>
                {
                    // If progress has to be notified to user, use the following method:
                    SetWorkingMessage("Loading users...");
                },
                PostWorkCallBack = ev =>
                {
                    ddlUsers.DataSource    = (List <KeyValuePair <Guid, string> >)ev.Result;
                    ddlUsers.DisplayMember = "Value";
                    ddlUsers.ValueMember   = "Key";
                },
                AsyncArgument = null,
                IsCancelable  = true,
                MessageWidth  = 340,
                MessageHeight = 150
            });
        }
示例#44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceRegistrationInfo"/> class.
 /// </summary>
 /// <param name="service">The tracked service.</param>
 public ServiceRegistrationInfo(Service service)
 {
     _service = service;
 }
示例#45
0
 protected override void Insert(ProductMediaFile entity)
 {
     Service.InsertProductPicture(entity);
 }
示例#46
0
        private void menuRestore_Click(object sender, EventArgs e)
        {
            DialogResult diag            = MessageBox.Show("Are you sure would like to restore these deleted records?", "Confirmation", MessageBoxButtons.YesNo);
            bool         recordsSelected = false;
            string       errorMessage    = string.Empty;

            if (diag.ToString().ToUpperInvariant() == "YES")
            {
                WorkAsync(new WorkAsyncInfo
                {
                    Message = "Restoring data...",
                    Work    = (w, ev) =>
                    {
                        try
                        {
                            for (int i = 0; i < GridDeletedRecords.Rows.Count; i++)
                            {
                                DataGridViewRow row = GridDeletedRecords.Rows[i];
                                DataGridViewCheckBoxCell checkBoxCell = (DataGridViewCheckBoxCell)row.Cells[0];
                                if (checkBoxCell.Value != null && (bool)checkBoxCell.Value)
                                {
                                    recordsSelected = true;
                                    AuditItem audit = (AuditItem)row.DataBoundItem;
                                    Entity entity   = audit.AuditDetail.OldValue;
                                    entity.Attributes.Remove("statecode");
                                    entity.Attributes.Remove("statuscode");
                                    Service.Create(entity);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            errorMessage = ex.Message;
                        }
                    },
                    ProgressChanged = ev =>
                    {
                        // If progress has to be notified to user, use the following method:
                        SetWorkingMessage("Restoring data...");
                    },
                    PostWorkCallBack = ev =>
                    {
                        if (string.IsNullOrWhiteSpace(errorMessage))
                        {
                            if (recordsSelected)
                            {
                                MessageBox.Show("Restored the deleted records successfully!");
                            }
                            else
                            {
                                MessageBox.Show("Please select records to restore!");
                            }
                        }
                        else
                        {
                            MessageBox.Show(errorMessage);
                        }
                    },
                    AsyncArgument = null,
                    IsCancelable  = true,
                    MessageWidth  = 340,
                    MessageHeight = 150
                });
            }
        }
示例#47
0
        /// <summary>
        /// Set info for the manually tasks when trying to start running the backup of one or more tasks
        /// </summary>
        /// <param name="persistence"></param>
        /// <param name="service"></param>
        /// <param name="row"></param>
        private Dictionary <string, bool> SetManuallyTasksInfo(Persistence persistence, Service service, DataGridViewRow row)
        {
            var backupInfo = new Dictionary <string, bool>();

            _taskRunType = row.Cells[1].Value.ToString();
            if (_taskRunType.Equals("Manually"))
            {
                var backupName = row.Cells[0].Value.ToString();

                var backupModel = _jsonRquestModel.BackupModelList.FirstOrDefault(b => b.BackupName.Equals(backupName));
                if (backupModel != null)
                {
                    backupInfo.Add(backupModel.BackupName, true);
                    persistence.RemoveDataFromJson(backupModel.BackupName);
                }
            }
            return(backupInfo);
        }
示例#48
0
 protected override void Delete(ProductMediaFile entity)
 {
     Service.DeleteProductPicture(entity);
 }
示例#49
0
 protected virtual void addListeners()
 {
     Service.Get <BackButtonController>().Add(onBackButtonClicked);
 }
示例#50
0
        /// <summary>
        /// Run disabled task/tasks
        /// </summary>
        private void RunDisabledTasks()
        {
            var backupInfo  = new Dictionary <string, bool>();
            var persistence = new Persistence();
            var service     = new Service();
            var taskNames   = new List <string>();

            _jsonRquestModel = persistence.ReadFormInformation();

            using (var ts = new TaskService())
            {
                var tasks = ts.AllTasks.Where(t => t.State.Equals(TaskState.Disabled)).ToList();

                if (dataGridView1.SelectedRows.Count > 0)
                {
                    // Run selected disabled tasks
                    foreach (var task in tasks)
                    {
                        if (task.Name.Contains(Constants.TaskDetailValue))
                        {
                            var index    = task.Name.IndexOf(" ") + 1;
                            var taskName = task.Name.Substring(index);

                            taskNames.Add(taskName);
                        }
                    }

                    foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                    {
                        var selectedTaskName = taskNames.FirstOrDefault(t => t.Equals(row.Cells[0].Value.ToString()));
                        var backupModel      = _jsonRquestModel.BackupModelList.FirstOrDefault(b => b.BackupName.Equals(selectedTaskName));
                        if (backupModel != null)
                        {
                            backupInfo.Add(backupModel.BackupName, false);
                            persistence.RemoveDataFromJson(backupModel.BackupName);
                        }
                    }
                    AddInfoIntoJson(persistence, service, backupInfo);
                }
                else
                {
                    // Run all disabled tasks
                    foreach (var task in tasks)
                    {
                        if (task.Name.Contains(Constants.TaskDetailValue))
                        {
                            var index    = task.Name.IndexOf(" ") + 1;
                            var taskName = task.Name.Substring(index);

                            var backupModel = _jsonRquestModel.BackupModelList.FirstOrDefault(b => b.BackupName.Equals(taskName));
                            if (backupModel != null)
                            {
                                backupInfo.Add(backupModel.BackupName, false);

                                persistence.RemoveDataFromJson(backupModel.BackupName);
                            }
                        }
                    }
                    AddInfoIntoJson(persistence, service, backupInfo);
                }
                GetBackupTasks();
            }
        }
示例#51
0
 public EditorCameraViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller)
     : base(serviceProvider)
 {
     if (controller == null)
     {
         throw new ArgumentNullException(nameof(controller));
     }
     this.controller               = controller;
     ResetCameraCommand            = new AnonymousCommand(ServiceProvider, () => Service.ResetCamera());
     ResetCameraOrientationCommand = new AnonymousCommand <CameraOrientation>(ServiceProvider, value => Service.ResetCameraOrientation(value));
 }
示例#52
0
 protected virtual void removeListeners()
 {
     Service.Get <BackButtonController>().Remove(onBackButtonClicked);
 }
 private void onEquipmentCreateError(CreateCustomEquipmentOperation operation, HttpResponse httpResponse)
 {
     Service.Get <EventDispatcher>().DispatchEvent(default(InventoryServiceErrors.EquipmentCreationError));
 }
示例#54
0
 public void Awake()
 {
     dispatcher = Service.Get <EventDispatcher>();
 }
示例#55
0
 public static void UpdateRankBasis_ProduceEquipment(Service service, IEntity entity, long cID)
 {
     UpdateRankBasisUtility.UpdateRankBasis(service, entity, cID, "GamePlay_produce_equipment", 1L);
 }
    private void inventoryLoaded(GetInventoryOperation operation, HttpResponse httpResponse)
    {
        List <CustomEquipment> customEquipmentResponses = operation.CustomEquipmentResponses;

        Service.Get <EventDispatcher>().DispatchEvent(new InventoryServiceEvents.InventoryLoaded(customEquipmentResponses));
    }
示例#57
0
 public static void UpdateRankBasis_TryDyeing(Service service, IEntity entity, long cID)
 {
     UpdateRankBasisUtility.UpdateRankBasis(service, entity, cID, "GamePlay_try_dyeing", 1L);
 }
示例#58
0
 public NewDayBubble(long time, BubbleDirection direction, string address,
                     string participantAddress, bool party, Service service) :
     base(time, direction, address, participantAddress, party, service)
 {
 }
示例#59
0
 public static void UpdateRankBasis_GetTitle(Service service, IEntity entity, long cID)
 {
     UpdateRankBasisUtility.UpdateRankBasis(service, entity, cID, "GamePlay_get_title", 1L);
 }
示例#60
0
 public static void UpdateRankBasis_TryEnhance(Service service, IEntity entity, long cID)
 {
     UpdateRankBasisUtility.UpdateRankBasis(service, entity, cID, "GamePlay_try_enhance", 1L);
 }