Ejemplo n.º 1
0
        public static bool API_UPLoadFile2(string pDeviceID, string pFileName, int pPackgeLength)
        {
            bool result;

            try
            {
                string url  = formMain.GprsServer + "terminal/uploadBase64TransDataByUser.json";
                string text = "user.id=" + GprsAdministrator.Entity_ID;
                text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
                text = text + "&user.username="******"&user.sign=" + GprsAdministrator.Entity_Sign;
                text = text + "&entity.id=" + pDeviceID;
                text = text + "&entity.frameLength=" + pPackgeLength.ToString();
                FileStream fileStream = new FileStream(pFileName, FileMode.Open, FileAccess.Read);
                byte[]     array      = new byte[fileStream.Length];
                fileStream.Read(array, 0, Convert.ToInt32(fileStream.Length));
                fileStream.Close();
                string str = HttpUtility.UrlEncode(Convert.ToBase64String(array));
                text = text + "&base64=" + str;
                GprsAdministrator.GetWebClient(url, text);
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
 private void button_Unbind_Click(object sender, EventArgs e)
 {
     if (GprsAdministrator.API_UserUnBindNewDevice(this.dr.Cells[9].Value.ToString()))
     {
         MessageBox.Show(this, formMain.ML.GetStr("GPRS_UnbindSuccess"));
         base.Dispose();
         return;
     }
     MessageBox.Show(this, formMain.ML.GetStr("GPRS_UnbindFailed"));
 }
Ejemplo n.º 3
0
 public static bool API_UserLogin(string pUserName, string pPassword)
 {
     try
     {
         string url = string.Concat(new string[]
         {
             formMain.GprsServer,
             "user/login.json?entity.username="******"&entity.password="******"success"].ToObject <bool>())
         {
             JArray jArray2 = GprsAdministrator.Json2JArray("[" + jArray[0]["entity"].ToString() + "]");
             GprsAdministrator.Entity_UserType = jArray2[0]["userType"].ToObject <string>();
             GprsAdministrator.Entity_Sign     = jArray2[0]["sign"].ToObject <string>();
             GprsAdministrator.Entity_ID       = jArray2[0]["id"].ToObject <string>();
             GprsAdministrator.Entity_Username = jArray2[0]["username"].ToObject <string>();
             GprsAdministrator.Entity_Password = jArray2[0]["password"].ToObject <string>();
             GprsAdministrator.Entity_IsSupper = false;
             result = true;
             return(result);
         }
         GprsAdministrator.Entity_UserType     = "";
         GprsAdministrator.Entity_Sign         = "";
         GprsAdministrator.Entity_ID           = "";
         GprsAdministrator.Entity_Username     = "";
         GprsAdministrator.Entity_IsSupper     = false;
         GprsAdministrator.Entity_PhoneNnumber = "";
         GprsAdministrator.Entity_Email        = "";
         GprsAdministrator.Entity_Address      = "";
         GprsAdministrator.Entity_CreateAt     = "";
         GprsAdministrator.Entity_UpdateAt     = "";
         GprsAdministrator.Message             = jArray[0]["message"].ToString();
         result = false;
         return(result);
     }
     catch
     {
         GprsAdministrator.Message = formMain.ML.GetStr("GPRS_AccessError");
     }
     return(false);
 }
Ejemplo n.º 4
0
        public static bool API_UserChangePassword(string pID, string pOldPassword, string pNewPassword)
        {
            string text = formMain.GprsServer + "user/changePassword.json?";

            text = text + "entity.id=" + GprsAdministrator.Entity_ID;
            text = text + "&oldPassword="******"&newPassword="******"message"].ToString();
            return(jArray[0]["success"].ToObject <bool>());
        }
Ejemplo n.º 5
0
        public static bool API_RemoveAdmin(string pID)
        {
            string text = formMain.GprsServer + "admin/remove.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.username="******"&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.sign=" + GprsAdministrator.Entity_Sign;
            text = text + "&entity.id=" + pID + GprsAdministrator.GetTimeStamp();
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            GprsAdministrator.Message = jArray[0]["message"].ToString();
            return(jArray[0]["success"].ToObject <bool>());
        }
Ejemplo n.º 6
0
        public static bool API_AdminUnbindDevice(string pUserID, string pDeviceID)
        {
            string text = formMain.GprsServer + "terminal/unbindToUserByAdmin.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.username="******"&admin.sign=" + GprsAdministrator.Entity_Sign;
            text = text + "&entity.id=" + pDeviceID;
            text = text + "&user.id=" + pUserID + GprsAdministrator.GetTimeStamp();
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            GprsAdministrator.Message = jArray[0]["message"].ToString();
            return(jArray[0]["success"].ToObject <bool>());
        }
Ejemplo n.º 7
0
        public static bool API_AdminLogin(string pUserName, string pPassword)
        {
            string url   = formMain.GprsServer + "admin/login.json";
            string param = string.Concat(new string[]
            {
                "entity.username="******"&entity.password="******"success"].ToObject <bool>())
            {
                JArray jArray2 = GprsAdministrator.Json2JArray("[" + jArray[0]["entity"].ToString() + "]");
                GprsAdministrator.Entity_UserType     = jArray2[0]["userType"].ToObject <string>();
                GprsAdministrator.Entity_Sign         = jArray2[0]["sign"].ToObject <string>();
                GprsAdministrator.Entity_ID           = jArray2[0]["id"].ToObject <string>();
                GprsAdministrator.Entity_Username     = jArray2[0]["username"].ToObject <string>();
                GprsAdministrator.Entity_IsSupper     = jArray2[0]["isSuper"].ToObject <bool>();
                GprsAdministrator.Entity_PhoneNnumber = jArray2[0]["phoneNumber"].ToObject <string>();
                GprsAdministrator.Entity_Email        = jArray2[0]["email"].ToObject <string>();
                GprsAdministrator.Entity_Address      = jArray2[0]["address"].ToObject <string>();
                GprsAdministrator.Entity_CreateAt     = jArray2[0]["createdAt"].ToObject <string>();
                GprsAdministrator.Entity_UpdateAt     = jArray2[0]["updatedAt"].ToObject <string>();
                return(true);
            }
            GprsAdministrator.Entity_UserType     = "";
            GprsAdministrator.Entity_Sign         = "";
            GprsAdministrator.Entity_ID           = "";
            GprsAdministrator.Entity_Username     = "";
            GprsAdministrator.Entity_IsSupper     = false;
            GprsAdministrator.Entity_PhoneNnumber = "";
            GprsAdministrator.Entity_Email        = "";
            GprsAdministrator.Entity_Address      = "";
            GprsAdministrator.Entity_CreateAt     = "";
            GprsAdministrator.Entity_UpdateAt     = "";
            GprsAdministrator.Message             = jArray[0]["message"].ToString();
            return(false);
        }
Ejemplo n.º 8
0
        public static JArray API_GetAdminList()
        {
            string text = formMain.GprsServer + "admin/list.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.username="******"&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.sign=" + GprsAdministrator.Entity_Sign;
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            if (jArray[0]["success"].ToObject <bool>())
            {
                return(GprsAdministrator.Json2JArray(jArray[0]["entities"].ToString()));
            }
            return(null);
        }
Ejemplo n.º 9
0
        public static JArray API_GetUserList(int pPage)
        {
            string text = formMain.GprsServer + "user/listByAdmin.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.username="******"&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.sign=" + GprsAdministrator.Entity_Sign;
            text = text + "&page=" + pPage.ToString();
            text = text + "&rows=100" + GprsAdministrator.GetTimeStamp();
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            if (jArray[0]["success"].ToObject <bool>())
            {
                return(GprsAdministrator.Json2JArray(jArray[0]["entities"].ToString()));
            }
            return(null);
        }
Ejemplo n.º 10
0
        public static bool API_EditAdministrator(string pID, string pName, string pPassword, string pPhoneNumber, string pEmail, string pAddress)
        {
            string text = formMain.GprsServer + "admin/update.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.username="******"&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.sign=" + GprsAdministrator.Entity_Sign;
            text = text + "&entity.id=" + pID;
            text = text + "&entity.username="******"&entity.phoneNumber=" + pPhoneNumber;
            text = text + "&entity.email=" + pEmail;
            text = text + "&entity.address=" + pAddress + GprsAdministrator.GetTimeStamp();
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            GprsAdministrator.Message = jArray[0]["message"].ToString();
            return(jArray[0]["success"].ToObject <bool>());
        }
Ejemplo n.º 11
0
        public static JArray API_AdminGetUserInfo(string pUserName)
        {
            string text = formMain.GprsServer + "user/findByUsernameForAdmin.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.username="******"&admin.sign=" + GprsAdministrator.Entity_Sign + GprsAdministrator.GetTimeStamp();
            text = text + "&entity.username="******"message"].ToString();
            if (jArray[0]["success"].ToObject <bool>())
            {
                return(GprsAdministrator.Json2JArray(jArray[0]["entity"].ToString()));
            }
            return(null);
        }
