Пример #1
0
 private void Initialize()
 {
     cf.sqlconn_client = SQLCON;
     cf.sqlconn_server = SQLCON;
     //Load UserRole
     comboBox1.DataSource    = cf.dtGetEmployeeRole(ConnType);
     comboBox1.DisplayMember = "Description";
     comboBox1.ValueMember   = "RoleName";
     //Load All Users
     dataGridView1.DataSource = cf.dtGetEmployee(ConnType);
     foreach (DataGridViewRow dgr in dataGridView1.Rows)
     {
         dgr.Cells["Username"].Value = cf.DecryptWords(dgr.Cells["Username"].Value.ToString()).ToString();
     }
     ObjectControls(false, true);
 }
Пример #2
0
        private bool CheckLists()
        {
            bool result = false;

            try
            {
                //Check SystemCode
                string systemCode = inif.Read("SystemCode", "Licensing");
                if (cf.DecryptWords(systemCode) != "RPOS")
                {
                    Error2Close = true;
                    MessageBox.Show("Error: Please check your configuration file.\nPath:" + IniPath, "System Code is Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    result = true;
                }
                //Check AccessCode
                string AccessCode = inif.Read("AccessCode", "Licensing");
                if (string.IsNullOrEmpty(cf.DecryptWords(AccessCode)))
                {
                    Error2Close = true;
                    MessageBox.Show("Error: Please check your configuration file.\nPath:" + IniPath, "Access Code is Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    result = true;
                }
                string DecryptAccessCode = cf.DecryptWords(AccessCode);
                if (!DecryptAccessCode.Contains("RPOS_"))
                {
                    Error2Close = true;
                    MessageBox.Show("Error: Please check your configuration file.\nPath:" + IniPath, "Access Code is Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    result = true;
                }

                string MachineCode = cf.GetMachineID();
                inif.Write("MachineCode", MachineCode, "Licensing");

                string   StartDate    = DecryptAccessCode.Split('_')[1].ToString();
                DateTime dtStartvalue = cf.parseDate(StartDate);
                int      daysCount    = cf.parseDate(StartDate).Subtract(DateTime.Now).Days;
                if (daysCount <= 30 && daysCount != 0)
                {
                    string AppCode = inif.Read("ApprovalCode", "Licensing");
                    MachineCode = inif.Read("MachineCode", "Licensing");
                    string SystemCode     = inif.Read("SystemCode", "Licensing");
                    string RegisteredMail = inif.Read("RegisteredMail", "Licensing");

                    if (string.IsNullOrEmpty(MachineCode))
                    {
                        MachineCode = cf.GetMachineID();
                        inif.Write("MachineCode", MachineCode, "Licensing");
                    }

                    LicenseExpireRenewal ler = new LicenseExpireRenewal();
                    ler.daystorenew     = daysCount.ToString();
                    ler.APPLICATIONCODE = AppCode;
                    ler.MachineID       = MachineCode;
                    ler.SystemID        = systemCode;
                    ler.RegisteredEmail = RegisteredMail;

                    ler.ShowDialog();
                    if (ler.AppliedCode)
                    {
                        inif.Write("ApprovalCode", ler.APPLICATIONCODE, "Licensing");
                        inif.Write("MachineCode", ler.MachineID, "Licensing");
                        inif.Write("SystemCode", ler.SystemID, "Licensing");
                        inif.Write("RegisteredMail", ler.RegisteredEmail, "Licensing");
                    }
                    if (ler.Restart)
                    {
                        Error2Close = true;
                        result      = true;
                        Application.Exit();
                    }
                }
                else if (daysCount == 0)
                {
                    MessageBox.Show("Error: Application license is expired. Please contact your provider", "License Exipired", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Error2Close = true;
                    result      = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message.ToString(), "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                result = true;
            }
            return(result);
        }