142 lines
5.3 KiB
C#
142 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
|
|
namespace dccdc.Selfhelp
|
|
{
|
|
public partial class frm_yypd : Form
|
|
{
|
|
public frm_yypd()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frm_yypd_Load(object sender, EventArgs e)
|
|
{
|
|
TopMost = true;
|
|
TopLevel = true;
|
|
//btn_jh.FlatAppearance.BorderSize = 0;
|
|
btn_jh.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
|
btn_jh.FlatAppearance.BorderSize = 0;
|
|
btn_jh.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
|
|
btn_jh.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
|
|
btn_jh.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
WebClient wc = new WebClient();
|
|
wc.Encoding = Encoding.UTF8;
|
|
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
|
|
lbl_sw.Text = wc.UploadString(extend.URL + "zzj/getParm", "key=swpdsj");
|
|
wc = new WebClient();
|
|
wc.Encoding = Encoding.UTF8;
|
|
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
|
|
lbl_xw.Text = wc.UploadString(extend.URL + "zzj/getParm", "key=xwpdsj");
|
|
lbl_pdrs.Text = wc.UploadString(extend.URL + "zzj/getPdrs", "");
|
|
}
|
|
private void frm_bgcx_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
Rectangle rect = new Rectangle(30, 30, 170, 56);
|
|
if (rect.Contains(e.Location))
|
|
{
|
|
Cursor = Cursors.Hand;
|
|
}
|
|
else
|
|
{
|
|
Cursor = Cursors.Default;
|
|
}
|
|
}
|
|
|
|
private void frm_bgcx_MouseClick(object sender, MouseEventArgs e)
|
|
{
|
|
Rectangle rect = new Rectangle(30, 30, 170, 56);
|
|
if (rect.Contains(e.Location))
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void btn_jh_Click(object sender, EventArgs e)
|
|
{
|
|
string swsj1 = lbl_sw.Text.Split('-')[0];
|
|
string swsj2 = lbl_sw.Text.Split('-')[1];
|
|
string xwsj1 = lbl_xw.Text.Split('-')[0];
|
|
string xwsj2 = lbl_xw.Text.Split('-')[1];
|
|
DateTime ds1 = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + swsj1);
|
|
DateTime ds2 = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + swsj2);
|
|
DateTime dx1 = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + xwsj1);
|
|
DateTime dx2 = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + xwsj2);
|
|
|
|
if ((DateTime.Now >= ds1 && DateTime.Now <= ds2) || (DateTime.Now >= dx1 && DateTime.Now <= dx2))
|
|
{ }
|
|
else
|
|
{
|
|
Status s2 = new Status("当前时间不能取号", false);
|
|
s2.Show();
|
|
Application.DoEvents();
|
|
Thread.Sleep(2000);
|
|
s2.Close();
|
|
return;
|
|
}
|
|
Status s = new Status("正在取号请稍后……", false);
|
|
s.Show();
|
|
Application.DoEvents();
|
|
string pos_dyj = System.Configuration.ConfigurationManager.AppSettings["pos_dyj"];
|
|
WebClient wc = new WebClient();
|
|
wc.Encoding = Encoding.UTF8;
|
|
string jsonData = wc.UploadString(extend.URL + "zzj/JiaoHao", "datetime=" + DateTime.Now.Ticks);
|
|
var state = Newtonsoft.Json.JsonConvert.DeserializeObject<OperationResult>(jsonData);
|
|
if (state.State == 1)
|
|
{
|
|
FastReport.Report re = new FastReport.Report();
|
|
re.Load(Application.StartupPath + "\\report\\pdjh.frx");
|
|
string[] cs = state.Message.Split('|');
|
|
re.SetParameterValue("hm", cs[0]);
|
|
re.SetParameterValue("qhsj", cs[1]);
|
|
re.SetParameterValue("ddrs", cs[2]);
|
|
re.PrintSettings.ShowDialog = false;
|
|
if (!string.IsNullOrEmpty(pos_dyj))
|
|
re.PrintSettings.Printer = pos_dyj;
|
|
re.Print();
|
|
s.update("取号成功!");
|
|
//s.Show();
|
|
Application.DoEvents();
|
|
Thread.Sleep(2000);
|
|
}
|
|
else
|
|
{
|
|
//s =new Status(state.Message,true);
|
|
s.update(state.Message);
|
|
//s.Show();
|
|
Application.DoEvents();
|
|
Thread.Sleep(2000);
|
|
|
|
}
|
|
s.Close();
|
|
}
|
|
|
|
internal void sxrs(string dqddrs)
|
|
{
|
|
WebClient wc = new WebClient();
|
|
wc.Encoding = Encoding.UTF8;
|
|
//lbl_sw.Text = wc.UploadString(extend.URL + "zzj/getParm", "key=swpdsj");
|
|
//lbl_xw.Text = wc.UploadString(extend.URL + "zzj/getParm", "key=xwpdsj");
|
|
lbl_pdrs.Text = wc.UploadString(extend.URL + "zzj/getPdrs", "");
|
|
//throw new NotImplementedException();
|
|
//lbl_pdrs.Text = dqddrs;
|
|
this.Invalidate();
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
//timer1.Enabled = false;
|
|
if (!this.IsDisposed)
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|