Ejemplo n.º 12
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.textBox_OldPassword.Text.Length < 8)
     {
         MessageBox.Show(this, formMain.ML.GetStr("GPRS_InvalidOldPassword"));
         return;
     }
     if (this.textBox_NewPassword.Text.Length < 8)
     {
         MessageBox.Show(this, formMain.ML.GetStr("GPRS_InvalidNewPassword"));
         return;
     }
     if (this.textBox_NewPassword.Text != this.textBox_NewPasswordCon.Text)
     {
         MessageBox.Show(this, formMain.ML.GetStr("GPRS_NewPassrodDiff"));
         return;
     }
     if (this.isUser)
     {
         this.operationResult = GprsAdministrator.API_UserChangePassword(this.id, this.textBox_OldPassword.Text.Trim(), this.textBox_NewPassword.Text.Trim());
         if (this.operationResult)
         {
             MessageBox.Show(this, formMain.ML.GetStr("GPRS_Change_Success"));
             base.Dispose();
             return;
         }
         MessageBox.Show(formMain.ML.GetStr("GPRS_Change_Failed"));
         return;
     }
     else
     {
         this.operationResult = GprsAdministrator.API_ChangePassword(this.id, this.textBox_OldPassword.Text.Trim(), this.textBox_NewPassword.Text.Trim());
         if (this.operationResult)
         {
             MessageBox.Show(this, formMain.ML.GetStr("GPRS_Change_Success"));
             base.Dispose();
             return;
         }
         MessageBox.Show(formMain.ML.GetStr("GPRS_Change_Failed"));
         return;
     }
 }
