protected void Page_Load(object sender, EventArgs e)
 {
     if (!X.IsAjaxRequest)
     {
         GetBrandName();
         GridPanelBind();
         string    License = ConfigurationManager.AppSettings["1PageCount"].ToString();
         Rockey4ND rockey  = new Rockey4ND();
         if (License.Length < 32) // keypro
         {
             string hid = rockey.open();
         }
         string    sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'";
         DataTable dt   = db.Query(sSQL);
         if (dt.Rows.Count > 0)
         {
             JiaMiJieMi aeskey = new JiaMiJieMi();
             Authorize.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["genst_desc"].ToString().Substring(32, 32)));
         }
         if (License.Length < 32) // keypro
         {
             rockey.close();
         }
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!X.IsAjaxRequest)
     {
         if (Session["USER_ID"] == null)
         {
             X.Redirect("login.aspx");
         }
         else
         {
             Rockey4ND rockey = new Rockey4ND();
             string    hid    = rockey.open();
             string    keystr = rockey.ReadKey();
             string    sSQL   = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'";
             DataTable dt     = db.Query(sSQL);
             if (dt.Rows.Count > 0)
             {
                 Keyid.Text    = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["genst_desc"].ToString().Substring(0, 32)));
                 Bedno.Text    = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["genst_desc"].ToString().Substring(32, 32)));
                 window1.Title = hid;
             }
             try
             {
                 New_Keyid.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(0, 32)));
                 New_Bedno.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(32, 32)));
             }
             catch (Exception ex)
             {
                 Common._ErrorMsgShow(ex.Message.ToString());
             }
             rockey.close();
         }
     }
 }
Beispiel #3
0
        protected void BtnNewKey_Click(object sender, DirectEventArgs e)
        {
            Rockey4ND rockey = new Rockey4ND();
            string    hid    = rockey.open();

            string hidencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(New_Keyid.Text));
            string bedencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(New_Bedno.Text));

            rockey.WriteKey(hidencode + bedencode);
            rockey.close();
            Common._NotificationShow("Write Successed for New Key...");
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!X.IsAjaxRequest)
     {
         Rockey4ND rockey = new Rockey4ND();
         hid = rockey.open();
         if (hid != "")
         {
             Window1.Title = "登入窗口: " + hid;
             Window1.Show();
             txtUsername.Focus(true, 100);
         }
     }
 }
Beispiel #5
0
        protected void BtnOK_Click(object sender, DirectEventArgs e)
        {
            Rockey4ND rockey = new Rockey4ND();
            string    hid    = rockey.open();

            string hidencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(Keyid.Text));
            string bedencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(Bedno.Text));

            rockey.WriteKey(hidencode + bedencode);
            rockey.close();
            string sSQL = "UPDATE general_setup SET genst_desc='" + hidencode + bedencode + "' ";

            sSQL += "WHERE genst_ctg='License' AND genst_code='Plate'";
            db.Excute(sSQL);
            Common._NotificationShow("Update Successed...");
        }
Beispiel #6
0
        protected void BtnRead_Click(object sender, DirectEventArgs e)
        {
            Rockey4ND rockey = new Rockey4ND();
            string    hid    = rockey.open();
            string    keystr = rockey.ReadKey();

            try
            {
                New_Keyid.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(0, 32)));
                New_Bedno.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(32, 32)));
            }
            catch (Exception ex)
            {
                Common._ErrorMsgShow(ex.Message.ToString());
            }
            rockey.close();
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                JiaMiJieMi aeskey = new JiaMiJieMi();
                string     plocal = "";
                if (License.Length < 32) // keypro
                {
                    Rockey4ND rockey = new Rockey4ND();
                    hid = rockey.open();
                    if (hid != "")
                    {
                        string    sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'";
                        DataTable dt   = db.Query(sSQL);
                        if (dt.Rows.Count > 0)
                        {
                            plocal = dt.Rows[0]["genst_desc"].ToString();
                        }
                        if (rockey.verify(hid, plocal))
                        {
                            string totalbed = aeskey.AES_Decrypt(aeskey.Base64Decrypt(plocal.Substring(32, 32)));
                            Window1.Title = "登入窗口: " + hid + "-" + totalbed;
                            Window1.Show();
                        }
                        else
                        {
                            Common._ErrorMsgShow("USB授权钥匙,认证编号不符合!");
                        }
                    }
                    else
                    {
                        Window1.Hide();
                    }
                    rockey.close();
                }
                else // softkey
                {
                    try
                    {
                        //RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Datacom\Product\DCS42");
                        //string[] n = regkey.GetValueNames();
                        //string hid = regkey.GetValue(n[0]).ToString();
                        string hid = License;
                        if (hid.Length == 32)
                        {
                            hid = aeskey.AES_Decrypt(aeskey.Base64Decrypt(hid));
                            if (hid != "")
                            {
                                string    sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'";
                                DataTable dt   = db.Query(sSQL);
                                if (dt.Rows.Count > 0)
                                {
                                    plocal = dt.Rows[0]["genst_desc"].ToString();
                                }
                                string sid = aeskey.AES_Decrypt(aeskey.Base64Decrypt(plocal.Substring(0, 32)));
                                if (hid == sid)
                                {
                                    string totalbed = aeskey.AES_Decrypt(aeskey.Base64Decrypt(plocal.Substring(32, 32)));
                                    Window1.Title = "登入窗口: " + hid + "-" + totalbed;
                                    Window1.Show();
                                }
                                else
                                {
                                    Common._ErrorMsgShow("授权钥匙,认证编号不符合!");
                                }
                            }
                            else
                            {
                                Window1.Hide();
                            }
                        }
                        else
                        {
                            Common._ErrorMsgShow("授权钥匙,认证编号不符合!");
                            Window1.Hide();
                        }
                    }
                    catch (Exception ex)
                    {
                        Common._ErrorMsgShow(ex.Message.ToString());
                    }
                }

                if (!string.IsNullOrEmpty(Request.QueryString["url"]))
                {
                    txtUrl.Text = Request.QueryString["url"];
                }
                txtUsername.Focus(true, 100);
            }
        }