public void Initialize(DatabaseOperation databaseOperation, bool unattended, string connectionStringFromCmdLine)
    {
        InitializeDictionary();
        SetApplicationName();

        _unattended        = unattended;
        _databaseOperation = databaseOperation;

        authenticationComboBox.SelectedIndex = 0;

        SetDefaultValues(connectionStringFromCmdLine);
        SearchHistoryHandler.LoadItems(serverNameComboBox, "RecentListServerName");

        if (ConfigHandler.SaveConnectionString == "True")
        {
            saveValuesCheckBox.Checked = true;
        }
        else
        {
            saveValuesCheckBox.Checked = false;
        }

        if (GenericHelper.IsUserInteractive())
        {
            InitializeWorker();
        }
    }
예제 #2
0
        public List <ActiveQBuyItem> GetActiveQBuy()
        {
            List <ActiveQBuyItem> list    = new List <ActiveQBuyItem>();
            StringBuilder         builder = new StringBuilder();

            builder.AppendFormat(TaskJobSqls.SELECT_ACTIVE_QBUY_LIST);
            string    sql = builder.ToString();
            DataTable dt  = DatabaseOperation.ExecuteSelectDS(sql, "T").Tables[0];

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ActiveQBuyItem item = new ActiveQBuyItem
                    {
                        activeId     = dr["ACTIVE_ID"].ToString(),
                        activeQBuyId = dr["ACTIVE_QBUY_ID"].ToString(),
                        beforeStart  = Convert.ToDouble(dr["BEFORE_START"]),
                        lastDays     = Convert.ToInt32(dr["LAST_DAYS"]),
                        checkNum     = Convert.ToInt32(dr["CHECK_NUM"]),
                        consumeNum   = Convert.ToInt32(dr["CONSUME_NUM"]),
                        minConsume   = Convert.ToInt32(dr["MIN_CONSUME"]),
                        storeId      = dr["ACTIVE_STORE"].ToString(),
                        dateFrom     = Convert.ToDateTime(dr["ACTIVE_TIME_FROM"]),
                        dateTo       = Convert.ToDateTime(dr["ACTIVE_TIME_TO"]),
                    };

                    list.Add(item);
                }
            }


            return(list);
        }
    private void DoWork(RunWorkerArgument arg)
    {
        string connectionString = arg.ConnectionString;

        if (_databaseOperation == null)         // new connection, no connection has been made
        {
            _databaseOperation = new DatabaseOperation();
            _databaseOperation.InitializeDal(connectionString);
        }
        else         // a connection has already been made, but should be changed
        {
            ConnectionChanged = _databaseOperation.ChangeConnection(connectionString);
        }

        if (_databaseOperation.Connected)
        {
            ConnectionChanged = true;
        }
        else
        {
            ConnectionChanged = false;
        }

        if (ConnectionChanged)
        {
            ConfigHandler.ConnectionString = connectionString;
        }

        if (saveValuesCheckBox.Checked && ConnectionChanged)
        {
            ConfigHandler.ConnectionStringToSave = connectionString;
            ConfigHandler.SaveConnection();
        }
    }
        public ActionResult <Application> PostApplication([FromForm] ApplicationFile appFile, [FromForm] Application app)
        {
            //appending date with filename to make dbo.Application.File_Name unique

            string            tempFileName = DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss") + "/" + app.FileName;
            DatabaseOperation db           = new DatabaseOperation();

            db.AddApplication(app.ProjectName, app.CategoryName, tempFileName);

            Application       application = new Application();
            DatabaseOperation db1         = new DatabaseOperation();

            application = db1.GetSingleApplication(app.ProjectName, app.CategoryName, tempFileName);


            DatabaseOperation db2     = new DatabaseOperation();
            Project           project = db2.GetSingleProject(app.ProjectName)[0];


            FileHierarchyCreation file = new FileHierarchyCreation();
            bool uploadCheck           = file.CreateApplicationFolder(application.AppId, app.CategoryName, app.ProjectName, tempFileName, project.BundleIdentifier, appFile);

            if (uploadCheck)
            {
                return(StatusCode(200, new { title = "Applicaton uploaded successfully.", status = 200 }));
            }
            else
            {
                return(StatusCode(500, new { title = "Applicaton upload error.", status = 500, message = "This app version already exists" }));
            }
        }
예제 #5
0
        public bool InsertQBuy(
            string activeId,
            string activeQBuyId,
            string storeId,
            string memberId,
            double beforeStart,
            int lastDays
            )
        {
            string        qbuyCode = activeQBuyId + memberId + DateTime.Now.ToString("yyyyMMddHHmmss");
            ArrayList     list     = new ArrayList();
            StringBuilder builder  = new StringBuilder();

            builder.AppendFormat(
                TaskJobSqls.INSERT_QBUY_LIST,
                activeId,
                activeQBuyId,
                storeId,
                memberId,
                beforeStart,
                lastDays,
                qbuyCode);
            string sql = builder.ToString();

            list.Add(sql);
            builder.Clear();
            builder.AppendFormat(TaskJobSqls.INSERT_QBUY_GOODS, activeQBuyId, qbuyCode);
            sql = builder.ToString();
            list.Add(sql);
            return(DatabaseOperation.ExecuteDML(list));
        }
    private void InitializeDatabaseFieldNameComboBox(SqlConnectionStringBuilder connectionString)
    {
        databaseFieldNameComboBox.DrawMode  = DrawMode.OwnerDrawFixed;
        databaseFieldNameComboBox.DrawItem += DatabaseFieldNameComboBox_DrawItem;

        DatabaseOperation databaseOperation = new DatabaseOperation(connectionString.ToString());

        DataTable databasesDataTable = databaseOperation.GetDatabases();

        foreach (DataRow databaseDataRow in databasesDataTable.Rows)
        {
            connectionString.InitialCatalog = databaseDataRow["name"].ToString();
            databaseOperation.ChangeConnection(connectionString.ToString());

            DataTable descriptionsDataTable = databaseOperation.GetDescriptionFields();

            if (descriptionsDataTable.Rows.Count > 0)
            {
                databaseFieldNameComboBox.Items.Add(new ComboBoxItem(databaseDataRow["name"].ToString(), true, -1));

                foreach (DataRow descriptionDataRow in descriptionsDataTable.Rows)
                {
                    databaseFieldNameComboBox.Items.Add(new ComboBoxItem(descriptionDataRow["name"].ToString(), false, Convert.ToInt32(descriptionDataRow["count"].ToString())));
                }
            }
        }

        databaseOperation.Dispose();
    }
예제 #7
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (txt_username.Text == "" || txt_name.Text == "" || txt_password.Text == null)
            {
                MessageBox.Show("fields cannot be null");
            }
            else
            {
                DataTable dt = null;
                string    validateUsernameQuery = (new User().validateUsername(txt_username.Text));
                dt = DatabaseOperation.get(new DataTable(), validateUsernameQuery);
                if (dt != null)
                {
                    MessageBox.Show("Duplicated username ! ");
                    txt_username.Text = null;
                }
                else if (txt_password.TextLength < 8)
                {
                    MessageBox.Show("please enter a valid password");
                    txt_password.Text = null;
                }

                else
                {
                    dgv_users.DataSource = _invoker.Invoke(new InsertUserThenGetUsers(_user, txt_username.Text,
                                                                                      txt_name.Text,
                                                                                      txt_password.Text,
                                                                                      ((Roles)cmb_roles.SelectedItem).key));
                }
            }
        }
        private void onLoginClick(object sender, MouseButtonEventArgs e)
        {
            DatabaseOperation.Connect();
            SqlDataReader reader = DatabaseOperation.SelectQuery("SELECT * FROM ZoneAdmin WHERE Username = '******'");

            if (reader.Read())
            {
                string password        = reader.GetString(1);
                string enteredPassword = CalculateMD5Hash(Password.Password);
                if (password == enteredPassword)
                {
                    MW.MainFrame.NavigationService.Navigate(new Uri(@"Pages\ZonePage.xaml", UriKind.RelativeOrAbsolute));
                }
                else
                {
                    MessageBox.Show("Wrong Password");
                }
                reader.Close();
            }
            else
            {
                MessageBox.Show("Wrong username");
            }
            DatabaseOperation.Disconnect();
        }
    public void Initialize(DatabaseOperation databaseOperation, string sql)
    {
        ConfigHandler.GetDataFormShown = true;

        InitializeDictionary();

        timeTextBox.GotFocus += TimeTextBox_GotFocus;

        Opacity = 0;

        elapsedTimeTimer.Start();
        _sw.Reset();
        _sw.Start();

        _timer          = new Timer();
        _timer.Interval = 500;
        _timer.Tick    += Timer_Tick;
        _timer.Start();

        _databaseOperation = databaseOperation;

        ConfigHandler.GetDataStartTime = DateTime.Now;

        if (GenericHelper.IsUserInteractive())
        {
            InitializeWorker();
            _worker.RunWorkerAsync(sql);
        }
        else
        {
            RunWorkerCompleted(DoWork(sql));
        }
    }