Ejemplo n.º 13
0
        public static bool API_UPLoadRoutingData(string pDeviceID, byte[] pRoutingData)
        {
            bool result;

            try
            {
                string url  = formMain.GprsServer + "terminal/uploadBase64RoutingDataByUser.json";
                string text = "user.id=" + GprsAdministrator.Entity_ID;
                text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
                text = text + "&user.username="******"&user.sign=" + GprsAdministrator.Entity_Sign;
                text = text + "&entity.id=" + pDeviceID;
                text = text + "&base64=" + HttpUtility.UrlEncode(Convert.ToBase64String(pRoutingData));
                GprsAdministrator.GetWebClient(url, text);
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 14
0
        public static bool API_CreateUser()
        {
            string text = formMain.GprsServer + "user/generateUser.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.username="******"&admin.sign=" + GprsAdministrator.Entity_Sign + GprsAdministrator.GetTimeStamp();
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            GprsAdministrator.Message = jArray[0]["message"].ToString();
            if (jArray[0]["success"].ToObject <bool>())
            {
                JArray jArray2 = GprsAdministrator.Json2JArray(jArray[0]["entity"].ToString());
                GprsAdministrator.lastuserid   = jArray2[0]["id"].ToString();
                GprsAdministrator.lastUsername = jArray2[0]["username"].ToString();
                GprsAdministrator.lastPassword = jArray2[0]["password"].ToString();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 15
0
        public static bool API_SingleCommand(string pEntityID, byte[] pCmdData)
        {
            bool result;

            try
            {
                string url  = formMain.GprsServer + "terminal/sendSingleCommandByUser.json";
                string text = "user.id=" + GprsAdministrator.Entity_ID;
                text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
                text = text + "&user.username="******"&user.sign=" + GprsAdministrator.Entity_Sign;
                text = text + "&entity.id=" + pEntityID;
                text = text + "&base64=" + HttpUtility.UrlEncode(Convert.ToBase64String(pCmdData));
                GprsAdministrator.GetWebClient(url, text);
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 16
0
        public static bool API_UserUpdateDeviceInfo(string pValueString)
        {
            string url  = formMain.GprsServer + "terminal/updateByUser.json";
            string text = "user.id=" + GprsAdministrator.Entity_ID;

            text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&user.username="******"&user.sign=",
                GprsAdministrator.Entity_Sign,
                pValueString,
                GprsAdministrator.GetTimeStamp()
            });
            string webClient = GprsAdministrator.GetWebClient(url, text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            return(jArray[0]["success"].ToObject <bool>());
        }
Ejemplo n.º 17
0
        public static bool API_UserUnBindNewDevice(string pDevideID)
        {
            string url  = formMain.GprsServer + "terminal/unbindFromSelf.json";
            string text = "user.id=" + GprsAdministrator.Entity_ID;

            text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&user.username="******"&user.sign=",
                GprsAdministrator.Entity_Sign,
                "&Time=",
                GprsAdministrator.GetTimeStamp()
            });
            text = text + "&entity.id=" + pDevideID;
            string webClient = GprsAdministrator.GetWebClient(url, text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            return(jArray[0]["success"].ToObject <bool>());
        }
Ejemplo n.º 18
0
        public static bool API_CheckUserAdvancedPassword(string pPassword)
        {
            string url  = formMain.GprsServer + "user/verifyAdvancedPassword.json";
            string text = "user.id=" + GprsAdministrator.Entity_ID;

            text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&user.username="******"&user.sign=",
                GprsAdministrator.Entity_Sign,
                "&Time=",
                GprsAdministrator.GetTimeStamp()
            });
            text = text + "&entity.advancedPassword="******"success"].ToObject <bool>());
        }
