private void StartPowerShellSession(Device targetDevice)
        {
            CheckRemoteAccess();

            if (SecurityTools.VerifyAdminCreds())
            {
                using (var p = new Process())
                {
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.CreateNoWindow  = false;
                    p.StartInfo.WindowStyle     = ProcessWindowStyle.Normal;
                    p.StartInfo.FileName        = "PowerShell.exe";

                    string domainUsername = SecurityTools.AdminCreds.Domain + @"\" + SecurityTools.AdminCreds.UserName;
                    string cmdArgs        = @"-NoExit -Command ""& { ";
                    cmdArgs += @"$User = '******'; ";
                    cmdArgs += @"$PWord = ConvertTo-SecureString -String '" + SecurityTools.AdminCreds.Password + "' -AsPlainText -Force; ";
                    cmdArgs += @"$Creds = New-Object -TypeName 'System.Management.Automation.PSCredential' -ArgumentList $User,$PWord; ";
                    cmdArgs += @"Enter-PSSession -ComputerName " + targetDevice.HostName + " –Credential $Creds; }";

                    p.StartInfo.Arguments = cmdArgs;

                    p.Start();
                }
            }
        }
Exemplo n.º 2
0
 private string FileHash(FileInfo file)
 {
     using (FileStream fileStream = file.OpenRead())
     {
         return(SecurityTools.GetMD5OfStream(fileStream));
     }
 }
