コード例 #1
0
ファイル: UserManage.aspx.cs プロジェクト: qqworker/FK
    protected void GetInfoBtn_Click(object sender, EventArgs e)
    {
        //    DisplayUserInfo();
        //     return;



        byte[] mByteParam = new byte[0];
        string mStrParam;

        try
        {
            Enables(false);
            JObject       vResultJson = new JObject();
            FKWebCmdTrans cmdTrans    = new FKWebCmdTrans();
            mUserId = UserList.SelectedItem.Value;

            vResultJson.Add("user_id", mUserId);
            mStrParam          = vResultJson.ToString(Formatting.None);
            UserPhoto.ImageUrl = null;
            cmdTrans.CreateBSCommBufferFromString(mStrParam, out mByteParam);
            mTransId             = FKWebTools.MakeCmd(msqlConn, "GET_USER_INFO", mDevId, mByteParam);
            mTransIdTxt.Text     = mTransId;
            Session["operation"] = GET_USER_INFO;

            Editable(false, "");
            UserPriv.SelectedItem.Value = "USER";
        }catch (Exception ex) {
            StatusTxt.Text = ex.ToString();
        }
    }
コード例 #2
0
    protected void ServerChangeBtn_Click(object sender, EventArgs e)
    {
        string mServerIpTxt = mServerIP.Text;
        string mPortTxt     = mServerPort.Text;
        int    mPort;

        if (mServerIpTxt.Length == 0)
        {
            StatusTxt.Text = ("Input the server ip address!");
            return;
        }
        try
        {
            IPAddress ipAddr = IPAddress.Parse(mServerIpTxt);
        }
        catch {
            StatusTxt.Text = ("Invaild Ip address! Please Input the server ip address!");
            mServerIP.Text = "";
            return;
        }
        if (mPortTxt.Length == 0)
        {
            StatusTxt.Text = ("Input the server Port address!");
            return;
        }

        try
        {
            mPort = Convert.ToInt32(mPortTxt);
        }
        catch
        {
            StatusTxt.Text   = ("Invaild port address! Please Input the server port address!");
            mServerPort.Text = "";
            return;
        }

        try
        {
            JObject       vResultJson = new JObject();
            FKWebCmdTrans cmdTrans    = new FKWebCmdTrans();
            vResultJson.Add("ip_address", mServerIpTxt);
            vResultJson.Add("port", mPortTxt);
            string sFinal   = vResultJson.ToString(Formatting.None);
            byte[] strParam = new byte[0];
            cmdTrans.CreateBSCommBufferFromString(sFinal, out strParam);
            mTransIdTxt.Text = FKWebTools.MakeCmd(msqlConn, "SET_WEB_SERVER_INFO", mDevId, strParam);
            StatusTxt.Text   = "Success : Device's server info has been changed!,so that device is no longer in this server!";
            Enables(false);
        }
        catch
        {
            StatusTxt.Text = "Error : Device's server info has not been changed!";
        }
    }
コード例 #3
0
ファイル: LogManager.aspx.cs プロジェクト: qqworker/FK
    protected void GetLogBtn_Click(object sender, EventArgs e)
    {
        string        sBeginDate = BeginDate.Text;
        string        sEndDate = EndDate.Text;
        JObject       vResultJson = new JObject();
        FKWebCmdTrans cmdTrans = new FKWebCmdTrans();
        DateTime      dtBegin, dtEnd;

        if (sBeginDate.Length > 0)
        {
            try
            {
                dtBegin    = Convert.ToDateTime(sBeginDate);
                sBeginDate = FKWebTools.GetFKTimeString14(dtBegin);
                vResultJson.Add("begin_time", sBeginDate);
            }
            catch
            {
                BeginDate.Text = "";
            }
        }

        if (sEndDate.Length > 0)
        {
            try
            {
                dtEnd    = Convert.ToDateTime(sEndDate);
                sEndDate = FKWebTools.GetFKTimeString14(dtEnd);
                vResultJson.Add("end_time", sEndDate);
            }
            catch
            {
                EndDate.Text = "";
            }
        }

        try
        {
            string sFinal   = vResultJson.ToString(Formatting.None);
            byte[] strParam = new byte[0];
            cmdTrans.CreateBSCommBufferFromString(sFinal, out strParam);
            mTransIdTxt.Text = FKWebTools.MakeCmd(msqlConn, "GET_LOG_DATA", mDevId, strParam);

            GetLogBtn.Enabled = false;
            ClearBtn.Enabled  = false;
            Timer.Enabled     = true;
        }
        catch (Exception ex)
        {
            StatusTxt.Text = "Fail! Get Log Data! " + ex.ToString();
        }
    }