Ejemplo n.º 19
0
        public static bool API_ImportDevice(string pDeviceID, string pUserId, string pModel)
        {
            string text = formMain.GprsServer + "terminal/createByAdmin.json?";

            text = text + "admin.id=" + GprsAdministrator.Entity_ID;
            text = text + "&admin.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&admin.username="******"&admin.sign=" + GprsAdministrator.Entity_Sign;
            text = text + "&entity.deviceModel=" + pModel;
            text = text + "&entity.originalUserId=" + pUserId;
            text = text + "&entity.terminalCode=" + pDeviceID + GprsAdministrator.GetTimeStamp();
            string webClient = GprsAdministrator.GetWebClient(text);
            JArray jArray    = GprsAdministrator.Json2JArray(webClient);

            GprsAdministrator.Message = jArray[0]["message"].ToString();
            if (jArray[0]["success"].ToObject <bool>())
            {
                JArray jArray2 = GprsAdministrator.Json2JArray(jArray[0]["entity"].ToString());
                GprsAdministrator.laseDeviceID = jArray2[0]["id"].ToString();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 20
0
        public static JArray API_GetUserDeviceList()
        {
            string text = formMain.GprsServer + "terminal/listByUser.json?";

            text  = text + "user.id=" + GprsAdministrator.Entity_ID;
            text  = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
            text  = text + "&user.username="******"&user.sign=" + GprsAdministrator.Entity_Sign + GprsAdministrator.GetTimeStamp();
            text += "&Rows=99999";
            string webClient = GprsAdministrator.GetWebClient(text);

            if (webClient == "")
            {
                return(null);
            }
            JArray jArray = GprsAdministrator.Json2JArray(webClient);

            GprsAdministrator.Message = jArray[0]["message"].ToString();
            if (jArray[0]["success"].ToObject <bool>())
            {
                return(GprsAdministrator.Json2JArray(jArray[0]["entities"].ToString()));
            }
            return(null);
        }
Ejemplo n.º 21
0
        public static bool API_UserBindNewDevice(string pUserName, string pPassword)
        {
            string url  = formMain.GprsServer + "terminal/bindToUserFromUser.json";
            string text = "user.id=" + GprsAdministrator.Entity_ID;

            text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
            text = text + "&user.username="******"&user.sign=",
                GprsAdministrator.Entity_Sign,
                "&Time=",
                GprsAdministrator.GetTimeStamp()
            });
            text = text + "&sourceUsername="******"&sourcePassword="******"success"].ToObject <bool>());
        }
