Ejemplo n.º 1
0
        /// <summary>
        /// 查询报文列表处理
        /// </summary>
        /// <param name="proxy"></param>
        private List <CWorkQueueDto> GetFindQueueLst(QueryServiceClient proxy)
        {
            List <CWorkQueueDto> lstWorkQueue = null;

            if (string.IsNullOrEmpty(this.CboWareHouseTask.Text) || string.IsNullOrEmpty(this.CboDeviceCode.Text))
            {// 查询所有队列报文
                lstWorkQueue = proxy.GetSendTelegramQueue();
            }
            else
            {
                int nWareHouse  = CStaticClass.ConvertWareHouse(this.CboWareHouseTask.Text);
                int nDeviceCode = 0;
                if (this.CboDeviceCode.Text.Contains("ETV"))
                {
                    nDeviceCode = CStaticClass.ConvertETVDescp(this.CboDeviceCode.Text);
                }
                else
                {
                    nDeviceCode = CStaticClass.ConvertHallDescp(nWareHouse, this.CboDeviceCode.Text);
                }
                lstWorkQueue = proxy.GetSendTelegramQueueByEquipID(nWareHouse, nDeviceCode);
            }

            this.DgvQueue.DataSource = new BindingList <CWorkQueueDto>(lstWorkQueue);
            return(lstWorkQueue);
        }
        /// <summary>
        /// 登陆界面时-绑定数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CUserCustomerInfoPanel_Load(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                // 查询所有车主信息
                List <struCustomerInfo> lstStruCUSTInfo = new List <struCustomerInfo>();
                proxy.QueryCUSTInfo(ref lstStruCUSTInfo);
                // 添加列表信息
                this.DgvCustomer.DataSource = new BindingList <struCustomerInfo>(lstStruCUSTInfo);
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 车厅库区改变值时触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CboHallWareHouse_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                this.CboHallID.Items.Clear();
                int           nCurWareHouse = CStaticClass.ConvertWareHouse(this.CboHallWareHouse.Text);
                List <object> lstHall       = CStaticClass.ConfigLstHallDeviceIDDescp(nCurWareHouse);// 根据库号获取对应所有车厅设备号
                this.CboHallID.Items.AddRange(lstHall.ToArray());
                this.CboHallID.SelectedIndex = 0;
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 允许厅外刷卡取车否
 /// </summary>
 private void InitGetCarOutStatus()
 {
     try
     {
         if (!CStaticClass.CheckPushService())
         {// 检查服务
             return;
         }
         QueryServiceClient proxy  = new QueryServiceClient();
         string             status = proxy.GetUserSetFixCardOutLimit();
         proxy.Close();
         if (status == "1")
         {
             lblAllow.Text = "允许";
         }
         else if (status == "0")
         {
             lblAllow.Text = "禁止";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 登陆界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void CUserTariffPanel_Load(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                // 查询所有标准收费信息
                List <CTariffDto> lstTariff = proxy.GetTariffList();
                this.CboTariff.Items.Clear();
                // 添加列表信息
                this.CboTariff.Items.AddRange(lstTariff.ToArray());
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
Ejemplo n.º 6
0
        public static DataSet Paging()
        {
            QueryServiceClient client = new QueryServiceClient();

            Paging paging = new ValueBasedPaging()
            {
                RecordLimit = 20
            };

            DataSet dataset;
            int     page = 10;
            int     i    = 0;

            do
            {
                dataset = client.ExecuteStaticQuery("STMSalesDaily", ref paging);
                DataRow row = dataset.Tables[0].Rows[0];

                i++;
                if (i == page)
                {
                    return(dataset);
                }
            }while (((ValueBasedPaging)paging).Bookmark != null);

            return(dataset);
        }
Ejemplo n.º 7
0
        public static DataSet Get(string tableQuery)
        {
            QueryServiceClient client  = new QueryServiceClient();
            DataSet            dataSet = new DataSet();
            Paging             paging  = null;

            try
            {
                if (string.IsNullOrEmpty(Logon.User) && string.IsNullOrEmpty(Logon.Password))
                {
                    client.ClientCredentials.Windows.ClientCredential.Domain   = Logon.Domain;
                    client.ClientCredentials.Windows.ClientCredential.UserName = Logon.DefaultUser;
                    client.ClientCredentials.Windows.ClientCredential.Password = Logon.DefaultPassword;
                }
                else
                {
                    client.ClientCredentials.Windows.ClientCredential.Domain   = Logon.Domain;
                    client.ClientCredentials.Windows.ClientCredential.UserName = Logon.User;
                    client.ClientCredentials.Windows.ClientCredential.Password = Logon.Password;
                }

                dataSet = client.ExecuteStaticQuery(tableQuery, ref paging);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }

            return(dataSet);
        }
Ejemplo n.º 8
0
        private async Task <Dictionary <string, PoolResult> > GetPoolMapAsync(RunRequest request)
        {
            using var channel = GrpcChannel.ForAddress(QueryUrl);
            var client  = new QueryServiceClient(channel);
            var poolMap = new Dictionary <string, PoolResult>();

            foreach (var pool in request.Profile.Pools)
            {
                var queryTicketRequest = new QueryTicketsRequest()
                {
                    Pool = pool
                };
                using var stream = client.QueryTickets(queryTicketRequest);
                var cts         = new CancellationTokenSource(TimeSpan.FromSeconds(ApiTimeout));
                var poolTickets = new List <Ticket>();

                while (await stream.ResponseStream.MoveNext(cts.Token))
                {
                    poolTickets.AddRange(stream.ResponseStream.Current.Tickets);
                }

                if (0 == poolTickets.Count)
                {
                    continue;
                }

                var result = new PoolResult();
                result.Name    = pool.Name;
                result.Tickets = poolTickets.ToList();

                poolMap.Add(pool.Name, result);
            }

            return(poolMap);
        }
        public IEnumerable <Track> GetTracksByName(string name)
        {
            Track[] tracks = new Track[0];

            if (!IsLoggedIn())
            {
                return(tracks);
            }

            QueryServiceClient query = new QueryServiceClient();

            try
            {
                QueryResult result = query.Query(name, 0, 150, 0, 0, 0, 0);

                tracks = result.Tracks
                         .Where(t => t.IsAvailable)
                         .Select(ConvertTrack)
                         .ToArray();

                query.Close();
            }
            catch (Exception e)
            {
                _logger.Log(e.Message, Category.Exception, Priority.Medium);
                query.Abort();
            }

            return(tracks);
        }
Ejemplo n.º 10
0
        //
        // GET: /Books/

        public ActionResult Index()
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var books = queryService.GetBooks();

            queryService.Close();
            return(View(books.OrderBy(p => p.Title)));
        }
Ejemplo n.º 11
0
        public ActionResult Edit(Guid id)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var model = queryService.GetUserByGuid(id);

            queryService.Close();
            return(View(model));
        }
        public override bool ValidateUser(string username, string password)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            bool ret = queryService.ValidateUser(username, password);

            queryService.Close();
            return(ret);
        }
Ejemplo n.º 13
0
        public ActionResult Details(Guid id)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var book = queryService.GetBookByGuid(id);

            queryService.Close();
            return(View(book));
        }
