示例#1
0
        protected override void ExecuteExecuteAsync(string typeName, object[] parameters, EventHandler <ExecuteCompletedEventArgs> callback)
        {
            Debug.ArgumentNotNull(typeName, nameof(typeName));
            Debug.ArgumentNotNull(parameters, nameof(parameters));
            Debug.ArgumentNotNull(callback, nameof(callback));

            var array = new ArrayOfAnyType();

            array.AddRange(parameters);

            var service = DataService;

            if (service == null)
            {
                var results = new object[]
                {
                    string.Empty
                };

                var args = new ExecuteCompletedEventArgs(results, new Exception(@"No Service"), true, null);

                callback(this, args);
                return;
            }

            service.ExecuteAsync(typeName, array, GetCredentials(), callback);
        }
示例#2
0
        internal bool SetUser(string Username)
        {
            try
            {
                Logs = new List <Log>();
                HeldQualification  = new List <Qualification>();
                DisciplinaryRecord = new List <Record>();
                TrainingCompleted  = new List <Training>();
                Schedule           = new List <EntryInSchedule>();

                ArrayOfString User = service.GetUser(Username);
                UserID      = int.Parse(User[0].ToString());
                Username    = User[1].ToString();
                UserType    = User[2].ToString();
                PhoneNumber = long.Parse(User[3].ToString());
                ArrayOfAnyType[] DwnldLgs     = service.getAllLogs(UserID);
                ArrayOfAnyType[] dwnldqal     = service.getAllQualifications(UserID);
                ArrayOfAnyType[] dwnlddr      = service.getAllDR(UserID);
                ArrayOfAnyType[] dwnldtr      = service.getAllTraining(UserID);
                ArrayOfAnyType[] dwnldscedule = service.getAllSchedule(UserID);

                for (int i = 0; i < DwnldLgs.Length; i++)
                {
                    ArrayOfAnyType Q = DwnldLgs[i];
                    Logs.Add(new Log(int.Parse(Q[0].ToString()), decimal.Parse(Q[1].ToString()), decimal.Parse(Q[2].ToString()), decimal.Parse(Q[3].ToString()), decimal.Parse(Q[4].ToString()), DateTime.Parse(Q[5].ToString())));
                }
                for (int i = 0; i < dwnldqal.Length; i++)
                {
                    ArrayOfAnyType Q = dwnldqal[i];
                    HeldQualification.Add(new Qualification(int.Parse(Q[0].ToString()), Q[1].ToString(), DateTime.Parse(Q[2].ToString())));
                }
                for (int i = 0; i < dwnlddr.Length; i++)
                {
                    ArrayOfAnyType Q = dwnlddr[i];
                    DisciplinaryRecord.Add(new Record(int.Parse(Q[0].ToString()), Q[1].ToString()));
                }
                for (int i = 0; i < dwnldtr.Length; i++)
                {
                    ArrayOfAnyType Q = dwnldtr[i];
                    TrainingCompleted.Add(new Training(int.Parse(Q[0].ToString()), Q[1].ToString(), DateTime.Parse(Q[2].ToString())));
                }
                for (int i = 0; i < dwnldscedule.Length; i++)
                {
                    ArrayOfAnyType Q = dwnldscedule[i];
                    Schedule.Add(new EntryInSchedule(int.Parse(Q[0].ToString()), Q[1].ToString(), DateTime.Parse(Q[2].ToString()), Q[3].ToString()));
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#3
0
        public void GetItemHeader(Guid id)
        {
            var credentials = new Credentials
            {
                UserName = _configuration.SourceUserName,
                Password = _configuration.SourcePassword
            };

            var parameters = new ArrayOfAnyType {
                _configuration.SourceDatabase
            };

            _service.Execute("Sitecore.Rocks.Server.Requests.Languages.SetContextLanguage", parameters, credentials);
        }
示例#4
0
        public void SetContextLanguage(string languageName)
        {
            var credentials = new Credentials
            {
                UserName = _configuration.SourceUserName,
                Password = _configuration.SourcePassword
            };

            var parameters = new ArrayOfAnyType {
                languageName
            };

            _service.Execute("Sitecore.Rocks.Server.Requests.Languages.SetContextLanguage", parameters, credentials);
        }
示例#5
0
        public byte[] MediaDownloadAttachment(Guid mediaItemId)
        {
            var credentials = new Credentials
            {
                UserName = _configuration.SourceUserName,
                Password = _configuration.SourcePassword
            };

            var parameters = new ArrayOfAnyType {
                _configuration.SourceDatabase, mediaItemId.ToString("B").ToUpper()
            };

            var result = _service.Execute("Sitecore.Rocks.Server.Requests.Media.DownloadAttachment", parameters, credentials);

            return(Convert.FromBase64String(result));
        }
示例#6
0
        public static ArrayOfAnyType ToArrayOfAnyType(this List <string> columnNames)
        {
            if (columnNames.Count <= 0)
            {
                return(null);
            }

            var objects = new ArrayOfAnyType();

            foreach (var column in columnNames)
            {
                objects.Add(column);
            }

            return(objects.Count > 0 ? objects : null);
        }
示例#7
0
        private void readTask()
        {
            CheckForIllegalCrossThreadCalls = false;
            string        fromPai, fromLie, fromCeng, toPai, toLie, toCeng, taskId, newTask;
            ArrayOfString items = new ArrayOfString();

            items.Add(LOCALSERVER + StackerWrite + "W42"); //frompai 0
            items.Add(LOCALSERVER + StackerWrite + "W38"); //fromlie 1
            items.Add(LOCALSERVER + StackerWrite + "W40"); //fromceng 2
            items.Add(LOCALSERVER + StackerWrite + "W48"); //topai 3
            items.Add(LOCALSERVER + StackerWrite + "W44"); //tolie 4
            items.Add(LOCALSERVER + StackerWrite + "W46"); //toceng 5
            items.Add(LOCALSERVER + StackerWrite + "W50"); //taskid 6
            items.Add(LOCALSERVER + StackerWrite + "W52"); //newtask 7
            while (true)
            {
                wait(1000);
                try
                {
                    using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
                    {
                        ArrayOfAnyType rsts = srv.OPC_Read(items);
                        if (rsts[7].ToString() == "1")
                        {
                            lbfromPai.Text   = rsts[0].ToString();
                            lbFromLie.Text   = rsts[1].ToString();
                            lbFromCeng.Text  = rsts[2].ToString();
                            lbToPai.Text     = rsts[3].ToString();
                            lbToLie.Text     = rsts[4].ToString();
                            lbToCeng.Text    = rsts[5].ToString();
                            lbTaskId.Text    = "任务号:" + rsts[6].ToString();
                            IsNewTask        = "是";
                            lbIsNewTask.Text = "是否下发:" + "是";
                        }
                        else
                        {
                            lbIsNewTask.Text = "是否下发:" + "否";
                            IsNewTask        = "否";
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }