Exemplo n.º 1
0
        private void bu_ReportPrint_CardCommandLog_Click(object sender, RoutedEventArgs e)
        {
            string tmpABA = "", tmpERName = "", tmpStrTime = "", tmpEndTime = "";
            if (!string.IsNullOrEmpty(txt_ABA_CardCommandLog.Text))
            {
                tmpABA = txt_ABA_CardCommandLog.Text;
            }

            if (cb_ERName_CardCommandLog.SelectedIndex != 0)
            {
                tmpERName = cb_ERName_CardCommandLog.SelectedValue.ToString();
            }


            if (dp_StartDate_CardCommandLog.SelectedDate != null || dp_EndDate_CardCommandLog.SelectedDate != null)
            {
                bool flag = Comm.checkTimes(dp_StartDate_CardCommandLog.SelectedDate.ToString(), dp_EndDate_CardCommandLog.SelectedDate.ToString());

                if (flag == true)
                {
                    tmpStrTime = Comm.strTime.ToString("yyyy-MM-dd HH:mm:ss");
                    tmpEndTime = Comm.endTime.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }

            //透過HttpUtility.UrlEncode(參數名)對中文參數進行編碼   
            //var filePath = "http://" + Application.Current.Host.Source.Host + ":" + Application.Current.Host.Source.Port + 
            var filePath = ReportViewer +        
                 "/rp_vwCardCommandLogPage.aspx?" +
                 "ERName=" + HttpUtility.UrlEncode(tmpERName) +
                 "&ABA=" + HttpUtility.UrlEncode(tmpABA) +
                 "&StrTime=" + HttpUtility.UrlEncode(tmpStrTime) +
                 "&EndTime=" + HttpUtility.UrlEncode(tmpEndTime);

            //Uri myURI = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, filePath);
            //System.Windows.Browser.HtmlPage.Window.Navigate(myURI, "_blank");
            //if (App.Current.IsRunningOutOfBrowser)
            //{
                MyHyperlinkButton button = new MyHyperlinkButton();
                button.NavigateUri = new Uri(filePath);
                button.TargetName = "_blank";
                button.ClickMe();
            //}
            //else
            //{
            //    System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, filePath), "_blank");
            //} 
        }
Exemplo n.º 2
0
        private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {


            AlarmData alarmdata = (sender as StackPanel).DataContext as AlarmData;
            //   client.Dispose();
           
            if (alarmdata.AlarmType == AlarmType.CARD) //未歸還卡片警告
            {
#if !R23
                this.frameMain.Navigate(new Uri("/slSecureLib;component/Forms/R13/slReport.xaml?IsShowNoReturnMagneticCard=1" , UriKind.Relative));
#else
                this.frameMain.Navigate(new Uri("/slSecureLib;component/Forms/R23/slReport.xaml?IsShowNoReturnMagneticCard=1" , UriKind.Relative));
#endif
            }
            else

                if (alarmdata.AlarmType == AlarmType.PD)
            {
               

                //PaneID is PDID for AlarmType=PD
#if  R23
                //button.NavigateUri = new Uri("http://" + App.Current.Host.Source.Host + ":" + App.Current.Host.Source.Port + "/R23/secure/focus?PDName=" + HttpUtility.UrlEncode(alarmdata.PlaneName));
                
                 // http://10.21.99.80/PD/secure/focus?PDName=PD-030008-S-M-32
                this.frameMain.Navigate(new Uri("/Forms/WebPage.xaml?url=" + "http://" + App.Current.Host.Source.Host + ":" + App.Current.Host.Source.Port + "/PD/secure/focus?PDName=" + HttpUtility.UrlEncode(alarmdata.PlaneName), UriKind.Relative));
#else
                      MyHyperlinkButton button = new MyHyperlinkButton();
                button.NavigateUri = new Uri("http://" + App.Current.Host.Source.Host + ":" + App.Current.Host.Source.Port + "/R13/secure/focus?PDName=" +   HttpUtility.UrlEncode(alarmdata.PlaneName));
                button.TargetName = "_blank";

                button.ClickMe();
#endif

            }
#if R23
                else if (alarmdata.AlarmType == AlarmType.PowerMeter) 
                {
                    
                     this.frameMain.Navigate(new Uri("/slSecureLib;component/Forms/R23/slPowerMeterAndWaterMeter.xaml?IsShowWaterOrPower=Power",UriKind.Relative));
                  
                }
                else if( alarmdata.AlarmType == AlarmType.WaterMeter)
                {
                     this.frameMain.Navigate(new Uri("/slSecureLib;component/Forms/R23/slPowerMeterAndWaterMeter.xaml?IsShowWaterOrPower=Water",UriKind.Relative));
                }
#endif

                else
                this.frameMain.Navigate(new Uri("/Forms/ControlRoom.xaml?PlaneID=" + alarmdata.PlaneID, UriKind.Relative));
            //this.frameMain.Navigate(new Uri("/Forms/ControlRoom.xaml", UriKind.Relative));
        }
        private void bu_ReportPrint_Click(object sender, RoutedEventArgs e)
        {
            string tmpABA = "", tmpName = "", tmpTypeName = "", tmpERName = "", tmpColumnDateName = "", tmpStrTime = "", tmpEndTime = "";
            if (!string.IsNullOrEmpty(txt_ABA_Qy.Text))
            {
                tmpABA = txt_ABA_Qy.Text;
            }

            if (!string.IsNullOrEmpty(txt_Name_Qy.Text))
            {
                tmpName = txt_Name_Qy.Text;
            }

            if (cb_Type_Qy.SelectedIndex != 0)
            {
                tmpTypeName = cb_Type_Qy.SelectedValue.ToString();
            }

            if (cb_ERName_Qy.SelectedIndex != 0)
            {
                tmpERName = cb_ERName_Qy.SelectedValue.ToString();
            }

            if (cb_Date_Qy.SelectedIndex != 0)
            {
                tmpColumnDateName = cb_Date_Qy.SelectedValue.ToString();

                if (dp_StartDate_Qy.SelectedDate != null || dp_EndDate_Qy.SelectedDate != null)
                {
                    bool flag = Comm.checkTimes(dp_StartDate_Qy.SelectedDate.ToString(), dp_EndDate_Qy.SelectedDate.ToString());

                    if (flag == true)
                    {
                        tmpStrTime = Comm.strTime.ToString("yyyy-MM-dd HH:mm:ss");
                        tmpEndTime = Comm.endTime.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                }
            }
            string tmpIsShowABA = "", tmpIsShowTypeName = "", tmpIsShowNormalName = "", tmpIsShowName = "",
                   tmpIsShowIDNumber = "", tmpIsShowCompany = "", tmpIsShowEmployeeNo = "", tmpIsShowJobTitle = "",
                   tmpIsShowTel = "", tmpIsShowMobile = "", tmpIsShowStartDate = "", tmpIsShowEndDate = "",
                   tmpIsShowTimestamp = "", tmpIsShowReturnDate = "", tmpIsShowMemo = "", tmpIsShowERName = "",
                   tmpIsShowDoor = "";

            foreach (var c in dataGridDetail.Columns)
            {
                string tmpHeader = "";
                tmpHeader = c.Header.ToString();
                if ("磁卡(ABA)" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowABA = "1";
                    }
                    else
                    {
                        tmpIsShowABA = "0";
                    }
                }
                else if ("磁卡類型" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowTypeName = "1";
                    }
                    else
                    {
                        tmpIsShowTypeName = "0";
                    }
                }
                else if ("磁卡群組名稱" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowNormalName = "1";
                    }
                    else
                    {
                        tmpIsShowNormalName = "0";
                    }
                }
                else if ("姓名" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowName = "1";
                    }
                    else
                    {
                        tmpIsShowName = "0";
                    }
                }
                else if ("身份證號碼" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowIDNumber = "1";
                    }
                    else
                    {
                        tmpIsShowIDNumber = "0";
                    }
                }
                else if ("公司" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowCompany = "1";
                    }
                    else
                    {
                        tmpIsShowCompany = "0";
                    }
                }
                else if ("職工編號" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowEmployeeNo = "1";
                    }
                    else
                    {
                        tmpIsShowEmployeeNo = "0";
                    }
                }
                else if ("職位" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowJobTitle = "1";
                    }
                    else
                    {
                        tmpIsShowJobTitle = "0";
                    }
                }
                else if ("電話" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowTel = "1";
                    }
                    else
                    {
                        tmpIsShowTel = "0";
                    }
                }
                else if ("手機" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowMobile = "1";
                    }
                    else
                    {
                        tmpIsShowMobile = "0";
                    }
                }
                else if ("起始日期" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowStartDate = "1";
                    }
                    else
                    {
                        tmpIsShowStartDate = "0";
                    }
                }
                else if ("到期日期" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowEndDate = "1";
                    }
                    else
                    {
                        tmpIsShowEndDate = "0";
                    }
                }
                else if ("發卡日期" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowTimestamp = "1";
                    }
                    else
                    {
                        tmpIsShowTimestamp = "0";
                    }
                }
                else if ("實際已歸還日期" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowReturnDate = "1";
                    }
                    else
                    {
                        tmpIsShowReturnDate = "0";
                    }
                }
                else if ("備註" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowMemo = "1";
                    }
                    else
                    {
                        tmpIsShowMemo = "0";
                    }
                }
                else if ("機房名稱" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowERName = "1";
                    }
                    else
                    {
                        tmpIsShowERName = "0";
                    }
                }
                else if ("大門名稱" == tmpHeader)
                {
                    if (c.Visibility == Visibility.Visible)
                    {
                        tmpIsShowDoor = "1";
                    }
                    else
                    {
                        tmpIsShowDoor = "0";
                    }
                }
            }

            //透過HttpUtility.UrlEncode(參數名)對中文參數進行編碼   
            //var filePath = "http://" + Application.Current.Host.Source.Host + ":" + Application.Current.Host.Source.Port + 
            var filePath = ReportViewer + //"http://localhost:30553/ReportViewer" +
                 "/rp_vwMagneticCardDetailPage.aspx?" +
                 "ABA=" + HttpUtility.UrlEncode(tmpABA) +
                 "&Name=" + HttpUtility.UrlEncode(tmpName) +
                 "&TypeName=" + HttpUtility.UrlEncode(tmpTypeName) +
                 "&ERName=" + HttpUtility.UrlEncode(tmpERName) +
                 "&ColumnDateName=" + HttpUtility.UrlEncode(tmpColumnDateName) +
                 "&StrTime=" + HttpUtility.UrlEncode(tmpStrTime) +
                 "&EndTime=" + HttpUtility.UrlEncode(tmpEndTime) +
                 "&IsShowABA=" + HttpUtility.UrlEncode(tmpIsShowABA) +
                 "&IsShowTypeName=" + HttpUtility.UrlEncode(tmpIsShowTypeName) +
                 "&IsShowNormalName=" + HttpUtility.UrlEncode(tmpIsShowNormalName) +
                 "&IsShowName=" + HttpUtility.UrlEncode(tmpIsShowName) +
                 "&IsShowIDNumber=" + HttpUtility.UrlEncode(tmpIsShowIDNumber) +
                 "&IsShowCompany=" + HttpUtility.UrlEncode(tmpIsShowCompany) +
                 "&IsShowEmployeeNo=" + HttpUtility.UrlEncode(tmpIsShowEmployeeNo) +
                 "&IsShowJobTitle=" + HttpUtility.UrlEncode(tmpIsShowJobTitle) +
                 "&IsShowTel=" + HttpUtility.UrlEncode(tmpIsShowTel) +
                 "&IsShowMobile=" + HttpUtility.UrlEncode(tmpIsShowMobile) +
                 "&IsShowStartDate=" + HttpUtility.UrlEncode(tmpIsShowStartDate) +
                 "&IsShowEndDate=" + HttpUtility.UrlEncode(tmpIsShowEndDate) +
                 "&IsShowTimestamp=" + HttpUtility.UrlEncode(tmpIsShowTimestamp) +
                 "&IsShowReturnDate=" + HttpUtility.UrlEncode(tmpIsShowReturnDate) +
                 "&IsShowMemo=" + HttpUtility.UrlEncode(tmpIsShowMemo) +
                 "&IsShowERName=" + HttpUtility.UrlEncode(tmpIsShowERName) +
                 "&IsShowDoor=" + HttpUtility.UrlEncode(tmpIsShowDoor);


            //Uri myURI = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, filePath);
            //System.Windows.Browser.HtmlPage.Window.Navigate(myURI);

            //silverlight內建web browser
            //wb1.Navigate(new Uri(filePath));
            //if (App.Current.IsRunningOutOfBrowser)
            //{
            MyHyperlinkButton button = new MyHyperlinkButton();
            button.NavigateUri = new Uri(filePath);
            button.TargetName = "_blank";
            button.ClickMe();
            //}
            //else
            //{
            //    System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, filePath), "_blank");
            //} 
        }
Exemplo n.º 4
0
        private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            this.txtTitle.DataContext = (sender as Control).DataContext;
            vwUserMenuAllow menu = (sender as Control).DataContext as vwUserMenuAllow;

            if (menu.XAML.Trim().ToUpper().StartsWith("HTTP:"))
            {
                MyHyperlinkButton button = new MyHyperlinkButton();

                button.NavigateUri = new Uri(menu.XAML);

                button.TargetName = "_blank";

                button.ClickMe();

            }
            else if (menu.XAML.Trim().ToUpper().StartsWith("@HTTP:"))
            {
              //  this.frameMain.Navigate(new Uri("/DivHtmlPage.xaml?url=" + menu.XAML.TrimStart(new char[] { '@' }), UriKind.Relative));
                this.frameMain.Navigate(new Uri("/Forms/WebPage.xaml?url=" + menu.XAML.TrimStart(new char[]{'@'}), UriKind.Relative));

            }

            //  this.frameMain.Navigate(new Uri("/Forms/WebPage.xaml?url=" + menu.XAML, UriKind.Relative));
            // System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri, filePath), "_blank");
            else
                this.frameMain.Navigate(new Uri(menu.XAML, UriKind.Relative));
        }