Ejemplo n.º 14
0
        public ActionResult MyAccount()
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var model = queryService.GetUserByUserName(User.Identity.Name);

            queryService.Close();
            return(View(model));
        }
        public IEnumerable<TrackContainer> GetAlbumsByArtist(string artist)
        {
            List<TrackContainer> containers = new List<TrackContainer>();

            if (!IsLoggedIn())
            {
                return containers;
            }

            QueryServiceClient query = new QueryServiceClient();

            try
            {
                var queryResult = query.Query(artist, 0, 0, 0, 0, 0, 10);
                var result =
                    queryResult.Artists.FirstOrDefault(
                        a => a.Name.Equals(artist, StringComparison.InvariantCultureIgnoreCase));

                if (result == null && queryResult.Artists.Any())
                {
                    result = queryResult.Artists.FirstOrDefault();
                }

                if (result != null)
                {
                    var browse = query.ArtistBrowse(result.ID, ArtistBrowsingType.Full);
                    var albumGroups = browse.Tracks.Where(t => t.IsAvailable).GroupBy(t => t.Album.ID);

                    foreach (var albumGroup in albumGroups)
                    {
                        TrackContainer container = new TrackContainer();
                        container.Owner = new TrackContainerOwner(artist);
                        container.Tracks = albumGroup.Select(SpotifyRadioTrackPlayer.ConvertTrack).ToArray();

                        var firstOrDefault = container.Tracks.FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            container.Name = firstOrDefault.Album;
                            container.Image = container.Image = firstOrDefault.AlbumArt;
                        }

                        containers.Add(container);
                    }
                }

                query.Close();
            }
            catch (Exception e)
            {
                _logger.Log(e.Message, Category.Exception, Priority.Medium);
                query.Abort();
            }

            return containers;
        }
        public IEnumerable <TrackContainer> GetAlbumsByArtist(string artist)
        {
            List <TrackContainer> containers = new List <TrackContainer>();

            if (!IsLoggedIn())
            {
                return(containers);
            }

            QueryServiceClient query = new QueryServiceClient();

            try
            {
                var queryResult = query.Query(artist, 0, 0, 0, 0, 0, 10);
                var result      =
                    queryResult.Artists.FirstOrDefault(
                        a => a.Name.Equals(artist, StringComparison.InvariantCultureIgnoreCase));

                if (result == null && queryResult.Artists.Any())
                {
                    result = queryResult.Artists.FirstOrDefault();
                }

                if (result != null)
                {
                    var browse      = query.ArtistBrowse(result.ID, ArtistBrowsingType.Full);
                    var albumGroups = browse.Tracks.Where(t => t.IsAvailable).GroupBy(t => t.Album.ID);

                    foreach (var albumGroup in albumGroups)
                    {
                        TrackContainer container = new TrackContainer();
                        container.Owner  = new TrackContainerOwner(artist);
                        container.Tracks = albumGroup.Select(SpotifyRadioTrackPlayer.ConvertTrack).ToArray();

                        var firstOrDefault = container.Tracks.FirstOrDefault();
                        if (firstOrDefault != null)
                        {
                            container.Name  = firstOrDefault.Album;
                            container.Image = container.Image = firstOrDefault.AlbumArt;
                        }

                        containers.Add(container);
                    }
                }

                query.Close();
            }
            catch (Exception e)
            {
                _logger.Log(e.Message, Category.Exception, Priority.Medium);
                query.Abort();
            }

            return(containers);
        }
