private InstanceInfo CreateFromRow(ServerInstanceRow instanceRow)
        {
            long     loginId  = instanceRow.LoginId;
            LoginRow loginRow = this._loginManager.GetLogin(loginId);

            AuthenticationInfo authInfo = new AuthenticationInfo
            {
                Username  = loginRow.Login,
                Password  = loginRow.Password,
                IsWindows = loginRow.IsWinAuth
            };

            string conName = instanceRow.ConnectionName;

            InstanceInfo instanceInfo = new InstanceInfo(instanceRow.IsDynamicConnection)
            {
                Authentication = authInfo,
                IsODBC         = instanceRow.IsOdbc,
                DbType         = instanceRow.DbType,
                IsEnabled      = true,
                Name           = conName,
                Instance       = conName
            };

            instanceInfo.SetServerProperties(
                new ServerProperties(
                    new InstanceVersion(instanceRow.ServerInstanceVersion),
                    instanceRow.ServerInstanceName,
                    DateTime.Now
                    )
                );

            return(instanceInfo);
        }
Exemplo n.º 2
0
        private static string DisplayLogin(LoginRow row)
        {
            if (row.IsWinAuth)
            {
                return("[WinAuth]");
            }

            string login = string.IsNullOrEmpty(row.Login)
                                ? "[No login]"
                                : row.Login;

            if (row.Password.Length > 0)
            {
                return(string.Format(
                           "{0} (pwd: {1}{2})",
                           login,
                           row.Password[0],
                           new string('*', row.Password.Length - 1)
                           ));
            }

            return(login);
        }
 public LoginRowChangeEvent(LoginRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
 public void RemoveLoginRow(LoginRow row) {
     this.Rows.Remove(row);
 }
 public void AddLoginRow(LoginRow row) {
     this.Rows.Add(row);
 }
 public LoginRowChangeEvent(LoginRow row, global::System.Data.DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }
Exemplo n.º 7
0
 private void buttonNextProgress_Click(object sender, EventArgs e) //next button action
 {
     if (listboxindex < 6)                                         //if not to finalize
     {
         if (MessageBox.Show("Are you sure that you need to advance the progress?",
                             "Please confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (listboxindex == 1)                      //to enter estimate
             {
                 string value = "";
                 if (InputBox("Estimate Summary", "Please enter the summary of estimate:", ref value) == DialogResult.OK)
                 {
                     appToProgress.estimateSummary = value;
                     if (value == "")
                     {
                         MessageBox.Show("Please enter the summary of estimate. Otherwise considered as not progressed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                     else
                     {
                         string summary = value;
                         dbprog.updateMany(new string[] { "estimateSummary", "progress" }, listViewInProgress.SelectedItems[0].Text, new string[] { summary, "Estimated" });
                         listboxindex++;
                         draw();
                     }
                 }
             }
             else
             {
                 listboxindex++;
                 draw();
             }
         }
     }
     //create an account and add to 'account' database, create bill database for each user
     else if (listboxindex == 6)
     {
         if (MessageBox.Show("Are you sure that you need to advance the progress? This will create an account",
                             "Please confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             int accountno;
             if (dbmap.hasEntry("account"))
             {
                 accountno = int.Parse(dbmap.get("no", "account"));
                 dbmap.update("no", "account", (accountno + 1).ToString());
             }
             else
             {
                 accountno = 1000000;
                 dbmap.insert(new MapnoRow("account", 1000001));
             }
             String[] row = dbprog.getRow(listViewInProgress.SelectedItems[0].Text);
             dbprog.delete(listViewInProgress.SelectedItems[0].Text);
             AccountRow accrow = new AccountRow(accountno, row[0], textBoxInProgressName.Text, row[2], row[3], row[4],
                                                row[5], row[6], row[7], textBoxInProgressAddress.Text, row[9], int.Parse(textBoxInProgressContact.Text), row[11], row[16], row[17],
                                                int.Parse(listViewInProgress.SelectedItems[0].Text));
             dbacc.insert(accrow);
             dbbill.createBillingTable(accountno);
             string   password = createRandomPassword(10);
             LoginRow logrow   = new LoginRow(accountno.ToString(), password, 1);
             dblogin.insert(logrow);
             MailRow mrow = new MailRow(accountno, textBoxInProgressName.Text, textBoxInProgressAddress.Text,
                                        "Your username for the user account: " + accountno + ", password: "******"Assigned Account No (Username) is: " + accountno + "\nLogin Password is: " + password, "Account Number and Login Password", MessageBoxButtons.OK);
             clrprog();
         }
         else
         {
             dbprog.update("progress", listViewInProgress.SelectedItems[0].Text, "Connection Established");
         }
     }
 }