예제 #10
0
    public static bool DeleteTraceFile(bool showError, DatabaseOperation databaseOperation)
    {
        databaseOperation.DropEventSession();

        if (Directory.Exists(ConfigHandler.TraceFileDirectory))
        {
            foreach (string file in Directory.GetFiles(ConfigHandler.TraceFileDirectory, string.Format("{0}*.*", TaskHelper.TraceFileName)))
            {
                try
                {
                    File.Delete(file);
                }
                catch (Exception ex)
                {
                    if (showError)
                    {
                        MessageBox.Show(string.Format("Error deleting Trace File.\r\n\r\n{0}", ex.Message), GenericHelper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    return(false);
                }
            }
        }
        else
        {
            if (showError)
            {
                MessageBox.Show(string.Format("The Trace File Directory \"{0}\" does not exist.\r\n\r\nPlease create the directory manually.", ConfigHandler.TraceFileDirectory), GenericHelper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(false);
        }

        return(true);
    }
예제 #11
0
 public StoredProcedureCommand(string commandText,
                               T instance,
                               DatabaseOperation operation,
                               Func <T, object?>?commandParametersDelegate)
     : base(commandText, DatabaseCommandType.StoredProcedure, instance, operation, commandParametersDelegate)
 {
 }
예제 #12
0
    public void Initialize(DatabaseOperation databaseOperation, bool recordingMode)
    {
        InitializeDictionary();

        _databaseOperation = databaseOperation;
        _recordingMode     = recordingMode;
    }
예제 #13
0
    private void InitializeDatabaseOperation(bool unattended)
    {
        ConnectionDialogForm form = new ConnectionDialogForm();

        form.Initialize(_databaseOperation, unattended, _unattendedConnectionStringFromCmdLine);

        if (GenericHelper.IsUserInteractive())
        {
            form.ShowDialog();
        }
        else
        {
            form.OkButtonClick();
        }

        Application.DoEvents();

        if (form.ConnectionChanged)
        {
            _databaseOperation = form.GetDatabaseOperation();

            ChangeConnectionForm form1 = new ChangeConnectionForm();
            form1.Initialize(_databaseOperation, this);
        }
        else
        {
            if (_databaseOperation == null)
            {
                Environment.Exit(-1);
            }
        }
    }
    public ConnectionDialogForm(DatabaseOperation databaseOperation)
    {
        InitializeComponent();
        SetApplicationName();

        _databaseOperation = databaseOperation;

        authenticationComboBox.SelectedIndex = 0;

        SetDefaultValues();
        SearchHistoryHandler.LoadItems(serverNameComboBox, "RecentListServerName");

        if (ConfigHandler.SaveConnectionString == "True")
        {
            saveValuesCheckBox.Checked = true;
        }
        else
        {
            saveValuesCheckBox.Checked = false;
        }

        if (ConfigHandler.OfflineModeToSave == "True")
        {
            offlineCheckBox.Checked = true;
        }
        else
        {
            offlineCheckBox.Checked = false;
        }

        InitializeWorker();
    }
예제 #15
0
        public void DeleteStaff()
        {
            string id;
            Staff  result = null;

            RetrieveAllStaff();
            Console.WriteLine("\nEnter Details to Delete :");

            Console.WriteLine("Enter EmpId:");
            id = Console.ReadLine();
            // JsonFileOperation jfile = new JsonFileOperation();
            // jfile.DeleteFromFile<AdministrativeStaff>(id);
            // XmlFileOperation xfile = new XmlFileOperation();
            // xfile.DeleteFromFile<AdministrativeStaff>(id);

            DatabaseOperation dbr = new DatabaseOperation();

            result = dbr.GetSingleStaff(id, (int)SType.AdministrativeStaff);
            if (result != null)
            {
                DatabaseOperation db = new DatabaseOperation();
                db.DeleteStaff((int)SType.AdministrativeStaff, id);
                Console.WriteLine("\nDeletion Successfull");
            }
            else
            {
                Console.WriteLine("\nStaff Not Found !!");
            }
        }
    public static void SetTraceFileDirectory()
    {
        TraceFileDirectory = RegistryHandler.ReadFromRegistry("TraceFileDirectory");

        if (TraceFileDirectory == "")
        {
            if (!Convert.ToBoolean(OfflineMode))
            {
                DatabaseOperation databaseOperation = new DatabaseOperation();
                databaseOperation.InitializeDal(ConnectionString);

                string traceFileDir = databaseOperation.GetSqlServerDataDir();
                databaseOperation.Dispose();

                if (!Directory.Exists(traceFileDir))
                {
                    traceFileDir = GenericHelper.TempPath;
                }

                TraceFileDirectory = traceFileDir;
            }
            else
            {
                TraceFileDirectory = GenericHelper.TempPath;
            }
        }
    }
 public void Create_Throws_On_Unsupported_DatabaseOperation(DatabaseOperation operation)
 {
     // Act & Assert
     Sut.Invoking(x => x.Create <TestEntity>(operation))
     .Should().ThrowExactly <ArgumentOutOfRangeException>()
     .And.ParamName.Should().Be("operation");
 }
예제 #18
0
        public ActionResult Profile(Person model)
        {
            DatabaseOperation db = new DatabaseOperation();
            var person           = db.UpdateProfile(model);

            return(RedirectToAction("Home"));
        }
예제 #19
0
        private void btnRemoveGroup_Click(object sender, RoutedEventArgs e)
        {
            if (AthleticsCommon.MsgBox("Are you sure to delete selected ServerGroup?", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (grdServerGrid.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a ServerGroup which you want to remove.");
                return;
            }

            try
            {
                ServerGroup serverGroup = grdServerGrid.SelectedItem as ServerGroup;
                DatabaseOperation.DeleteServerGroup(m_matchID, serverGroup.Order);

                m_serverGroup             = DatabaseOperation.GetServerGroups(m_matchID);
                grdServerGrid.ItemsSource = m_serverGroup;
            }
            catch
            {
            }
        }
예제 #20
0
        private void btnUpdateGroup_Click(object sender, RoutedEventArgs e)
        {
            if (grdServerGrid.SelectedIndex < 0)
            {
                return;
            }

            try
            {
                if (string.IsNullOrWhiteSpace(txtGroupLongname.Text) || string.IsNullOrWhiteSpace(txtGroupShortname.Text))
                {
                    AthleticsCommon.MsgBox("LongName and ShortName could not be null");
                    return;
                }
                else
                {
                    ServerGroup serverGroup = grdServerGrid.SelectedItem as ServerGroup;
                    DatabaseOperation.UpdateServerGroup(m_matchID, serverGroup.Order, txtGroupLongname.Text, txtGroupShortname.Text);

                    m_serverGroup             = DatabaseOperation.GetServerGroups(m_matchID);
                    grdServerGrid.ItemsSource = m_serverGroup;

                    txtGroupShortname.Text = "";
                    txtGroupLongname.Text  = "";
                }
            }
            catch
            {
            }
        }
예제 #21
0
        private void btnDelPos_Click(object sender, RoutedEventArgs e)
        {
            if (AthleticsCommon.MsgBox("Are you sure to delete selected judge position?", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            if (grdSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a judge which you want to remove.");
                return;
            }
            JudgeInfo pos = grdSelJudge.SelectedItem as JudgeInfo;

            if (DatabaseOperation.DelMatchOfficial(m_matchID, pos.ServantNum))
            {
                m_selJudge.RemoveAt(grdSelJudge.SelectedIndex);
                m_unSelJudge = DatabaseOperation.GetAvailableOfficial(m_matchID);
                grdUnSelJudge.ItemsSource = m_unSelJudge;
                FilterUnSelJudges();
            }
            else
            {
                AthleticsCommon.ShowLastErrorBox();
            }
        }
    public void Initialize(DatabaseOperation databaseOperation, List <ImportTraceFileInfo> importTraceFileInfoList)
    {
        InitializeDictionary();

        timeTextBox.GotFocus += TimeTextBox_GotFocus;

        progressBar1.Value = 0;

        elapsedTimeTimer.Start();
        _sw.Reset();
        _sw.Start();

        RunWorkerArgument arg = new RunWorkerArgument();

        arg.DatabaseOperation       = databaseOperation;
        arg.ImportTraceFileInfoList = importTraceFileInfoList;

        if (GenericHelper.IsUserInteractive())
        {
            InitializeWorker();
            _worker.RunWorkerAsync(arg);
        }
        else
        {
            RunWorkerCompleted(DoWork(arg));
        }
    }
        private void btn_insert_Click(object sender, EventArgs e)
        {
            disableFields(false, false, false);

            DatabaseOperation.create(new StockManagement().add(stock));
            MessageBox.Show("Quantities Added Successfully!");
        }
예제 #24
0
        private bool UpdateJudge()
        {
            if (grdUnSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a judge in left list!");
                return(false);
            }
            if (grdSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a position in right list!");
                return(false);
            }

            JudgeInfo judge = grdUnSelJudge.SelectedItem as JudgeInfo;
            JudgeInfo pos   = grdSelJudge.SelectedItem as JudgeInfo;

            if (DatabaseOperation.UpdateMatchOfficial(m_matchID, pos.ServantNum, judge.RegisterID))
            {
                m_unSelJudge = DatabaseOperation.GetAvailableOfficial(m_matchID);
                grdUnSelJudge.ItemsSource = m_unSelJudge;
                FilterUnSelJudges();
                m_selJudge = DatabaseOperation.GetMatchOfficials(m_matchID, m_serverGroupID);
                grdSelJudge.ItemsSource = m_selJudge;
            }
            else
            {
                AthleticsCommon.ShowLastErrorBox();
                return(false);
            }
            return(true);
        }
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            DatabaseOperation db = new DatabaseOperation();

            if (ModelState.IsValid)
            {
                //var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                var user = new Person()
                {
                    UserId = model.UserName, FullName = model.FullName, Password = model.Password, Email = model.Email
                };
                var result = db.CreateUser(user);
                if (result)
                {
                    db.SignIn(user);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
                    FormsAuthentication.SetAuthCookie(user.UserId, false);
                    return(RedirectToAction("Home", "Tweet", new { User = user.UserId }));
                }
                //AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            ModelState.Clear();
            DatabaseOperation db = new DatabaseOperation();
            var user             = new Person()
            {
                UserId = model.UserName, Password = model.Password
            };
            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = db.SignIn(user);

            if (string.IsNullOrEmpty(result))
            {
                ModelState.AddModelError("InvalidLoginAttempt", "Invalid UserName/Password");
                return(RedirectToAction("Login"));
            }
            FormsAuthentication.SetAuthCookie(user.UserId, false);
            return(RedirectToAction("Home", "Tweet", new { user = user.UserId }));
        }
예제 #27
0
        public void RetrieveSingleStaff()
        {
            string       name = "", output = "";
            List <Staff> finalResult = new List <Staff>();

            object[] result = new object[7];
            Console.WriteLine("Enter Details to Search :");

            Console.WriteLine("Enter Name :");

            name = InputName();

            // JsonFileOperation jfile = new JsonFileOperation();
            // jfile.RetrieveFromFile<AdministrativeStaff>(name);
            // XmlFileOperation xfile = new XmlFileOperation();
            // xfile.RetrieveFromFile<AdministrativeStaff>(name);

            DatabaseOperation db = new DatabaseOperation();

            finalResult = db.SearchStaff(name, (int)SType.AdministrativeStaff);
            if (finalResult.Count > 0)
            {
                foreach (var items in finalResult)
                {
                    AdministrativeStaff item = (AdministrativeStaff)items;
                    output = "EmpId : " + item.EmpId + " Name : " + item.Name + " Phone : " + item.Phone +
                             " Email : " + item.Email + " Dob : " + item.Dob + " Designation : " + item.Designation;
                    Console.WriteLine(output + "\n");
                }
            }
            else
            {
                Console.WriteLine("\n List is empty \n");
            }
        }
예제 #28
0
        public void RetrieveAllStaff()
        {
            string output = "";

            List <Staff> finalResult = new List <Staff>();

            // JsonFileOperation jfile = new JsonFileOperation();
            // jfile.RetrieveAllFromFile<AdministrativeStaff>();
            // XmlFileOperation xfile = new XmlFileOperation();
            // xfile.RetrieveAllFromFile<AdministrativeStaff>();
            try
            {
                DatabaseOperation db = new DatabaseOperation();
                finalResult = db.RetriveAll((int)SType.AdministrativeStaff);

                foreach (var items in finalResult)
                {
                    AdministrativeStaff item = (AdministrativeStaff)items;
                    output = "EmpId : " + item.EmpId + " Name : " + item.Name + " Phone : " + item.Phone +
                             " Email : " + item.Email + " Dob : " + item.Dob + " Designation : " + item.Designation;
                    Console.WriteLine(output + "\n");
                }
            }
            catch (Exception)
            {
                Console.WriteLine("\n List is empty \n");
            }
        }
예제 #29
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            if (txt_username.Text.ToString() == "" || txt_password.Text.ToString() == "")
            {
                MessageBox.Show("username and password cannot be empty!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DataTable dt    = new DataTable();
                int       count = 0;
                string    query = new User().login(txt_username.Text, txt_password.Text);

                dt = DatabaseOperation.select(dt, query);
                Console.WriteLine(dt);
                count = Convert.ToInt32(dt.Rows.Count.ToString());
                if (count != 0)
                {
                    user = new User(id: dt.Rows[0].Field <int>("id"),
                                    name: dt.Rows[0].Field <string>("name"),
                                    username: dt.Rows[0].Field <string>("username"),
                                    password: dt.Rows[0].Field <string>("password"),
                                    role: dt.Rows[0].Field <string>("role"),
                                    user_algorithm: new UserFactory(dt.Rows[0].Field <string>("role")).getUserAlgorithm());
                    MessageBox.Show("Welcome to the LIBRARY MANAGEMENT SYSTEM! " + user.role + " - " + user.username);

                    this.Hide();
                    new Main(user).Show();
                }
                else
                {
                    MessageBox.Show("Invalid username or password.");
                }
            }
        }
    private static string GetUsingObjectDefinition(DatabaseOperation databaseOperation, CustomNode node)
    {
        string nodeNameToUse = "";

        switch (node.Type)
        {
        case NodeType.TableValuedFunction:
        case NodeType.ScalarValuedFunction:
        case NodeType.View:
        case NodeType.ViewTrigger:
        case NodeType.TableTrigger:
        case NodeType.StoredProcedure:
            nodeNameToUse = node.Name;
            break;

        case NodeType.TableValuedFunctionParameter:
        case NodeType.ScalarValuedFunctionParameter:
        case NodeType.StoredProcedureParameter:
        case NodeType.ViewColumn:
            nodeNameToUse = node.ParentName;
            break;
        }

        return(databaseOperation.GetObjectDefinition(nodeNameToUse));
    }
예제 #31
0
 public VersionedDatabaseRow(long version, 
     DateTime timestampUtc,
     DatabaseOperation databaseOperation)
 {
     _values = new Dictionary<string, object>();
     Version = version;
     TimestampUtc = timestampUtc;
     DatabaseOperation = databaseOperation;
 }
예제 #32
0
 public void WriteSourceFileTest()
 {
     // setup
     DatabaseOperation operation = new DatabaseOperation()
     {
         Namespace = "TestProject.DataAccess.Context",
         ModelNamespace = "TestProject.DataAcces.Model",
         DatabaseName = "Test"
     };
     // add some tables
     operation.TableMap.Add("Posts", "Post");
     operation.TableMap.Add("Users", "User");
     string location = TestSettings.ENVIRONMENT_PATH;
     string path = String.Format("{0}\\{1}.cs", location, operation.ClassName);
     // exercise
     operation.WriteSourceFile(location);
     // verify
     Assert.IsTrue(File.Exists(path));
 }
예제 #33
0
        private void buttonRestore_Click(object sender, EventArgs e)
        {
            if (listViewDatabases.SelectedItems.Count == 0)
            {
                lblResultMessage.ForeColor = Color.Red;
                lblResultMessage.Text = string.Format(MultiLanguageStrings.GetString(Ressource.FrmDatabaseSettings, "SelectInList.Text"));
                return;
            }

            openFileDialog.FileName = "";
            if (DialogResult.OK != openFileDialog.ShowDialog()) return;
            SqlDatabaseSettings sqlDatabase = (SqlDatabaseSettings) listViewDatabases.SelectedItems[0].Tag;
            btnRestore.Tag = sqlDatabase;

            DatabaseOperation dbo = new DatabaseOperation {Settings = sqlDatabase, File = openFileDialog.FileName};

            _exitApplicationIfClose = true;
            groupBoxDatabaseManagement.Enabled = false;
            groupBoxSQLSettings.Enabled = false;
            btnSave.Enabled = false;
            lblResultMessage.ForeColor = Color.Black;
            lblResultMessage.Text = string.Format("{0} {1} {2}",
                                             MultiLanguageStrings.GetString(Ressource.FrmDatabaseSettings,
                                                                            "RestoreDatabase.Text.Text"),
                                             sqlDatabase.Name,
                                             MultiLanguageStrings.GetString(Ressource.FrmDatabaseSettings,
                                                                            "InProgress.Text"));

            bWDatabaseRestore.RunWorkerAsync(dbo);
        }
 public void AddToDatabaseOperations(DatabaseOperation databaseOperation)
 {
     base.AddObject("DatabaseOperations", databaseOperation);
 }
 public static DatabaseOperation CreateDatabaseOperation(global::System.Guid ID, int stateId, global::System.Guid sessionActivityId, int percentComplete, global::System.DateTime startTime, global::System.DateTime lastModifyTime)
 {
     DatabaseOperation databaseOperation = new DatabaseOperation();
     databaseOperation.Id = ID;
     databaseOperation.StateId = stateId;
     databaseOperation.SessionActivityId = sessionActivityId;
     databaseOperation.PercentComplete = percentComplete;
     databaseOperation.StartTime = startTime;
     databaseOperation.LastModifyTime = lastModifyTime;
     return databaseOperation;
 }