/// <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(); }
/// <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()); } }
/// <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(); }
/// <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(); }
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); }
// // GET: /Books/ public ActionResult Index() { QueryServiceClient queryService = new QueryServiceClient(); var books = queryService.GetBooks(); queryService.Close(); return(View(books.OrderBy(p => p.Title))); }
public ActionResult Edit(Guid id) { QueryServiceClient queryService = new QueryServiceClient(); var model = queryService.GetUserByGuid(id); queryService.Close(); return(View(model)); }
public ActionResult Details(Guid id) { QueryServiceClient queryService = new QueryServiceClient(); var book = queryService.GetBookByGuid(id); queryService.Close(); return(View(book)); }
public override bool ValidateUser(string username, string password) { QueryServiceClient queryService = new QueryServiceClient(); bool ret = queryService.ValidateUser(username, password); queryService.Close(); return(ret); }
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); }
/// <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(); }
/// <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(); }
/// <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(); }
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); }
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); }
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); } }
private T CallQueryService <T>(Func <IQueryService, T> call) { QueryServiceClient client = NewServiceClient(); try { return(call(client)); } finally { try { client.Close(); } catch (Exception) { client.Abort(); } } }
/// <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(); }
/// <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 }
///// <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(); } }
/// <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(); }
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")); }
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(); } } }
/// <summary> /// 查询队列报文列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnFindQueue_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { //if (string.IsNullOrEmpty(this.CboWareHouseTask.Text) || string.IsNullOrEmpty(this.CboDeviceCode.Text)) //{ // MessageBox.Show("库区,设备都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} List <CWorkQueueDto> lstWorkQueue = GetFindQueueLst(proxy); if (null == lstWorkQueue || 0 == lstWorkQueue.Count) { MessageBox.Show("抱歉,没有找到符合条件的记录!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } 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(); }
private void CFormCIMCWorker_Load(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { // 语音配置查询列表 List <CSoundDto> lstSoundDto = proxy.GetSoundList(); this.DgvSound.DataSource = new BindingList <CSoundDto>(lstSoundDto); // Led配置查询列表 List <CLedContentDto> lstLedContentDto = proxy.GetLEDContentList(); this.DgvLed.DataSource = new BindingList <CLedContentDto>(lstLedContentDto); // 报文队列查询列表 GetFindQueueLst(proxy); OnResize(null); } 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(); }
private void btnRdICCard_Click(object sender, EventArgs e) { CTxtSrcLocAddr.Clear(); string physCode = this.readIccard(); if (physCode == null) { return; } if (!CStaticClass.CheckPushService()) { return; } QueryServiceClient proxy = new QueryServiceClient(); try { string iccode = proxy.QueryICCodeByPhysic(physCode); if (iccode != null) { CarLocationPanelLib.QueryService.CCarLocationDto carLoc = null; CarLocationPanelLib.QueryService.EnmFaultType type = proxy.QueryCarPOSNByCardID(out carLoc, iccode); if (type == CarLocationPanelLib.QueryService.EnmFaultType.Success) { if (carLoc != null) { this.CTxtSrcLocAddr.Text = carLoc.carlocaddr; return; } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } proxy.Close(); }
private void btnAllow_Click(object sender, EventArgs e) { Button btn = (Button)sender; string value; if (btn == btnAllow) { value = "1"; lblAllow.Text = "允许"; } else { value = "0"; lblAllow.Text = "禁止"; } try { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); int status = proxy.SetUserSetFixCardOutLimit(value); proxy.Close(); if (status == 1) { MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 登陆时操作员列表显示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CFormOperatorManage_Load(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { // 查询所有操作员信息(除天达维护人员) List <COperatorDto> lstOperatorDto = new List <COperatorDto>(); proxy.GetOperatorList(ref lstOperatorDto); lstOperatorDto = lstOperatorDto.FindAll(s => (EnmOperatorType)s.opttype != EnmOperatorType.CIMCWorker); // 添加列表信息 this.DgvOperator.DataSource = new BindingList <COperatorDto>(lstOperatorDto); } 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(); }
/// <summary> /// 确定推迟n天批量修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnOK_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { //modify by suhan 2015072 if (this.RbtnDelay.Checked == true) { int nDelayDays = 0; int.TryParse(this.TxtDelayDays.Text, out nDelayDays); if (null == m_lstICCardID || 0 >= m_lstICCardID.Count || 0 == nDelayDays) { MessageBox.Show("推迟天数不能为空,选择也不为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult dr = MessageBox.Show("确认批量修改否?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); if (dr == DialogResult.Cancel) { return; } EnmFaultType type = proxy.BatchModifyICCardDeadLine(nDelayDays, m_lstICCardID); switch (type) { case EnmFaultType.Success: { MessageBox.Show("批量修改成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } default: { MessageBox.Show("批量修改失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } this.Close(); } else if (this.RbtnTariff.Checked == true) { //DataTable dt = (DataTable)this.CboTariff.SelectedItem; int nTariffID = (int)this.CboTariff.SelectedValue;//this.CboTariff.SelectedIdatatem.ToString(); EnmFaultType type = proxy.BatchModifyICCardTariffID(nTariffID, m_lstICCardID); switch (type) { case EnmFaultType.Success: { MessageBox.Show("批量修改成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } default: { MessageBox.Show("批量修改失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } this.Close(); } //end by suhan 2015072 } 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 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; }
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; }