コード例 #4
0
 protected void SetTimeBtn_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime      now         = DateTime.Now;
         string        sNowTxt     = FKWebTools.GetFKTimeString14(now);
         JObject       vResultJson = new JObject();
         FKWebCmdTrans cmdTrans    = new FKWebCmdTrans();
         vResultJson.Add("time", sNowTxt);
         string sFinal   = vResultJson.ToString(Formatting.None);
         byte[] strParam = new byte[0];
         cmdTrans.CreateBSCommBufferFromString(sFinal, out strParam);
         mTransIdTxt.Text = FKWebTools.MakeCmd(msqlConn, "SET_TIME", mDevId, strParam);
         Enables(false);
     }catch {
         StatusTxt.Text = "Error: Set time fail!";
     }
 }
コード例 #5
0
ファイル: UserManage.aspx.cs プロジェクト: qqworker/FK
 protected void  DeleteUserBtn_Click(object sender, EventArgs e)
 {
     try
     {
         Session["operation"] = DEL_USER_INFO;
         string        sUserId     = UserList.SelectedItem.Value;
         FKWebCmdTrans cmdTrans    = new FKWebCmdTrans();
         JObject       vResultJson = new JObject();
         vResultJson.Add("user_id", sUserId);
         string sFinal   = vResultJson.ToString(Formatting.None);
         byte[] strParam = new byte[0];
         cmdTrans.CreateBSCommBufferFromString(sFinal, out strParam);
         mTransIdTxt.Text = FKWebTools.MakeCmd(msqlConn, "DELETE_USER", mDevId, strParam);
         Enables(false);
     }
     catch (Exception ex)
     {
         StatusTxt.Text = ex.ToString();
     }
 }
コード例 #6
0
    protected void DevNameChangeBtn_Click(object sender, EventArgs e)
    {
        string mDevNameTxt = mDeviceName.Text;

        if (mDevNameTxt.Length == 0)
        {
            StatusTxt.Text = ("Input the device name!");
            return;
        }
        try{
            JObject       vResultJson = new JObject();
            FKWebCmdTrans cmdTrans    = new FKWebCmdTrans();
            vResultJson.Add("fk_name", mDevNameTxt);
            string sFinal   = vResultJson.ToString(Formatting.None);
            byte[] strParam = new byte[0];
            cmdTrans.CreateBSCommBufferFromString(sFinal, out strParam);
            mTransIdTxt.Text = FKWebTools.MakeCmd(msqlConn, "SET_FK_NAME", mDevId, strParam);
            StatusTxt.Text   = "Success : Device name has been changed!";
            Enables(false);
        }
        catch {
            StatusTxt.Text = "Error : Device name has not been changed!";
        }
    }
