コード例 #1
0
 private void btnlogin_Click(object sender, EventArgs e)
 {
     if (txtuser.Text != "" && txtpass.Text != "")
     {
         var usercheck = db.Randoms.Where(c => c.ID == 1).FirstOrDefault();
         var passcheck = db.Randoms.Where(c => c.ID == 2).FirstOrDefault();
         if (usercheck != null)
         {
             if (txtuser.Text == ClsTripleDES.LicDecrypt(usercheck.Text) && txtpass.Text == ClsTripleDES.LicDecrypt(passcheck.Text))
             {
                 this.Hide();
                 FormDashboard dsh = new FormDashboard();
                 dsh.Show();
             }
             else
             {
                 MessageBox.Show("Invalid Credientials!", "License Management", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Enter your Credientials!", "License Management", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            openFileDialog        = new OpenFileDialog();
            openFileDialog.Filter = "license files (*.lic)|*.lic";
            DialogResult dialogResult = openFileDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                filepath         = openFileDialog.FileName;
                txtfilename.Text = Path.GetFileName(filepath);

                string[] lines = File.ReadAllLines(filepath);

                var arr = lines[7].Split(':');

                string dec = ClsTripleDES.DataDecrypt(arr[1].ToString());

                var licArr = dec.Split(',');

                txtofflicstarts.Text = licArr[0];

                txtofflicends.Text = licArr[1];

                txtoffsoftId.Text = licArr[2];

                txtoffownername.Text = licArr[3];

                txtoffschoolname.Text = licArr[4];

                done = true;
            }
        }
コード例 #3
0
        public void UpdrageOffline()
        {
            if (MasterConfirm.Show() == DialogResult.OK)
            {
                string[] lines = File.ReadAllLines(filepath);

                string licHash = DateTime.Now.ToString("dd/MM/yyyy") + "," + licends + "," + txtoffsoftId.Text.Substring(0, 18) + "," + txtoffownername.Text + "," + txtoffschoolname.Text + "," + "False";

                lines[7] = "License Hash:" + ClsTripleDES.DataEncrypt(licHash);

                File.WriteAllLines(filepath, lines);

                MessageBox.Show("Program Updated Successfully until " + licends + "!", "License Management System", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);


                txtofflicstarts.Text = "";

                txtofflicends.Text = "";

                txtoffsoftId.Text = "";

                txtoffownername.Text = "";

                txtoffschoolname.Text = "";

                txtfilename.Text = "";

                done = false;

                txtoffdays.Text = "";

                txtoffmonths.Text = "";

                txtoffdays.Text = "";

                if (openFileDialog.FileName != null)
                {
                    openFileDialog.Dispose();
                }
            }
        }
コード例 #4
0
        private void btnValidate_Click(object sender, EventArgs e)
        {
            var MasPas = db.Randoms.Where(c => c.ID == 3).FirstOrDefault();

            string fdec = ClsTripleDES.LicDecrypt(MasPas.Text.ToString());

            string Dec = ClsTripleDES.DataDecrypt(fdec);

            if (txtpass.Text == Dec)
            {
                btnValidate.DialogResult = DialogResult.OK;
                labelresult.Text         = "Validated!";
                labelresult.ForeColor    = Color.Green;
                labelresult.Visible      = true;
            }
            else
            {
                btnValidate.DialogResult = DialogResult.Cancel;
                labelresult.Text         = "Not Validated!";
                labelresult.ForeColor    = Color.Red;
                labelresult.Visible      = true;
            }
        }