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();
         }
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 3
0
        private string[] checkuser(string UserID)
        {
            string[]  Astr = { "", "", "" };
            string    sSQL = "SELECT passwd, type FROM access_level WHERE usrnm='" + UserID + "' AND active='A'";
            DataTable dt   = db.Query(sSQL);

            if (dt.Rows.Count > 0)
            {
                JiaMiJieMi aeskey = new JiaMiJieMi();
                string     pwd    = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["passwd"].ToString()));
                Astr[0] = "";
                Astr[1] = pwd;
                Astr[2] = dt.Rows[0]["type"].ToString();
            }
            return(Astr);
        }
Ejemplo n.º 4
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);
            }
        }