Exemplo n.º 3
0
        private void OpenSibiLink(Device device)
        {
            try
            {
                SecurityTools.CheckForAccess(SecurityGroups.ViewSibi);

                if (string.IsNullOrEmpty(device.PO))
                {
                    OtherFunctions.Message("A valid PO Number is required.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Missing Info", this);
                    return;
                }
                else
                {
                    string sibiGuid = AssetManagerFunctions.GetSqlValue(SibiRequestCols.TableName, SibiRequestCols.PO, device.PO, SibiRequestCols.Guid);

                    if (string.IsNullOrEmpty(sibiGuid))
                    {
                        OtherFunctions.Message("No Sibi request found with matching PO number.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Not Found", this);
                    }
                    else
                    {
                        if (!Helpers.ChildFormControl.FormIsOpenByGuid(typeof(SibiManageRequestForm), sibiGuid))
                        {
                            new SibiManageRequestForm(this, sibiGuid);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
Exemplo n.º 4
0
        private async void SetADInfo()
        {
            try
            {
                if (!string.IsNullOrEmpty(currentViewDevice.HostName))
                {
                    if (ServerInfo.CurrentDataBase == DatabaseName.vintondd)
                    {
                        if (!SecurityTools.VerifyAdminCreds("Credentials for Vinton AD"))
                        {
                            ActiveDirectoryBox.Visible = false;
                            return;
                        }
                    }

                    var activeDir = new ActiveDirectoryWrapper(currentViewDevice.HostName);
                    if (await activeDir.LoadResultsAsync())
                    {
                        ADOUTextBox.Text           = activeDir.GetDeviceOU();
                        ADOSTextBox.Text           = activeDir.GetAttributeValue("operatingsystem");
                        ADOSVerTextBox.Text        = activeDir.GetAttributeValue("operatingsystemversion");
                        ADLastLoginTextBox.Text    = activeDir.GetAttributeValue("lastlogon");
                        ADCreatedTextBox.Text      = activeDir.GetAttributeValue("whencreated");
                        ActiveDirectoryBox.Visible = true;
                        return;
                    }
                }
                ActiveDirectoryBox.Visible = false;
            }
            catch
            {
                ActiveDirectoryBox.Visible = false;
            }
        }
Exemplo n.º 5
0
        private void DeleteSelectedHistoricalEntry()
        {
            SecurityTools.CheckForAccess(SecurityGroups.ModifyDevice);

            try
            {
                string entryGuid = DataGridHistory.CurrentRowStringValue(HistoricalDevicesCols.HistoryEntryGuid);
                using (DataTable results = DBFactory.GetDatabase().DataTableFromQueryString(Queries.SelectHistoricalDeviceEntry(entryGuid)))
                {
                    string dateStamp  = results.Rows[0][HistoricalDevicesCols.ActionDateTime].ToString();
                    string actionType = Attributes.DeviceAttributes.ChangeType[results.Rows[0][HistoricalDevicesCols.ChangeType].ToString()].DisplayValue;
                    var    blah       = OtherFunctions.Message("Are you sure you want to delete this entry?  This cannot be undone!" + "\r\n" + "\r\n" + "Entry info: " + dateStamp + " - " + actionType + " - " + entryGuid, MessageBoxButtons.YesNo, MessageBoxIcon.Question, "Are you sure?", this);
                    if (blah == DialogResult.Yes)
                    {
                        int affectedRows = DBFactory.GetDatabase().ExecuteNonQuery(Queries.DeleteHistoricalEntryByGuid(entryGuid));
                        if (affectedRows > 0)
                        {
                            StatusPrompt("Entry deleted!", Color.Green);
                            RefreshData();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
Exemplo n.º 6
0
        private void DeleteDevice()
        {
            SecurityTools.CheckForAccess(SecurityGroups.DeleteDevice);

            var blah = OtherFunctions.Message("Are you absolutely sure?  This cannot be undone and will delete all historical data, tracking and attachments.", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, "WARNING", this);

            if (blah == DialogResult.Yes)
            {
                if (AssetManagerFunctions.DeleteDevice(currentViewDevice.Guid))
                {
                    OtherFunctions.Message("Device deleted successfully.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Device Deleted", this);
                    currentViewDevice = null;
                    ParentForm.RefreshData();
                }
                else
                {
                    Logging.Logger("*****DELETION ERROR******: " + currentViewDevice.Guid);
                    OtherFunctions.Message("Failed to delete device succesfully!  Please let Bobby Lovell know about this.", MessageBoxButtons.OK, MessageBoxIcon.Error, "Delete Failed", this);
                    currentViewDevice = null;
                }
                this.Dispose();
            }
            else
            {
                return;
            }
        }
Exemplo n.º 7
0
        private void AddNewNote()
        {
            try
            {
                SecurityTools.CheckForAccess(SecurityGroups.ModifyDevice);

                using (var updateTypePrompt = new UpdateTypeForm(this, true))
                {
                    if (updateTypePrompt.ShowDialog(this) == DialogResult.OK)
                    {
                        if (!ConcurrencyCheck())
                        {
                            RefreshData();
                        }
                        else
                        {
                            UpdateDevice(updateTypePrompt.UpdateInfo);
                        }
                    }
                    else
                    {
                        RefreshData();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
        private async void NewSoftwareDeployment(Device targetDevice)
        {
            CheckRemoteAccess();

            if (OtherFunctions.Message("Start new software deployment?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, "Are you sure?", hostForm) != DialogResult.Yes)
            {
                return;
            }
            try
            {
                if (SecurityTools.VerifyAdminCreds("For remote runspace access."))
                {
                    var newDeviceDeploy = new SoftwareDeployment(hostForm, targetDevice);
                    OnStatusPrompt("Deploying Software...", 0);
                    if (await newDeviceDeploy.DeployToDevice(targetDevice))
                    {
                        OnStatusPrompt("Software Deployment Complete!", successColor);
                    }
                    else
                    {
                        OnStatusPrompt("Software Deployment Failed...", failColor);
                    }
                }
            }
            catch (Exception ex)
            {
                OnStatusPrompt("Software Deployment Failed...", failColor);
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
        private async void BrowseFiles()
        {
            try
            {
                CheckRemoteAccess();

                if (SecurityTools.VerifyAdminCreds())
                {
                    string fullPath = "\\\\" + this.device.HostName + "\\c$";
                    await Task.Run(() =>
                    {
                        using (var netCon = new NetworkConnection(fullPath, SecurityTools.AdminCreds))
                            using (var p = new Process())
                            {
                                p.StartInfo.UseShellExecute        = false;
                                p.StartInfo.RedirectStandardOutput = true;
                                p.StartInfo.RedirectStandardError  = true;
                                p.StartInfo.FileName  = "explorer.exe";
                                p.StartInfo.Arguments = fullPath;
                                p.Start();
                                p.WaitForExit();
                            }
                    });
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
        private void btnReportSettingSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtMailPwd.Password))
                {
                    App.reportSettingModel.MailPwd = txtMailPwd.Password;
                }
                OperateIniFile.WriteIniData("Base", "MEIK base", App.reportSettingModel.MeikBase, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Report", "Use Default Signature", App.reportSettingModel.UseDefaultSignature.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                User[]        doctorUsers = App.reportSettingModel.DoctorNames.ToArray <User>();
                List <string> doctorsArr  = new List <string>();
                foreach (var item in doctorUsers)
                {
                    doctorsArr.Add(item.Name + "|" + item.License);
                }
                OperateIniFile.WriteIniData("Report", "Doctor Names List", string.Join(";", doctorsArr.ToArray()), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");

                OperateIniFile.WriteIniData("Report", "Doctor Name Required", App.reportSettingModel.ShowDoctorSignature.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Report", "Use Default Logo", App.reportSettingModel.DefaultLogo.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");

                OperateIniFile.WriteIniData("Report", "Transfer Mode", App.reportSettingModel.TransferMode.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");

                OperateIniFile.WriteIniData("Report", "Print Paper", App.reportSettingModel.PrintPaper.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "My Mail Address", App.reportSettingModel.MailAddress, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "To Mail Address", App.reportSettingModel.ToMailAddress, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "To Mail Address List", string.Join(";", App.reportSettingModel.ToMailAddressList), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");

                OperateIniFile.WriteIniData("Mail", "Mail Subject", App.reportSettingModel.MailSubject, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "Mail Content", App.reportSettingModel.MailSubject, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "Mail Host", App.reportSettingModel.MailHost, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "Mail Port", App.reportSettingModel.MailPort.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "Mail Username", App.reportSettingModel.MailUsername, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                string mailPwd = App.reportSettingModel.MailPwd;
                if (!string.IsNullOrEmpty(mailPwd))
                {
                    mailPwd = SecurityTools.EncryptText(mailPwd);
                }
                OperateIniFile.WriteIniData("Mail", "Mail Password", mailPwd, System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
                OperateIniFile.WriteIniData("Mail", "Mail SSL", App.reportSettingModel.MailSsl.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");

                OperateIniFile.WriteIniData("Device", "Device No", App.reportSettingModel.DeviceNo.ToString(), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");


                Logo[]        deviceLogos = App.reportSettingModel.DeciceLogo.ToArray <Logo>();
                List <string> logoArr     = new List <string>();
                foreach (var item in deviceLogos)
                {
                    logoArr.Add(item.Device + "||" + item.Address);
                }
                OperateIniFile.WriteIniData("Report", "Logo List", string.Join("&&", logoArr.ToArray()), System.AppDomain.CurrentDomain.BaseDirectory + "Config.ini");

                MessageBox.Show(this, App.Current.FindResource("Message_14").ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, App.Current.FindResource("Message_13").ToString() + " " + ex.Message);
            }
        }
Exemplo n.º 11
0
        private void StartTrackDeviceForm()
        {
            SecurityTools.CheckForAccess(SecurityGroups.Tracking);

            Waiting();
            new TrackDeviceForm(currentViewDevice, this);
            DoneWaiting();
        }
Exemplo n.º 12
0
        private void ViewAttachments()
        {
            SecurityTools.CheckForAccess(SecurityGroups.ViewAttachment);

            if (!Helpers.ChildFormControl.AttachmentsIsOpen(this))
            {
                new AttachmentsForm(this, new DeviceAttachmentsCols(), currentViewDevice, UpdateAttachCountHandler);
            }
        }
Exemplo n.º 13
0
        private string GetSecureWebhookUrl(string orderNo)
        {
            var hash    = SecurityTools.CalculatePaymentHash(_jeebSetting.ApiKey, orderNo);
            var builder = new UriBuilder(_appSetting.ServerRootAddress)
            {
                Path = "Webhook", Query = $"hash={hash}"
            };

            return(builder.ToString());
        }
Exemplo n.º 14
0
    protected void btnChangePass_Click(object sender, EventArgs e)
    {
        //Eza eza = (Eza)Session["CurrentUser"];
        LibraryDataContext dcLib = new LibraryDataContext();
        SecurityTools      st    = new SecurityTools();
        Eza objEza = dcLib.Ezas.Where(m => m.ID == Convert.ToInt32(ddlEza.SelectedValue)).SingleOrDefault();

        objEza.Password = st.toMD5(txtNewPass.Text);
        dcLib.SubmitChanges();
    }
Exemplo n.º 15
0
 public static string SetCurrentDomain(DatabaseName database)
 {
     _currentDomain = DomainNames[database];
     SecurityTools.ClearAdminCreds();
     if (database == DatabaseName.vintondd)
     {
         SecurityTools.VerifyAdminCreds("Credentials for Vinton AD");
     }
     return(DomainNames[database]);
 }
Exemplo n.º 16
0
        private void CriticalStop(object sender, EventArgs e)
        {
            StopQueue();
            OtherFunctions.Message("The queue was stopped because of an access error. Please re-enter your credentials.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Queue Stopped", this);
            SecurityTools.ClearAdminCreds();

            if (SecurityTools.VerifyAdminCreds())
            {
                StartQueue();
            }
        }
Exemplo n.º 17
0
            public object Perform(object prm)
            {
                Ground.InitDataDir();

                string key  = SecurityTools.MakePassword_9();
                string file = Path.Combine(Consts.DATA_DIR, key);

                File.WriteAllBytes(file, Encoding.UTF8.GetBytes(JsonTools.Encode(prm)));

                return(key);
            }
Exemplo n.º 18
0
 private void CheckForAdmin()
 {
     if (SecurityTools.CanAccess(SecurityGroups.IsAdmin))
     {
         AdminDropDown.Visible = true;
     }
     else
     {
         AdminDropDown.Visible = false;
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Returns true if the <see cref="FileMD5"/> matches the computed MD5 of the current <see cref="DataStream"/>.
 /// </summary>
 /// <returns></returns>
 public bool VerifyData()
 {
     if (dataStream != null)
     {
         streamMD5 = SecurityTools.GetMD5OfStream(dataStream);
         if (streamMD5 == fileMD5)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 20
0
            public string hash  = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";                                                                                                 // 128 bit

            public static KeyData create()
            {
                byte[] bRaw  = SecurityTools.getCRand(64);
                byte[] bHash = BinaryTools.getSubBytes(SecurityTools.getSHA512(bRaw), 0, 16);

                return(new KeyData()
                {
                    ident = Consts.KEY_IDENT_PREFIX + StringTools.toHex(SecurityTools.getCRand(16)),
                    raw = StringTools.toHex(bRaw),
                    hash = StringTools.toHex(bHash),
                });
            }
Exemplo n.º 21
0
        private void StartTransaction()
        {
            SecurityTools.CheckForAccess(SecurityGroups.CanStartTransaction);

            if (OtherFunctions.Message("This will allow unchecked changes to the database. Incorrect inputs WILL BREAK THINGS! \r\n" + Environment.NewLine + "Changes must be 'applied' and 'committed' before they will be permanently stored in the database.", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, "WARNING", this) == DialogResult.OK)
            {
                currentTransaction = DBFactory.GetDatabase().StartTransaction();
                RefreshData();
                GridEditMode(true);
                DoneWaiting();
            }
        }
Exemplo n.º 22
0
        private int CalcAccessLevel()
        {
            int intAccessLevel = 0;

            foreach (CheckBox chkBox in clbModules.Items)
            {
                if (clbModules.GetItemCheckState(clbModules.Items.IndexOf(chkBox)) == CheckState.Checked)
                {
                    intAccessLevel += SecurityTools.GetSecGroupValue(chkBox.Name);
                }
            }
            return(intAccessLevel);
        }
Exemplo n.º 23
0
        private void QueueGKUpdate()
        {
            CheckRemoteAccess();

            if (SecurityTools.VerifyAdminCreds())
            {
                var gkInstance = Helpers.ChildFormControl.GKUpdaterInstance();
                gkInstance.AddUpdate(this.device);
                if (!gkInstance.Visible)
                {
                    gkInstance.Show();
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Creates a text file containing the hash string of the pack file.
        /// </summary>
        /// <returns></returns>
        private async Task <bool> CreateHashFile()
        {
            if (File.Exists(Paths.GKPackFileFDir + Paths.GKPackHashName))
            {
                File.Delete(Paths.GKPackFileFDir + Paths.GKPackHashName);
            }
            object Hash = await Task.Run(() => { return(SecurityTools.GetMD5OfFile(Paths.GKPackFileFullPath)); });

            using (StreamWriter sw = File.CreateText(Paths.GKPackFileFDir + Paths.GKPackHashName))
            {
                sw.Write(Hash);
            }
            return(true);
        }
Exemplo n.º 25
0
    protected void dvEza_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        if (e.Values["Name"] == null || e.Values["Password"] == null)
        {
            e.Cancel = true;
            return;
        }
        //Response.Write(e.Values["Password"].ToString());
        //Response.Write(e.Values["Name"].ToString());
        //Response.Write(e.Values["Email"].ToString());
        e.Values["RegisteredTime"] = DateTime.Now;
        SecurityTools st = new SecurityTools();

        e.Values["Password"] = st.toMD5(e.Values["Password"].ToString());
    }
Exemplo n.º 26
0
        private void AddNewDevice()
        {
            SecurityTools.CheckForAccess(SecurityGroups.AddDevice);

            var newDevForm = Helpers.ChildFormControl.FindChildOfType(this, typeof(NewDeviceForm));

            if (newDevForm == null)
            {
                new NewDeviceForm(this);
            }
            else
            {
                newDevForm.RestoreWindow();
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Verifies directory structure, checks if pack file is present, then compares local and remote hashes of the pack file.
        ///
        /// Returns False if directory or file is missing, or if the hashes mismatch.
        /// </summary>
        /// <returns></returns>
        public async Task <bool> VerifyPackFile()
        {
            try
            {
                if (!Directory.Exists(Paths.GKPackFileFDir))
                {
                    return(false);
                }
                if (!Directory.Exists(Paths.GKExtractDir))
                {
                    return(false);
                }
                if (!File.Exists(Paths.GKPackFileFullPath))
                {
                    return(false);
                }
                else
                {
                    string localHash = await Task.Run(() => { return(SecurityTools.GetMD5OfFile(Paths.GKPackFileFullPath)); });

                    string remoteHash = await Task.Run(() => { return(GetRemoteHash()); });

                    if (localHash == remoteHash)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (DirectoryNotFoundException dnfe)
            {
                Logging.Exception(dnfe);
                return(false);
            }
            catch (FileNotFoundException fnfe)
            {
                Logging.Exception(fnfe);
                return(false);
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                return(false);
            }
        }
Exemplo n.º 28
0
        private static string ResolveMacro(string code)
        {
            List <StringTools.ReplaceInfo> ptns = new List <StringTools.ReplaceInfo>();

            // 置き換え対象書式 = @(_xxx)

            int currLineNumber = 1;

            // make ptns
            {
                ptns.Add(new StringTools.ReplaceInfo()
                {
                    OldValue    = "@(_UNQ)",
                    GetValueNew = () => Unq(),
                    IgnoreCase  = false,
                });

                ptns.Add(new StringTools.ReplaceInfo()
                {
                    OldValue    = "@(_PW9)",
                    GetValueNew = () => SecurityTools.MakePassword_9(),
                    IgnoreCase  = false,
                });

                ptns.Add(new StringTools.ReplaceInfo()                 // for @(_LINE)
                {
                    OldValue    = "\n",
                    GetValueNew = () =>
                    {
                        currLineNumber++;
                        return("\n");
                    },
                    IgnoreCase = false,
                });

                ptns.Add(new StringTools.ReplaceInfo()
                {
                    OldValue    = "@(_LINE)",
                    GetValueNew = () => "" + currLineNumber,
                    IgnoreCase  = false,
                });
            }

            return(StringTools.MultiReplace(code, ptns.ToArray()));
        }
Exemplo n.º 29
0
 private void ChangeDatabase(DatabaseName database)
 {
     try
     {
         if (currentTransaction == null)
         {
             if (!GlobalSwitches.CachedMode & ServerInfo.ServerPinging)
             {
                 if (database != ServerInfo.CurrentDataBase)
                 {
                     var blah = OtherFunctions.Message("Are you sure? This will close all open forms.", MessageBoxButtons.YesNo, MessageBoxIcon.Question, "Change Database", this);
                     if (blah == DialogResult.Yes)
                     {
                         if (this.OkToCloseChildren())
                         {
                             this.CloseChildren();
                             ServerInfo.CurrentDataBase = database;
                             AttributeFunctions.PopulateAttributeIndexes();
                             RefreshCombos();
                             SecurityTools.PopulateUserAccess();
                             InitDBControls();
                             GlobalSwitches.BuildingCache = true;
                             Task.Run(() => DBCacheFunctions.RefreshLocalDBCache());
                             ShowTestDBWarning();
                             SetDatabaseTitleText();
                             ShowAll();
                         }
                     }
                 }
             }
             else
             {
                 OtherFunctions.Message("Cannot switch database while Offline or in Cached Mode.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Unavailable", this);
             }
         }
         else
         {
             OtherFunctions.Message("There is currently an active transaction. Please commit or rollback before switching databases.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Stop");
         }
     }
     finally
     {
         DatabaseToolCombo.SelectedIndex = (int)ServerInfo.CurrentDataBase;
     }
 }
Exemplo n.º 30
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        LibraryDataContext dcLib   = new LibraryDataContext();
        SecurityTools      st      = new SecurityTools();
        string             strPass = st.toMD5(txtPass.Text);
        Eza objEza = dcLib.Ezas.Where(m => m.Name == txtUserName.Text.Trim() && m.Password == strPass && m.Enable == true).SingleOrDefault();

        if (objEza != null)
        {
            Session["CurrentUser"] = objEza;
            Response.Redirect("main.aspx");
        }
        else

        {
            Response.Redirect("cpLogin.aspx");
        }
    }