Ejemplo n.º 17
0
        public static DataSet Find(string queryName, string tableName, string fieldName, string value, string fieldName2 = "", string value2 = "")
        {
            DataSet            ds     = new DataSet();
            QueryServiceClient client = new QueryServiceClient();

            //Set up paging so that 1000 records are retrieved at a time

            Paging paging = new ValueBasedPaging()
            {
                RecordLimit = 1000
            };
            QueryMetadata           query;
            QueryDataSourceMetadata customerDataSource;
            QueryDataRangeMetadata  range, range2;

            query = new QueryMetadata();
            // Set the properties of the query.
            //query.QueryType = QueryType.Join;
            query.DataSources = new QueryDataSourceMetadata[1];
            // Set the properties of the Customers data source.
            customerDataSource         = new QueryDataSourceMetadata();
            customerDataSource.Name    = queryName;
            customerDataSource.Enabled = true;
            customerDataSource.Table   = tableName;
            //Add the data source to the query.
            query.DataSources[0] = customerDataSource;
            // Setting DynamicFieldList property to false so I can specify only a few fields
            customerDataSource.DynamicFieldList = true;

            range           = new QueryDataRangeMetadata();
            range.TableName = tableName;
            range.FieldName = fieldName;
            range.Value     = value;
            range.Enabled   = true;

            range2           = new QueryDataRangeMetadata();
            range2.TableName = tableName;
            range2.FieldName = fieldName2;
            range2.Value     = value2;
            range2.Enabled   = true;

            customerDataSource.Ranges    = new QueryDataRangeMetadata[fieldName2 == "" ? 1 : 2];
            customerDataSource.Ranges[0] = range;
            if (fieldName2 != "")
            {
                customerDataSource.Ranges[1] = range2;
            }

            client.ClientCredentials.Windows.ClientCredential.Domain   = UserAccount.Domain;
            client.ClientCredentials.Windows.ClientCredential.UserName = UserAccount.Username;
            client.ClientCredentials.Windows.ClientCredential.Password = UserAccount.Password;

            ds = client.ExecuteQuery(query, ref paging);
            return(ds);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 移动指令选择改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RbtnMove_CheckedChanged(object sender, EventArgs e)
        {
            if (!this.RbtnMove.Checked)
            {
                return;
            }

            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }
            btnRdICCard.Enabled = false;
            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                this.LblSrc.Text             = "设备";
                this.LblDest.Text            = "目的地址";
                this.CboDeviceID.Visible     = true;
                this.CboHallID.Visible       = false;
                this.CTxtSrcLocAddr.Visible  = false;
                this.CTxtDestLocAddr.Visible = true;

                // 塔库无挪移
                List <object> lstObj = CStaticClass.ConfigLstWareHouseDescp();
                this.CboWareHouse.Items.Clear();
                foreach (object obj in lstObj)
                {
                    if (obj.Equals("塔库"))
                    {
                        continue;
                    }
                    this.CboWareHouse.Items.Add(obj);
                }
                this.CboWareHouse.SelectedIndex = 0;
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 登陆界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CFormTariff_Load(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                // 查询所有标准收费信息
                List <CTariffDto> lstTariff = proxy.GetTariffList();

                if (EnmICCardType.Temp == m_currentICCardType)
                {
                    lstTariff = lstTariff.FindAll(s => s.iccardtype == (int)m_currentICCardType);
                }
                else
                {
                    lstTariff = lstTariff.FindAll(s => s.iccardtype != (int)EnmICCardType.Temp);
                }
                this.CboTariffDescp.Items.Clear();
                // 添加列表信息
                this.CboTariffDescp.Items.AddRange(lstTariff.ToArray());
                CTariffDto tariff = lstTariff.Find(s => s.id == m_nTariffID);

                if (null != tariff)
                {
                    this.CboTariffDescp.SelectedItem = tariff;
                }
                else
                {
                    this.CutpTariff.Visible = false;
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
        public override string GetUserNameByEmail(string email)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var userObj = queryService.GetUserByEmail(email);

            queryService.Close();
            if (userObj != null)
            {
                return(userObj.UserName);
            }
            return(null);
        }
        /// <summary>
        /// IC卡信息注销
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnICCardLogout_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                if (null == m_icCardDto || string.IsNullOrEmpty(this.TxtICCardID.Text))
                {
                    MessageBox.Show("该IC卡为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //// 更新卡状态
                m_icCardDto.icstatus     = (int)EnmICCardStatus.Disposed;
                m_icCardDto.iclogouttime = CStaticClass.CurruntDateTime();
                bool flag = proxy.UpdateICCardInfo(m_icCardDto);
                if (flag)
                {
                    this.TxtICCardStatus.Text        = "注销";
                    this.TxtICCardLogoutTime.Text    = CStaticClass.CurruntDateTime().ToString();
                    this.BtnICCardLoss.Enabled       = false;
                    this.BtnICCardCancelLoss.Enabled = false;
                    this.GbxICCardInfo.Enabled       = false;
                    MessageBox.Show("注销成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("注销失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
Ejemplo n.º 22
0
        void Application_WorkbookBeforeSave(Microsoft.Office.Interop.Excel.Workbook wb, bool saveAsUi, ref bool cancel)
        {
            try
            {
            //Comments
                GenericDocumentService service = new GenericDocumentServiceClient();

                GenericDocumentServiceCacheQueryRequest genericDocumentServiceRequest = new GenericDocumentServiceCacheQueryRequest();

                AX.AIF.QueryService.QueryServiceClient queryServiceClient = new QueryServiceClient();

                //QueryService.QueryDataFieldMetadata queryDataFieldMetaData = new QueryDataSourceMetadata();

                QueryMetadata query = new QueryMetadata();
                query.AllowCrossCompany = false;
                query.AllowCheck = false;
                query.DataSources = new QueryDataSourceMetadata[]
                                    {
                                        new QueryDataSourceMetadata()
                                            {
                                                Table = "prodPool", Name = "ProdPool", Company = "CAD", ConcurrencyModelSpecified = false, DynamicFieldList = true,
                                                DynamicFieldListSpecified = true, FetchMode = FetchMode.OneToOne,
                                                ExpansionType = ExpansionType.Original, HasRelations = false
                                            }
                                    };

                query.Name = "ProdPoolQuery";
                genericDocumentServiceRequest._axdQuery = query;
                //genericDocumentServiceRequest._documentXml = "";

                GenericDocumentServiceCacheQueryResponse response = service.cacheQuery(genericDocumentServiceRequest);

                GenericDocumentServiceCreateUsingCachedQueryRequest cachedQueryRequest = new GenericDocumentServiceCreateUsingCachedQueryRequest();

                cachedQueryRequest._cachedAxdQueryId = response.response;
                GenericDocumentServiceGetSchemasRequest schemasRequest = new GenericDocumentServiceGetSchemasRequest();

                schemasRequest._axdQuery = query;

                var schema = service.getSchemas(schemasRequest);

            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            var activeWorksheet = ((Excel.Worksheet)Application.ActiveSheet);
            var firstRow = activeWorksheet.Range["A1", missing];
            firstRow.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftDown, System.Type.Missing);
            var newFirstRow = activeWorksheet.Range["A1", missing];
            newFirstRow.Value2 = "This text was added by using code";
        }
        public override System.Web.Security.MembershipUser GetUser(string username, bool userIsOnline)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var userObj = queryService.GetUserByUserName(username);

            queryService.Close();
            if (userObj != null)
            {
                return(ConvertFrom(userObj));
            }
            return(null);
        }
Ejemplo n.º 24
0
        private static bool CanShow(HtmlHelper htmlHelper, AuthorizationAccountType authAccountType)
        {
            IIdentity userIdentity = htmlHelper.ViewContext.HttpContext.User.Identity;

            if (userIdentity.IsAuthenticated)
            {
                QueryServiceClient queryService = new QueryServiceClient();
                AccountType?       accountType  = queryService.GetAccountType(userIdentity.Name);
                queryService.Close();
                if (accountType != null)
                {
                    bool canShow = false;
                    switch (accountType.Value)
                    {
                    case AccountType.Admin:
                        if ((authAccountType & AuthorizationAccountType.Admin) == AuthorizationAccountType.Admin)
                        {
                            canShow = true;
                        }
                        else
                        {
                            canShow = false;
                        }
                        break;

                    case AccountType.User:
                        if ((authAccountType & AuthorizationAccountType.User) == AuthorizationAccountType.User)
                        {
                            canShow = true;
                        }
                        else
                        {
                            canShow = false;
                        }
                        break;

                    default:
                        break;
                    }
                    return(canShow);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 设置状态栏值
        /// </summary>
        /// <param name="obj"></param>
        private void SetStatusStripValue()
        {
            int                nSum             = 0;
            int                nOccupy          = 0;
            int                nSpace           = 0;
            int                nMaxSpace        = 0;
            string             strSumDescp      = "(";
            string             strOccupyDescp   = "(";
            string             strSpaceDescp    = "(";
            string             strMaxSpaceDescp = "(";
            int                i     = 1;
            QueryServiceClient proxy = new QueryServiceClient();

            foreach (object obj in CStaticClass.ConfigLstWareHouse())
            {
                if (typeof(int) != obj.GetType())
                {
                    continue;
                }
                Rectangle rect = new Rectangle();
                proxy.GetCarPOSNFreeOccupyCount((int)obj, ref rect);
                nSum      += rect.X;
                nOccupy   += rect.Y;
                nSpace    += rect.Width;
                nMaxSpace += rect.Height;

                string strFlag = ";";
                if (i++ == m_ltpWareHouse.Count)
                {
                    strFlag = ")";
                }
                string strWareHouse = CStaticClass.ConvertWareHouse((int)obj);
                strSumDescp      += strWareHouse + ":" + rect.X + strFlag;
                strOccupyDescp   += strWareHouse + ":" + rect.Y + strFlag;
                strSpaceDescp    += strWareHouse + ":" + rect.Width + strFlag;
                strMaxSpaceDescp += strWareHouse + ":" + rect.Height + strFlag;
            }

            if (2 > m_ltpWareHouse.Count)
            {// 只有一个库时
                strSumDescp      = string.Empty;
                strOccupyDescp   = string.Empty;
                strSpaceDescp    = string.Empty;
                strMaxSpaceDescp = string.Empty;
            }
            this.TsslSumTxt.Text      = nSum.ToString() + strSumDescp;
            this.TsslOccupyTxt.Text   = nOccupy.ToString() + strOccupyDescp;
            this.TsslSpaceTxt.Text    = nSpace.ToString() + strSpaceDescp;
            this.TsslSpaceMaxTxt.Text = nMaxSpace.ToString() + strMaxSpaceDescp;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 更新某一ETV当前位置
        /// </summary>
        public override void UpdateDeviceStatus(CarLocationPanelLib.PushService.CDeviceStatusDto deviceStatus)
        {
            Label lblTV = m_lLblETVEquip.Find(s => s.Name == deviceStatus.devicecode.ToString());

            if (null == lblTV)
            {
                return;
            }
            QueryServiceClient proxy = new QueryServiceClient();
            List <CarLocationPanelLib.QueryService.CDeviceFaultDto> lstDeviceFault = proxy.GetDeviceFault(m_wareHouse, deviceStatus.devicecode, string.Empty);

            lstDeviceFault = lstDeviceFault.FindAll(s => s.color == 1);
            proxy.Close();
            if (0 < lstDeviceFault.Count)
            {
                lblTV.BackColor = Color.Red;
            }
            else
            {
                // 正在作业ETV颜色为蓝色、不可用/不可接受指令为黄色、正常绿色
                SetDeviceBackColor(lblTV, deviceStatus);
            }

            #region 根据当前库车位信息设置ETV设备位置
            // 根据当前库车位信息列表设置车位状态
            string strAddr = deviceStatus.deviceaddr;

            DataGridView     dgv  = null;
            DataGridViewCell cell = null;
            GetDgvcIndexByAddr(strAddr, ref dgv, ref cell);
            if (null == dgv || null == cell)
            {
                return;
            }
            // 获取当前单元格相对位置
            int nX = dgv.Location.X;
            int nY = dgv.Location.Y;
            for (int i = 0; i < cell.ColumnIndex && i < dgv.ColumnCount; i++)
            {
                nX += dgv.Columns[i].Width;
            }

            for (int i = 0; i < cell.RowIndex && i < dgv.RowCount; i++)
            {
                nY += dgv.Rows[i].Height;
            }
            // 设置ETV位置
            lblTV.BeginInvoke(new beginInvokeDelegate(SetETVLocation), lblTV, nX, nY);
            #endregion
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 更新ETV当前位置
        /// </summary>
        public override void UpdateDeviceStatus()
        {
            if (!CStaticClass.GetPushServiceConnectFlag())
            {// 服务器通道断开时
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            List <QueryService.CDeviceStatusDto> lstDeviceStatus = proxy.GetDeviceStatusList(m_wareHouse);

            foreach (QueryService.CDeviceStatusDto deviceStatus in lstDeviceStatus)
            {
                Label lblTV = m_lLblETVEquip.Find(s => s.Name == deviceStatus.devicecode.ToString());
                if (null == lblTV)
                {
                    return;
                }

                // 正在作业ETV颜色为蓝色、不可用/不可接受指令为黄色、正常绿色
                SetDeviceBackColor(lblTV, deviceStatus);

                #region 根据当前库车位信息设置ETV设备位置
                // 根据当前库车位信息列表设置车位状态
                string strAddr = deviceStatus.deviceaddr;

                DataGridView     dgv  = null;
                DataGridViewCell cell = null;
                GetDgvcIndexByAddr(strAddr, ref dgv, ref cell);
                if (null == cell || null == dgv)
                {
                    return;
                }
                // 获取当前单元格相对位置
                int nX = dgv.Location.X;
                int nY = dgv.Location.Y;
                for (int i = 0; i < cell.ColumnIndex && i < dgv.ColumnCount; i++)
                {
                    nX += dgv.Columns[i].Width;
                }

                for (int i = 0; i < cell.RowIndex && i < dgv.RowCount; i++)
                {
                    nY += dgv.Rows[i].Height;
                }
                // 设置ETV位置
                lblTV.Location = new System.Drawing.Point(nX, lblTV.Location.Y);
                #endregion
            }
            proxy.Close();
        }
Ejemplo n.º 28
0
        private T CallQueryService <T>(Func <IQueryService, T> call)
        {
            QueryServiceClient client = NewServiceClient();

            try {
                return(call(client));
            } finally {
                try {
                    client.Close();
                } catch (Exception) {
                    client.Abort();
                }
            }
        }
Ejemplo n.º 29
0
        ///// <summary>
        ///// 释放资源
        ///// </summary>
        //public void Dispose()
        //{ }

        /// <summary>
        /// 界面登陆
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMain_Load(object sender, EventArgs e)
        {
            try
            {
                SetLogout();
                DialogResult dr = m_formLogin.ShowDialog();
                if (dr == DialogResult.Yes)
                {
                    // 获取车主信息列表
                    List <struCustomerInfo> lstStruCUSTInfo = new List <struCustomerInfo>();
                    QueryServiceClient      proxy           = new QueryServiceClient();
                    proxy.QueryCUSTInfo(ref lstStruCUSTInfo);
                    proxy.Close();
                    CStaticClass.SetLstStruCUSTInfo(lstStruCUSTInfo);

                    this.Visible = true;
                    InitializeInfo();
                    SetLogin();

                    this.WindowState = FormWindowState.Maximized;
                    this.Tag         = true;
                    this.timer1.Start();
                }
                else if (dr == DialogResult.Cancel)
                {
                    this.Close();
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// LED保存修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSaveLed_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确认修改否?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

            if (dr == DialogResult.Cancel)
            {
                return;
            }
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                List <CLedContentDto> lstSound = ((BindingList <CLedContentDto>) this.DgvLed.DataSource).ToList();

                // 修改LED列表
                bool flag = proxy.UpdateLEDContentDtoList(lstSound);

                if (flag)
                {
                    MessageBox.Show("修改LED成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("修改LED失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (TimeoutException)
            {
                MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (CommunicationException exception)
            {
                MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exception)
            {
                MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            proxy.Close();
        }
Ejemplo n.º 31
0
        public ActionResult Return(Guid id)
        {
            QueryServiceClient queryService = new QueryServiceClient();
            var book = queryService.GetBookByGuid(id);
            var user = queryService.GetUserByUserName(User.Identity.Name);

            queryService.Close();

            CommandServiceClient commandService = new CommandServiceClient();

            commandService.ReturnBookFromUser(book.AggregateRootId, user.AggregateRootId);
            commandService.Close();

            return(RedirectToAction("MyAccount", "Account"));
        }
Ejemplo n.º 32
0
        private T CallQueryService <T>(Func <IQueryService, T> call)
        {
            QueryServiceClient client = ClientFactory.CreateClient <QueryServiceClient, IQueryService>();

            try {
                return(call(client));
            }
            finally {
                try {
                    client.Close();
                }
                catch (Exception) {
                    client.Abort();
                }
            }
        }
Ejemplo n.º 33
0
        public static string GetStr()
        {
            string menuSTR = string.Empty;
            menuSTR += "{ \"menus\": [";

            string user=HttpContext.Current.Session["LogonUser"].ToString()==String.Empty?"":HttpContext.Current.Session["LogonUser"].ToString();
            EDI.Web.QuerySVC.QueryServiceClient qry = new QueryServiceClient();
            DataTable dt = qry.SearchData(Query_V_USERPAGES, "LOGINNAME='" + user + "'");

            if (dt.Rows.Count > 0)
            {
                //DataView dv = dt.DefaultView;
                //dv.RowFilter = " PARENT_ID IS NULL ";
                //dv.Sort = " SORTINDEX ASC";
                DataRow[] drs = dt.Select(" PARENT_ID IS NULL and ISMENU='1'", " SORTINDEX ASC");
                if (drs != null && drs.Length > 0)
                {
                    //"menuid": "1", "icon": "icon-sys", "menuname": "报文管理",
                            //"menus": [
                            //          { "menuid": "11", "menuname": "报文上传1", "icon": "icon-nav", "url": "../Upload/testupload.aspx" }
                            //        , { "menuid": "12", "menuname": "报文上传2", "icon": "icon-nav", "url": "../Upload/UploadFileMgt.aspx" }
                            ////						               , { "menuid": "13", "menuname": "布局测试-内容页", "icon": "icon-nav", "url": "../Export/Test1.aspx" }
                            //         ]
                    foreach (DataRow dr in drs)
                    {
                        menuSTR += "{\"menuid\": " + dr["SORTINDEX"] + "\", \"icon\": \"icon-sys\", \"menuname\": \"" + dr["TITLE"] + "\",";
                        menuSTR += "\"menus\": [";

                        DataRow[] ddrs = dt.Select("PARENT_ID='"+dr["PK_ID"]+"'", " SORTINDEX ASC");
                        if (ddrs != null && ddrs.Length > 0)
                        {
                            foreach (DataRow drr in ddrs)
                            {
                                menuSTR += "{ \"menuid\": \"" + drr["SORTINDEX"] + "\", \"menuname\": \"" + drr["TITLE"] + "\", \"icon\": \"icon-nav\", \"url\": \"" + drr["PAGEURL"] + "\" },";
                            }
                        }

                        menuSTR += "]},";
                    }
                }

            }
            menuSTR += "]};";

            return menuSTR;
        }
Ejemplo n.º 34
0
        public void Run(string userName, string password)
        {
            Thread.Sleep(4000);

            _loginEvent = new ManualResetEventSlim();

            var login = new LoginServiceClient(new InstanceContext(this));
            login.Subscribe();

            login.Login(userName, password, false);
            Console.WriteLine("Logging in...");
            if (!_loginEvent.Wait(10000))
            {
                Console.WriteLine("Unable to login");
                return;
            }

            var query = new QueryServiceClient();
            Console.WriteLine("Searching");

            var result = query.Query("NOFX", 0, 10, 0, 10, 0, 10);

            foreach (var track in result.Tracks)
            {
                Console.WriteLine(track.Name);
            }

            foreach (var album in result.Albums)
            {
                Console.WriteLine(album.Name);
            }

            //var control = new PlayerControlServiceClient(new InstanceContext(new MyPlayerControlCallbacks()));
            //control.Subscribe();

            //var player = new PlaylistPlayerServiceClient();
            //player.Initialize(new[]
            //                    {
            //                        "spotify:track:2lvILTIWBbzFeHF95zSWoF",
            //                        "spotify:track:50JVjWk5JwoJsIQLcqHftd"
            //                    });

            //control.SetVolume(0.4f);
            Console.ReadLine();
        }
        public IEnumerable<Track> GetTracksByName(string name)
        {
            Track[] tracks = new Track[0];

            if (!IsLoggedIn())
            {
                return tracks;
            }

            QueryServiceClient query = new QueryServiceClient();

            try
            {
                QueryResult result = query.Query(name, 0, 150, 0, 0, 0, 0);

                tracks = result.Tracks
                    .Where(t => t.IsAvailable)
                    .Select(ConvertTrack)
                    .ToArray();

                query.Close();
            }
            catch (Exception e)
            {
                _logger.Log(e.Message, Category.Exception, Priority.Medium);
                query.Abort();
            }

            return tracks;
        }