Esempio n. 1
0
        /// <summary>
        /// 确定打印按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rightbtn_Click(object sender, RoutedEventArgs e)
        {
            if (!preExam())
            {
                return;
            }

            PrintBLL printbll = new PrintBLL();

            printbll.ClearJobs();

            dtimer.Stop();
            adtimer.Stop();
            stadtimer.Stop();

            App.user.Name     = textBox.Text;
            App.user.PassWord = textBox1.Text;
            App.user.role     = 1;

            List <detail_m> details = getPrintJobList();

            if (details != null && details.Count > 0)
            {
                App.psta.Count    = 0;
                App.psta.nowCount = 0;
                App.psta.jobstype = "";
                foreach (detail_m detail in details)
                {
                    string a = detail.printTypeName;
                    //if (a == "CGCJ") //测试用
                    //{
                    string url = ConfigurationManager.AppSettings[a];

                    App.psta.Count    += detail.printNum;
                    App.psta.jobstype += Enum.GetName(typeof(Jobs), detail.printTypeId) + " ";

                    if (url != null)
                    {
                        JObject jo;

                        jsonbll.jsonToJobject(detail.printContent, out jo);
                        jsonbll.jsonToJobject(jo["data"].ToString(), out jo);
                        int b = getDoc(url, a, jo, Enum.GetName(typeof(Jobs), detail.printTypeId), detail.printNum);
                        if (b == 1)
                        {
                            MessageBox.Show("请联系管理员检查配置有无相应模版或其他错误", "无法加载模板");
                            dtimer.Start();
                            adtimer.Start();
                            stadtimer.Start();
                            return;
                        }
                    }
                    else
                    {
                        dtimer.Start();
                        adtimer.Start();
                        stadtimer.Start();
                        MessageBox.Show("请联系管理员检查配置有无相应模版或其他错误", "无法加载模板");
                        return;
                    }
                    //}
                }

                PrintingPage ppg = new PrintingPage();
                ppg.Owner = this;
                ppg.Show();
            }
            else
            {
                MessageBox.Show("您并无打印订单,或学号和验证码有误", "订单获取失败");
            }
        }