protected void Page_Load(object sender, EventArgs e)
        {
            string ret = webAPIFunc.GetRetString(ErrType.UnkownErr);

            try
            {
                string post = WFHttpWebResponse.PostInput(Request.InputStream);
                if (string.IsNullOrEmpty(post))//没有这两个变量
                {
                    ret = webAPIFunc.GetRetString(ErrType.MissParam);
                    Response.Write(ret);
                    return;
                }
                post = post.Substring(0, post.Length - 1);
                byte[]           rx = StringsFunction.strToHexByte(post, "");
                KeyDataQueueData kd = new KeyDataQueueData();
                kd.DeviceID  = StringsFunction.byteToHexStr(rx, 0, 4, "");
                kd.KeyOption = BytesOP.MakeShort(rx[4], rx[5]);
                kd.format    = rx[6];
                kd.IP        = aspNetFunc.getIp();
                kd.SSID      = StringsFunction.byteToHexStr(rx, 7, 4, "");
                kd.BIN       = StringsFunction.byteToHexStr(rx, 7, 1024, "");
                if (DeviceInfoDataDBOption.Get(kd.DeviceID) == null)
                {
                    ret = webAPIFunc.GetRetString(ErrType.NoRegDevice);
                    Response.Write(ret);
                    return;
                }
                int queueID = KeyDataQueueDataDBOption.Insert(kd);
                if (KeyDataWork.bCalc == false)
                {
                    KeyDataWork.autoResetEvent.Set();
                }
                ret = webAPIFunc.GetRetString(ErrType.retOK, queueID.ToString());
                Response.Write(ret);
                return;
            }
            catch (System.Exception ex)
            {
                ret = webAPIFunc.GetRetString(ErrType.UnkownErr);
                TextLog.AddTextLog("Add_Unkown:" + ex.Message, Global.txtLogFolder + "KayData.txt", true);
            }
            Response.Write(ret);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id, HexVer;
            string ret;

            try
            {
                id     = Request.QueryString["ID"];
                HexVer = Request.QueryString["HexVer"];
                //信息|用户id|实验id,实验名,实验室;
                if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(HexVer))//没有这两个变量
                {
                    ret = "no data";
                }
                else
                {
                    byte[] bid = StringsFunction.strToHexByte(id, "");
                    double ver = double.Parse(HexVer);
                    if (DeviceInfoDataDBOption.Get(id) != null)
                    {
                        ret = "reged";
                    }
                    else
                    {
                        DeviceInfoData di = new DeviceInfoData();
                        di.ID     = id;
                        di.HexVer = ver;
                        DeviceInfoDataDBOption.Insert(di);
                        ret = "ok";
                    }
                }
            }
            catch (System.Exception ex)
            {
                ret = "Exception" + ex.Message;
            }
            Response.Write(ret);
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     strid = Request.QueryString["id"];
     if (!IsPostBack)
     {
         DropDownList1.Items.Clear();
         DropDownList2.Items.Clear();
         for (int i = 1; i < 20; i++)
         {
             DropDownList1.Items.Add(i.ToString());
             DropDownList2.Items.Add(i.ToString());
         }
         DropDownList3.Items.Clear();
         DropDownList3.Items.Add("所有");
         DropDownList3.Items.Add("国内");
         DropDownList3.Items.Add("国外");
         if (strid != null && strid != "")//修改
         {
             ed = DeviceInfoDataDBOption.Get(strid);
             if (ed.bHPass)
             {
                 CheckBox1.Checked = true;
             }
             else
             {
                 CheckBox1.Checked = false;
             }
             if (ed.bDPass)
             {
                 CheckBox2.Checked = true;
             }
             else
             {
                 CheckBox2.Checked = false;
             }
             if (ed.bESLPass)
             {
                 CheckBox3.Checked = true;
             }
             else
             {
                 CheckBox3.Checked = false;
             }
             if (ed.bKeyData)
             {
                 CheckBox4.Checked = true;
             }
             else
             {
                 CheckBox4.Checked = false;
             }
             DropDownList1.SelectedIndex = ed.HPassTimes - 1;
             DropDownList2.SelectedIndex = ed.DPassTimes - 1;
             if (ed.bak1 == "所有")
             {
                 DropDownList3.SelectedIndex = 0;
             }
             else if (ed.bak1 == "国内")
             {
                 DropDownList3.SelectedIndex = 1;
             }
             else if (ed.bak1 == "国外")
             {
                 DropDownList3.SelectedIndex = 2;
             }
             else
             {
                 DropDownList3.SelectedIndex = 1;
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "", " <script lanuage=javascript>alert('缺少数据');GetDataAndClose(); </script>");
         }
     }
 }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string DeviceID, Dealer, SSID;
            string ret = "";

            try
            {
                DeviceID = Request.QueryString["DeviceID"];
                Dealer   = Request.QueryString["pass"];
                SSID     = Request.QueryString["SSID"];
                //信息|用户id|实验id,实验名,实验室;
                if (string.IsNullOrEmpty(DeviceID) || string.IsNullOrEmpty(Dealer) || string.IsNullOrEmpty(SSID))//没有这两个变量
                {
                    ret = webAPIFunc.GetRetString(ErrType.MissParam);
                    Response.Write(ret);
                    return;
                }
                DeviceInfoData did = DeviceInfoDataDBOption.Get(DeviceID);
                if (did == null)
                {
                    ret = webAPIFunc.GetRetString(ErrType.NoRegDevice);
                    Response.Write(ret);
                    return;
                }
                else
                {
                    int ut = DPassWorkLogDataDBOption.GetUseTimes(DeviceID);
                    if (ut > did.DPassTimes)
                    {
                        ret = webAPIFunc.GetRetString(ErrType.MaxUseTimes);
                        Response.Write(ret);
                        return;
                    }
                }
                DataTable dt = DPassRecodeDataDBOption.DataTableSelect(Dealer);
                if (dt.Rows.Count != 0)
                {
                    byte[]           dID    = WFNetLib.StringFunc.StringsFunction.strToHexByte(DeviceID, "");
                    byte[]           sID    = WFNetLib.StringFunc.StringsFunction.strToHexByte(SSID, "");
                    byte[]           DPass  = WFNetLib.StringFunc.StringsFunction.strToHexByte(dt.Rows[0]["DPass"].ToString(), "");
                    byte[]           DDPass = GlobalFunc.Encrypt(DPass, dID, sID);
                    DPassWorkLogData dl     = new DPassWorkLogData();
                    dl.DeviceID = DeviceID;
                    dl.IP       = WFNetLib.aspNetFunc.getIp();
                    dl.Pass     = dt.Rows[0]["Dealer"].ToString();
                    dl.Ret      = dt.Rows[0]["DPass"].ToString();
                    dl.SSID     = SSID;
                    DPassWorkLogDataDBOption.Insert(dl);
                    ret = "2," + dt.Rows[0]["Dealer"] + "-" + WFNetLib.StringFunc.StringsFunction.byteToHexStr(DDPass, "");
                    Response.Write(ret);
                    return;
                }
                else
                {
                    string          LinuxServer = ConfigurationManager.AppSettings["LinuxServer"];
                    Linux_101       WebResponse = new Linux_101();
                    byte[]          bD          = WFNetLib.StringFunc.StringsFunction.strToHexByte(Dealer, "");
                    string          Dealer1     = WFNetLib.StringFunc.StringsFunction.byteToHexStr(bD, " ");
                    string          xml         = string.Format("<?xml version=\"1.0\"?><query><client>{0}</client><data>{1}</data></query>", DeviceID, Dealer1);
                    HttpWebResponse response    = WebResponse.CreatePostHttpResponse(LinuxServer + "/cgi-device/device.cgi?command=search101", xml);
                    if (response == null)
                    {
                        ret = webAPIFunc.GetRetString(ErrType.MissServer);
                        Response.Write(ret);
                        return;
                    }
                    string id = "";
                    int    x;
                    x = WebResponse.Content.IndexOf("<id>");
                    if (x == -1)
                    {
                        ret = webAPIFunc.GetRetString(ErrType.ErrServerRet);
                        Response.Write(ret);
                        return;
                    }
                    id  = WebResponse.Content.Substring(x + "<id>".Length, WebResponse.Content.IndexOf("</id>") - x - "<id>".Length);
                    ret = webAPIFunc.GetRetString(ErrType.retOK, id);
                }
            }
            catch (System.Exception ex)
            {
                ret = webAPIFunc.GetRetString(ErrType.UnkownErr);
                TextLog.AddTextLog("Add_Unkown:" + ex.Message, Global.txtLogFolder + "DPass.txt", true);
            }
            Response.Write(ret);
        }