コード例 #7
0
ファイル: UserManage.aspx.cs プロジェクト: qqworker/FK
    protected void  SetInfoBtn_Click(object sender, EventArgs e)
    {
        try
        {
            Session["operation"] = SET_USER_INFO;
            JObject       vResultJson          = new JObject();
            JArray        vEnrollDataArrayJson = new JArray();
            FKWebCmdTrans cmdTrans             = new FKWebCmdTrans();
            string        sUserPwd             = Password.Text;
            string        sUserCard            = CardNum.Text;
            int           index     = 1;
            string        sUserId   = UserID.Text;
            string        sUserName = UserName.Text;
            string        sUserPriv = UserPriv.SelectedItem.Text;

            UserPhoto.ImageUrl = ".\\photo\\" + mDevId + "_" + sUserId + ".jpg";

            vResultJson.Add("user_id", sUserId);
            vResultJson.Add("user_name", sUserName);
            vResultJson.Add("user_privilege", sUserPriv);
            if (FKWebTools.mPhoto.Length > 0)
            {
                vResultJson.Add("user_photo", FKWebTools.GetBinIndexString(index++));
            }

            for (int nIndex = 0; nIndex <= FKWebTools.BACKUP_FP_9; nIndex++)
            {
                if (FKWebTools.mFinger[nIndex].Length > 0)
                {
                    JObject vEnrollDataJson = new JObject();
                    vEnrollDataJson.Add("backup_number", nIndex);
                    vEnrollDataJson.Add("enroll_data", FKWebTools.GetBinIndexString(index++));
                    vEnrollDataArrayJson.Add(vEnrollDataJson);
                }
            }
            if (sUserPwd.Length > 0)
            {
                JObject vEnrollDataJson = new JObject();
                vEnrollDataJson.Add("backup_number", FKWebTools.BACKUP_PSW);
                vEnrollDataJson.Add("enroll_data", FKWebTools.GetBinIndexString(index++));
                vEnrollDataArrayJson.Add(vEnrollDataJson);
            }

            if (sUserCard.Length > 0)
            {
                JObject vEnrollDataJson = new JObject();
                vEnrollDataJson.Add("backup_number", FKWebTools.BACKUP_CARD);
                vEnrollDataJson.Add("enroll_data", FKWebTools.GetBinIndexString(index++));
                vEnrollDataArrayJson.Add(vEnrollDataJson);
            }
            if (FKWebTools.mFace.Length > 0)
            {
                JObject vEnrollDataJson = new JObject();
                vEnrollDataJson.Add("backup_number", FKWebTools.BACKUP_FACE);
                vEnrollDataJson.Add("enroll_data", FKWebTools.GetBinIndexString(index++));
                vEnrollDataArrayJson.Add(vEnrollDataJson);
            }
            vResultJson.Add("enroll_data_array", vEnrollDataArrayJson);
            string sFinal = vResultJson.ToString(Formatting.None);

            byte[] binData  = new byte[0];
            byte[] strParam = new byte[0];

            if (FKWebTools.mPhoto.Length > 0)
            {
                FKWebTools.AppendBinaryData(ref binData, FKWebTools.mPhoto);
            }

            for (int nIndex = 0; nIndex <= FKWebTools.BACKUP_FP_9; nIndex++)
            {
                if (FKWebTools.mFinger[nIndex].Length > 0)
                {
                    FKWebTools.AppendBinaryData(ref binData, FKWebTools.mFinger[nIndex]);
                }
            }
            if (sUserPwd.Length > 0)
            {
                byte[] mPwdBin = new byte[0];
                cmdTrans.CreateBSCommBufferFromString(sUserPwd, out mPwdBin);
                FKWebTools.ConcateByteArray(ref binData, mPwdBin);
            }
            if (sUserCard.Length > 0)
            {
                byte[] mCardBin = new byte[0];
                cmdTrans.CreateBSCommBufferFromString(sUserCard, out mCardBin);
                FKWebTools.ConcateByteArray(ref binData, mCardBin);
            }
            if (FKWebTools.mFace.Length > 0)
            {
                FKWebTools.AppendBinaryData(ref binData, FKWebTools.mFace);
            }

            cmdTrans.CreateBSCommBufferFromString(sFinal, out strParam);

            FKWebTools.ConcateByteArray(ref strParam, binData);

            mTransIdTxt.Text = FKWebTools.MakeCmd(msqlConn, "SET_USER_INFO", mDevId, strParam);
            Enables(false);
        }
        catch (Exception ex)
        {
            StatusTxt.Text = ex.ToString();
        }
    }