Ejemplo n.º 22
0
 private void SendSingle(object pObj)
 {
     try
     {
         GprsContentInfo gprsContentInfo = (GprsContentInfo)pObj;
         gprsContentInfo.FontSize    = formGprsSendAll.getFontSizeByHeight(gprsContentInfo.Height, 0.1f);
         gprsContentInfo.Content     = formGprsSendAll.textList.EDText.Text;
         gprsContentInfo.ContentFont = formGprsSendAll.textList.EDText.Font.GetFont((float)gprsContentInfo.FontSize);
         byte[]   bytes    = GprsAdministrator.API_DownLoadRoutingData(gprsContentInfo.Id);
         LedPanel ledPanel = LedPanel.Parse(bytes);
         gprsContentInfo.LedModel = ledPanel.CardType.ToString().Replace("_", "-");
         gprsContentInfo.Width    = ledPanel.Width;
         gprsContentInfo.Height   = ledPanel.Height;
         gprsContentInfo.Panel    = ledPanel;
         LedItem ledItem = new LedItem();
         ledItem.Edge = formMain.NewEdgeData();
         LedDText ledDText = new LedDText();
         ledDText.EffectsSetting.EntryMode  = 3;
         ledDText.EffectsSetting.EntrySpeed = formGprsSendAll.textList.EffectsSetting.EntrySpeed;
         ledDText.Edge             = formMain.NewEdgeData();
         ledDText.EDText.Text      = gprsContentInfo.Content;
         ledDText.EDText.ForeColor = LedColorConst.Red;
         ledDText.EDText.Font      = new LedFont(gprsContentInfo.ContentFont);
         ledDText.EDText.Kerning   = formGprsSendAll.textList.EDText.Kerning;
         ledDText.DrawMode         = LedDrawMode.Full;
         System.Drawing.Size size = new System.Drawing.Size(gprsContentInfo.Width, gprsContentInfo.Height);
         ledItem.AddSubarea(new LedSubarea(0, 0, size.Width, size.Height, ledDText)
         {
             Type = LedSubareaType.PictureText
         });
         ledPanel.AddItem(ledItem);
         ledDText.PreviewDraw();
         gprsContentInfo.BitmapList = ledDText.BmpList;
         Process process = new Process();
         process.PanelBytes   = ledPanel.ToBytes();
         process.BmpDataBytes = ledPanel.ToItemBmpDataBytes();
         process.ItemBytes    = ledPanel.ToItemBytes();
         IList <byte>   list  = new List <byte>();
         IList <byte[]> list2 = protocol_GPRS.Send_Pack_GPRS(formMain.ledsys.SelectedPanel.CardAddress, 0, LedCmdType.Send_Begin, process, formMain.ledsys.SelectedPanel.ProtocolVersion);
         if (list2 != null && list2.Count > 0)
         {
             for (int i = 0; i < list2.Count; i++)
             {
                 for (int j = 0; j < list2[i].Length; j++)
                 {
                     list.Add(list2[i][j]);
                 }
             }
         }
         byte[] array = new byte[list.Count];
         list.CopyTo(array, 0);
         string     text       = Application.StartupPath + "\\" + gprsContentInfo.TerminalCode + "GPRS.zhd";
         FileStream fileStream = new FileStream(text, FileMode.Create, FileAccess.Write);
         fileStream.Write(array, 0, array.Length);
         fileStream.Close();
         GprsAdministrator.API_UPLoadFile2(gprsContentInfo.Id, text, 1052);
         this.gprsSenderForm.UpdateSendPanel(gprsContentInfo.Id);
         gprsContentInfo.Status = "已上传";
         this.removepanel(gprsContentInfo);
     }
     catch
     {
     }
 }
