예제 #1
0
        public int sta_SetSMS(List <string> lblOutputInfo, string txtSMSID, string cbTag, string txtValidMin,
                              string txtContent)
        {
            if (GetConnectState() == false)
            {
                lblOutputInfo.Add("*Please connect first!");
                return(-1024);
            }

            if (txtSMSID.Trim() == "" || cbTag.Trim() == "" || txtValidMin.Trim() == "" || txtContent.Trim() == "")
            {
                lblOutputInfo.Add("*Please input data first!");
                return(-1023);
            }

            if (Convert.ToInt32(txtSMSID.Trim()) <= 0)
            {
                lblOutputInfo.Add("*SMS ID error!");
                return(-1023);
            }

            if (Convert.ToInt32(txtValidMin.Trim()) < 0 || Convert.ToInt32(txtValidMin.Trim()) > 65535)
            {
                lblOutputInfo.Add("*Expired time error!");
                return(-1023);
            }

            int    idwErrorCode = 0;
            int    iSMSID       = Convert.ToInt32(txtSMSID.Trim());
            int    iTag         = 0;
            int    iValidMins   = Convert.ToInt32(txtValidMin.Trim());
            string sStartTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm").Trim();
            string sContent     = txtContent.Trim();
            string sTag         = cbTag.Trim();

            for (iTag = 253; iTag <= 255; iTag++)
            {
                if (sTag.IndexOf(iTag.ToString()) > -1)
                {
                    break;
                }
            }

            axCZKEM1.EnableDevice(iMachineNumber, false);
            if (axCZKEM1.SetSMS(iMachineNumber, iSMSID, iTag, iValidMins, sStartTime, sContent))
            {
                axCZKEM1.RefreshData(iMachineNumber);//After you have set the short message,you should refresh the data of the device
                lblOutputInfo.Add("Successfully set SMS! SMSType=" + iTag.ToString());
            }
            else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                lblOutputInfo.Add("*Operation failed,ErrorCode=" + idwErrorCode.ToString());
            }
            axCZKEM1.EnableDevice(iMachineNumber, true);

            return(idwErrorCode != 0 ? idwErrorCode : 1);
        }
예제 #2
0
 private void button8_Click(object sender, EventArgs e)
 {
     axCZKEM1.SetSMS(1, 2, 254, 10, "2019-02-12 14:44:00", "Your Membership expires next month.");
     axCZKEM1.SSR_SetUserSMS(1, "6", 2);
 }