Ejemplo n.º 23
0
 private void button_AdminOK_Click(object sender, EventArgs e)
 {
     if (this.textBox_AdminPassword.Text == "")
     {
         this.textBox_AdminPassword.Focus();
         return;
     }
     if (this.isUser)
     {
         if (this.checkBox_RememberInfo.Checked)
         {
             Settings.Default.GprsRememberUser = true;
             Settings.Default.GPRSUsername     = this.textBox_AdminName.Text;
             Settings.Default.GPRSPassword     = this.textBox_AdminPassword.Text;
             Settings.Default.Save();
         }
         else
         {
             Settings.Default.GprsRememberUser = false;
             Settings.Default.GPRSUsername     = "";
             Settings.Default.GPRSPassword     = "";
             Settings.Default.Save();
         }
         if (GprsAdministrator.API_UserLogin(this.textBox_AdminName.Text.Trim(), this.textBox_AdminPassword.Text.Trim()))
         {
             GprsAdministrator.LoginSuccess = true;
             base.Dispose();
             return;
         }
         this.VisiblePnlMessage(true, "登录名或密码错误");
         this.LoginTimes++;
         GprsAdministrator.LoginSuccess = false;
         if (this.LoginTimes >= 3)
         {
             base.Dispose();
             return;
         }
     }
     else
     {
         if (this.IsForBind)
         {
             formGPRSAdminLogin.bindUserName = this.textBox_AdminName.Text;
             formGPRSAdminLogin.bindPassword = this.textBox_AdminPassword.Text;
             base.Dispose();
             return;
         }
         if (GprsAdministrator.API_AdminLogin(this.textBox_AdminName.Text.Trim(), this.textBox_AdminPassword.Text.Trim()))
         {
             GprsAdministrator.LoginSuccess = true;
             base.Dispose();
             return;
         }
         this.VisiblePnlMessage(true, "登录名或密码错误");
         this.LoginTimes++;
         GprsAdministrator.LoginSuccess = false;
         if (this.LoginTimes >= 3)
         {
             base.Dispose();
         }
     }
 }
Ejemplo n.º 24
0
 public static byte[] API_DownSingleCommand(string pDeviceID, LedCmdType pCMD)
 {
     byte[] result;
     try
     {
         string address = formMain.GprsServer + "terminal/downloadSingleCommandByUser.json?timer=" + GprsAdministrator.GetTimeStamp();
         string text    = "&user.id=" + GprsAdministrator.Entity_ID;
         text = text + "&user.userType=" + GprsAdministrator.Entity_UserType;
         text = text + "&user.username="******"&user.sign=" + GprsAdministrator.Entity_Sign;
         text = text + "&entity.id=" + pDeviceID;
         byte[] bytes = Encoding.UTF8.GetBytes(text);
         byte[] array = new WebClient
         {
             Headers =
             {
                 {
                     "Content-Type",
                     "application/x-www-form-urlencoded"
                 }
             }
         }.UploadData(address, "POST", bytes);
         if (array.Length == 44)
         {
             byte[] array2 = new byte[1];
             result = array2;
         }
         else
         {
             result = array;
         }
     }
     catch
     {
         byte[] array3 = new byte[1];
         result = array3;
     }
     return(result);
 }