Ejemplo n.º 1
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.CurrentDateTime:
                    return "CURRENT_TIMESTAMP";
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.CurrentDateTime:
                    return "CURRENT_TIMESTAMP";
            }

            return null;
        }
Ejemplo n.º 3
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.NewGuid:
                    return "sys_guid()";
            }

            return null;
        }
Ejemplo n.º 4
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.NewGuid:
                    return "sys_guid()";
            case SystemMethods.CurrentDateTime:
                  return "SYSDATE";
            }

            return null;
        }
Ejemplo n.º 5
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.CurrentUTCDateTime:
                    return "CURRENT_TIMESTAMP";
                case SystemMethods.CurrentDateTime:
                    return "datetime('now','localtime')";
            }

            return null;
        }
Ejemplo n.º 6
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.NewGuid:
                    return "NEWID()";
                case SystemMethods.CurrentDateTime:
                    return "GETDATE()";
            }

            return null;
        }
Ejemplo n.º 7
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.NewGuid:
                    //need to run the script share/contrib/uuid-ossp.sql to install the uuid_generate4 function
                    return "uuid_generate_v4()";
                case SystemMethods.CurrentDateTime:
                    return "now()";
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 8
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.NewGuid:
                    return "NEWID()";
                case SystemMethods.NewSequentialId:
                    return "NEWSEQUENTIALID()";
                case SystemMethods.CurrentDateTime:
                    return "GETDATE()";
                case SystemMethods.CurrentUTCDateTime:
                    return "GETUTCDATE()";
            }

            return null;
        }
Ejemplo n.º 9
0
        public override string FormatSystemMethods(SystemMethods value)
        {
            switch (value)
            {
            case SystemMethods.CurrentDateTimeOffset:
            case SystemMethods.CurrentDateTime:
                return("SYSDATE");

            case SystemMethods.CurrentUTCDateTime:
                return("(SYSDATE at time zone 'UTC')");

            case SystemMethods.CurrentUser:
                return("current_user");
            }

            return(base.FormatSystemMethods(value));
        }
Ejemplo n.º 10
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
            case SystemMethods.NewGuid:
                return("NEWID()");

            case SystemMethods.CurrentDateTime:
                return("GETDATE()");
                //case SystemMethods.NewSequentialId:
                //    return "NEWSEQUENTIALID()";
                //case SystemMethods.CurrentUTCDateTime:
                //    return "GETUTCDATE()";
            }

            return(null);
        }
Ejemplo n.º 11
0
        public override string FormatSystemMethods(SystemMethods value)
        {
            switch (value)
            {
            case SystemMethods.NewSequentialId:
            case SystemMethods.NewGuid:
                return("gen_uuid()");

            case SystemMethods.CurrentDateTime:
                return("CURRENT_TIMESTAMP");

            case SystemMethods.CurrentUser:
                return("CURRENT_USER");
            }

            return(base.FormatSystemMethods(value));
        }
        public IAlterColumnOptionSyntax WithDefault(SystemMethods method)
        {
            // we need to do a drop constraint and then add constraint to change the defualt value
            var dc = new AlterDefaultConstraintExpression
            {
                TableName    = Expression.TableName,
                SchemaName   = Expression.SchemaName,
                ColumnName   = Expression.Column.Name,
                DefaultValue = method
            };

            _context.Expressions.Add(dc);

            Expression.Column.DefaultValue = method;

            return(this);
        }
 protected void btnSummarySave_Click(object sender, EventArgs e)
 {
     //saves summary.
     SystemMethods.executeStoredProcedureWithVars("stpUpdateSummary", new string[9, 3] {
         { "@functionId", Page.RouteData.Values["functionId"].ToString(), "int" },
         { "@functionName", txtName.Text, "varChar" },
         { "@description", txtDes.Text, "varChar" },
         { "@fte", txtFTE.Text, "decimal" },
         { "@equipment", txtEquipment.Text, "varChar" },
         { "@supplies", txtSupplies.Text, "varChar" },
         { "@records", txtRecords.Text, "varChar" },
         { "@customers", txtCustomers.Text, "varChar" },
         { "@software", txtSoftware.Text, "varChar" }
     });
     //reloads summary to make sure its changes in database.
     loadSummary();
     labSummaryError.Text = "Changes Saved. Page Updated.";
 }
Ejemplo n.º 14
0
 /// <summary>
 /// ログデータの読み込みを実行する
 /// </summary>
 private void SetData()
 {
     //データを読み込む
     _logDataRecords = LogDataList.Load(_files[_logFileComboBox.SelectedIndex]);
     //
     if (_logDataRecords == null)
     {
         SystemMethods.GetMessageBox(MessageCategory.Error
                                     , "選択したファイルはログファイルではありません。"
                                     , ICADRenamer.Log.LogMessageKind.Error);
         return;
     }
     _logDataListBindingSource.DataSource = _logDataRecords;
     //レコードを最初へ
     _logDataListBindingSource.MoveFirst();
     //レベルリスト更新
     SetLevelComboBox();
 }
Ejemplo n.º 15
0
    public static string getStaffMembersForLeftMenu()
    {
        //this gets each staff member from database.
        DataTable staffMembers = SystemMethods.getDataTableFromStoredProcedure("stpGetStaffMembers");
        //this is used for ABC order
        string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int    rows    = staffMembers.Rows.Count;
        //this will be the html code for the left menu.
        string html = "";
        //this list is to store them in order
        List <CompanyStaffMember> staffMemberList = new List <CompanyStaffMember>();

        for (int uth = 0; uth < rows; uth++)
        {
            staffMemberList.Add(new CompanyStaffMember(Int32.Parse(staffMembers.Rows[uth]["staffMemberId"].ToString()), staffMembers.Rows[uth]["lastName"].ToString() + ", " + staffMembers.Rows[uth]["firstName"].ToString()));
        }
        //this makes the html code for the left menu
        for (int uth = 0; uth < letters.Length; uth++)
        {
            int makeHeader = 1;
            while (true)
            {
                CompanyStaffMember foundMember = staffMemberList.Find(x => x.firstLetter == letters[uth]);
                if (foundMember == null)
                {
                    break;
                }
                if (makeHeader == 1)
                {
                    html      += "<div id='" + letters[uth] + "'>";
                    html      += "<h2><a href='#" + letters[uth] + "'>" + letters[uth] + "</a></h2>";
                    makeHeader = 0;
                }
                staffMemberList.Remove(foundMember);
                html += "<p><a href='/StaffMember/" + foundMember.staffMemberId + "#" + letters[uth] + "'>" + foundMember.staffMemberName + "</a></p>";
            }
            if (makeHeader == 0)
            {
                html += "</div>";
            }
        }
        return(html);
    }
Ejemplo n.º 16
0
        /// <summary>
        /// Deletes a file or directory
        /// </summary>
        /// <param name="brickDirectoryPath">The relative path, must start with ../ and end with /</param>
        /// <param name="recursive">if true deletes the directory and all its contents</param>
        /// <returns><c>true</c> if deleted otherwise <c>false</c></returns>
        public static async Task <bool> DeleteDirectory(string brickDirectoryPath, bool recursive = false)
        {
            brickDirectoryPath = Firmware.FileSystem.ToBrickDirectoryPath(brickDirectoryPath);
            if (recursive)
            {
                DirectoryContent content = await GetDirectoryContent(brickDirectoryPath);

                foreach (File file in content.Files)
                {
                    await DeleteFile(file.Path);
                }

                foreach (Directory directory in content.Directories)
                {
                    await DeleteDirectory(directory.Path, recursive);
                }
            }
            return(await SystemMethods.Delete(Brick.Socket, brickDirectoryPath));
        }
Ejemplo n.º 17
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
                case SystemMethods.NewGuid:
                    //need to run the script share/contrib/uuid-ossp.sql to install the uuid_generate4 function
                    return "uuid_generate_v4()";
                case SystemMethods.NewSequentialId:
                    return "uuid_generate_v1()";
                case SystemMethods.CurrentDateTime:
                    return "now()";
                case SystemMethods.CurrentUTCDateTime:
                    return "(now() at time zone 'UTC')";
                case SystemMethods.CurrentUser:
                    return "current_user";
            }

            throw new NotImplementedException(string.Format("System method {0} is not implemented.", systemMethod));
        }
Ejemplo n.º 18
0
        protected override string FormatSystemMethods(SystemMethods systemMethod)
        {
            switch (systemMethod)
            {
            case SystemMethods.NewGuid:
                //need to run the script share/contrib/uuid-ossp.sql to install the uuid_generate4 function
                return("uuid_generate_v4()");

            case SystemMethods.CurrentDateTime:
                return("now()");

            case SystemMethods.CurrentUTCDateTime:
                return("(now() at time zone 'UTC')");

            case SystemMethods.CurrentUser:
                return("current_user");
            }

            throw new NotImplementedException();
        }
 protected void btnSaveChanges_Click(object sender, EventArgs e)
 {
     //deletes all used databases.
     SystemMethods.executeStoredProcedureWithVars("stpDeleteUsedDatabases", new string[1, 3] {
         { "@functionId", Page.RouteData.Values["functionId"].ToString(), "int" }
     });
     //adds databases from checkbox gridview.
     foreach (GridViewRow row in gridUsedDatabase.Rows)
     {
         CheckBox cb = (CheckBox)row.FindControl("chkDatabaseSelector");
         if (cb != null && cb.Checked)
         {
             SystemMethods.executeStoredProcedureWithVars("stpAddUsedDatabase", new string[2, 3] {
                 { "@functionId", Page.RouteData.Values["functionId"].ToString(), "int" },
                 { "@databaseId", gridUsedDatabase.Rows[row.RowIndex].Cells[0].Text, "int" }
             });
         }
     }
     Response.Redirect("~/Function/Update/" + Page.RouteData.Values["functionId"].ToString());
 }
Ejemplo n.º 20
0
 protected void btnSaveChanges_Click(object sender, EventArgs e)
 {
     //deletes all applications form database.
     SystemMethods.executeStoredProcedureWithVars("stpDeleteUsedApplications", new string[1, 3] {
         { "@functionId", Page.RouteData.Values["functionId"].ToString(), "int" }
     });
     //checks to see what ones are check then adds them
     foreach (GridViewRow row in gridApplicationSelector.Rows)
     {
         CheckBox cb = (CheckBox)row.FindControl("chkApplicationSelector");
         if (cb != null && cb.Checked)
         {
             SystemMethods.executeStoredProcedureWithVars("stpAddUsedApplication", new string[2, 3] {
                 { "@functionId", Page.RouteData.Values["functionId"].ToString(), "int" },
                 { "@applicationId", gridApplicationSelector.Rows[row.RowIndex].Cells[0].Text, "int" }
             });
         }
     }
     Response.Redirect("~/Function/Update/" + Page.RouteData.Values["functionId"].ToString());
 }
        public override string FormatSystemMethods(SystemMethods value)
        {
            switch (value)
            {
            case SystemMethods.NewSequentialId:
            case SystemMethods.NewGuid:
                return("NEWID()");

            case SystemMethods.CurrentDateTimeOffset:
            case SystemMethods.CurrentDateTime:
                return("CURRENT TIMESTAMP");

            case SystemMethods.CurrentUTCDateTime:
                return("CURRENT UTC TIMESTAMP");

            case SystemMethods.CurrentUser:
                return("CURRENT USER");
            }

            return(base.FormatSystemMethods(value));
        }
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     //makes sure nothing is empty.
     if (txtBackup.Text == null || txtLocation.Text == null || txtName.Text == null || txtRecovery.Text == null || txtSupport.Text == null)
     {
         //error
         labError.Text = "Do not leave anything blank.";
     }
     else
     {
         //checks to see if it should add or update.
         if (btnAdd.Text[0] == 'A')
         {
             //sends data to add.
             SystemMethods.executeStoredProcedureWithVars("stpInsertDatabase", new string[5, 3] {
                 { "@databaseName", txtName.Text, "varChar" },
                 { "@storageLocation", txtLocation.Text, "varChar" },
                 { "@backupStorageLocation", txtBackup.Text, "varChar" },
                 { "@supportManager", txtSupport.Text, "varChar" },
                 { "@recoveryTimeObjective", txtRecovery.Text, "varChar" }
             });
             //moves pages after add.
             Response.Redirect("~/lvl1_adminDatabase.aspx");
         }
         else
         {
             //sends data to database.
             SystemMethods.executeStoredProcedureWithVars("stpUpdateDatabase", new string[6, 3] {
                 { "@databaseId", Page.RouteData.Values["databaseId"].ToString(), "int" },
                 { "@databaseName", txtName.Text, "varChar" },
                 { "@storageLocation", txtLocation.Text, "varChar" },
                 { "@backupStorageLocation", txtBackup.Text, "varChar" },
                 { "@supportManager", txtSupport.Text, "varChar" },
                 { "@recoveryTimeObjective", txtRecovery.Text, "varChar" }
             });
             //moves pages after add.
             Response.Redirect("~/lvl1_adminDatabase.aspx");
         }
     }
 }
        /// <summary>
        /// This method Executes a Non Query StoredProcedure
        /// </summary>
        public PolymorphicObject ExecuteNonQuery(string procedureName, SqlParameter[] sqlParameters)
        {
            // initial value
            PolymorphicObject returnValue = new PolymorphicObject();

            // locals
            List <PolymorphicObject> parameters = new List <PolymorphicObject>();

            // create the parameters
            PolymorphicObject procedureNameParameter = new PolymorphicObject();
            PolymorphicObject sqlParametersParameter = new PolymorphicObject();

            // if the procedureName exists
            if (!String.IsNullOrEmpty(procedureName))
            {
                // Create an instance of the SystemMethods object
                SystemMethods systemMethods = new SystemMethods();

                // setup procedureNameParameter
                procedureNameParameter.Name = "ProcedureName";
                procedureNameParameter.Text = procedureName;

                // setup sqlParametersParameter
                sqlParametersParameter.Name        = "SqlParameters";
                sqlParametersParameter.ObjectValue = sqlParameters;

                // Add these parameters to the parameters
                parameters.Add(procedureNameParameter);
                parameters.Add(sqlParametersParameter);

                // get the dataConnector
                DataAccessComponent.DataManager.DataConnector dataConnector = GetDataConnector();

                // Execute the query
                returnValue = systemMethods.ExecuteNonQuery(parameters, dataConnector);
            }

            // return value
            return(returnValue);
        }
Ejemplo n.º 24
0
        public override string FormatSystemMethods(SystemMethods value)
        {
            switch (value)
            {
            case SystemMethods.NewGuid:
                //need to run the script share/contrib/uuid-ossp.sql to install the uuid_generate4 function
                return("uuid_generate_v4()");

            case SystemMethods.NewSequentialId:
                return("uuid_generate_v1()");

            case SystemMethods.CurrentDateTime:
                return("now()");

            case SystemMethods.CurrentUTCDateTime:
                return("(now() at time zone 'UTC')");

            case SystemMethods.CurrentUser:
                return("current_user");
            }
            return(base.FormatSystemMethods(value));
        }
Ejemplo n.º 25
0
        public override string FormatSystemMethods(SystemMethods value)
        {
            switch (value)
            {
            case SystemMethods.NewGuid:
                return("NEWID()");

            case SystemMethods.NewSequentialId:
                return("NEWSEQUENTIALID()");

            case SystemMethods.CurrentDateTime:
                return("GETDATE()");

            case SystemMethods.CurrentDateTimeOffset:
            case SystemMethods.CurrentUTCDateTime:
                return("GETUTCDATE()");

            case SystemMethods.CurrentUser:
                return("CURRENT_USER");
            }
            return(base.FormatSystemMethods(value));
        }
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     //checks to make sure everything is filled in.
     if (txtName.Text == null || txtLocation.Text == null || txtRecovery.Text == null || txtSupport.Text == null)
     {
         //error text
         labError.Text = "Do not leave anything blank";
     }
     else
     {
         //a means add new.
         if (btnAdd.Text[0] == 'A')
         {
             //sends data to database to add new
             SystemMethods.executeStoredProcedureWithVars("stpInsertApplication", new string[4, 3] {
                 { "@applicationName", txtName.Text, "varChar" },
                 { "@instalFilesLocation", txtLocation.Text, "varChar" },
                 { "@supportManager", txtSupport.Text, "varChar" },
                 { "@recoveryTimeline", txtRecovery.Text, "varChar" }
             });
             //redirect you after added.
             Response.Redirect("~/lvl1_adminApplication.aspx");
         }
         else
         {
             //this means update
             SystemMethods.executeStoredProcedureWithVars("stpUpdateApplication", new string[5, 3] {
                 { "@applicationId", Page.RouteData.Values["applicationId"].ToString(), "int" },
                 { "@applicationName", txtName.Text, "varChar" },
                 { "@instalFilesLocation", txtLocation.Text, "varChar" },
                 { "@supportManager", txtSupport.Text, "varChar" },
                 { "@recoveryTimeObjective", txtRecovery.Text, "varChar" }
             });
             //moves you after update.
             Response.Redirect("~/lvl1_adminApplication.aspx");
         }
     }
 }
Ejemplo n.º 27
0
 public static bool createUser(string firstname, string lastname, string email, string empId, string password, string salt, int role)
 {
     try
     {
         //this creates a user...
         SystemMethods.executeStoredProcedureWithVars("stpInsertUser",
                                                      new string[7, 3] {
             { "@firstName", firstname, "varchar" },
             { "@lastName", lastname, "varchar" },
             { "@email", email, "varchar" },
             { "@employeeId", empId, "varchar" },
             { "@pass", SystemMethods.hash(password, salt), "varchar" },
             { "@salt", salt, "varchar" },
             { "@role", role.ToString(), "int" },
         }
                                                      );
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 28
0
        public override string FormatSystemMethods(SystemMethods value)
        {
            switch (value)
            {
            case SystemMethods.NewGuid:
            case SystemMethods.NewSequentialId:
                return("sys_guid()");

            case SystemMethods.CurrentDateTime:
                return("LOCALTIMESTAMP");

            case SystemMethods.CurrentDateTimeOffset:
                return("CURRENT_TIMESTAMP");

            case SystemMethods.CurrentUTCDateTime:
                return("sys_extract_utc(SYSTIMESTAMP)");

            case SystemMethods.CurrentUser:
                return("USER");
            }

            return(base.FormatSystemMethods(value));
        }
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (btnAdd.Text[0] == 'U')
     {
         if (txtFirstName.Text == null || txtLastName.Text == null || txtEmail.Text == null)
         {
             labError.Text = "Fill out all info.";
         }
         else
         {
             //updates staff member
             SystemMethods.executeStoredProcedureWithVars("stpUpdateStaffMember", new string[7, 3] {
                 { "@staffMemberId", Page.RouteData.Values["staffMemberId"].ToString(), "int" },
                 { "@firstName", txtFirstName.Text, "varChar" },
                 { "@lastName", txtLastName.Text, "varChar" },
                 { "@email", txtEmail.Text, "varChar" },
                 { "@homePhone", txtHome1.Text + txtHome2.Text + txtHome3.Text, "varChar" },
                 { "@mobliePhone", txtMobile1.Text + txtMobile2.Text + txtMobile3.Text, "varChar" },
                 { "@workPhone", txtWork1.Text + txtWork2.Text + txtWork3.Text, "varChar" }
             });
             Response.Redirect("~/StaffMember/" + Page.RouteData.Values["staffMemberId"].ToString());
         }
     }
     else
     {
         //add new staff member
         SystemMethods.executeStoredProcedureWithVars("stpNewStaffMember", new string[6, 3] {
             { "@firstName", txtFirstName.Text, "varChar" },
             { "@lastName", txtLastName.Text, "varChar" },
             { "@email", txtEmail.Text, "varChar" },
             { "@homePhone", txtHome1.Text + txtHome2.Text + txtHome3.Text, "varChar" },
             { "@mobliePhone", txtMobile1.Text + txtMobile2.Text + txtMobile3.Text, "varChar" },
             { "@workPhone", txtWork1.Text + txtWork2.Text + txtWork3.Text, "varChar" }
         });
         Response.Redirect("~/Default.aspx");
     }
 }
 protected void btnLock_Click(object sender, EventArgs e)
 {
     //locks an account and unlocks.
     if (btnLock.Text[0] == 'L')
     {
         SystemMethods.executeStoredProcedureWithVars(
             "stpLockUser",
             new string[1, 3] {
             { "@userId", Page.RouteData.Values["userId"].ToString(), "int" }
         }
             );
         btnLock.Text = "Unlock User";
     }
     else if (btnLock.Text[0] == 'U')
     {
         SystemMethods.executeStoredProcedureWithVars(
             "stpUnlockUser",
             new string[1, 3] {
             { "@userId", Page.RouteData.Values["userId"].ToString(), "int" }
         }
             );
         btnLock.Text = "Lock User";
     }
 }
Ejemplo n.º 31
0
 /// <inheritdoc />
 public ICreateTableColumnOptionBuilder WithDefault(SystemMethods method)
 {
     CurrentColumn.DefaultValue = method;
     return(this);
 }
Ejemplo n.º 32
0
 protected override string FormatSystemMethods(SystemMethods systemMethod)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //this defaults to false because we should assume people are not allowed in.
        btnAdmin.Visible = false;
        try
        {
            //this makes sure the ticket they have is vaild
            if (!Request.IsAuthenticated)
            {
                //if ticket not vaild goto login.
                Response.Redirect("~/login.aspx");
            }
            //this decrpyts the ticket in order to retrive the userId and Role.
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(Request.Cookies["mysite.ASPXAUTH"].Value);
            //this makes sure the user is still allowed on the website.
            if (!SystemUser.userVaildCheck(Int32.Parse(ticket.Name), Session["key"].ToString()))
            {
                //if not allowed goto login.
                Response.Redirect("~/login.aspx");
            }
            //this gets the user role out of ticket.
            int userRole = Int32.Parse(ticket.UserData);
            //check to see if admin tab should be shown
            if (userRole == 1 || userRole == 4)
            {
                //shows tab
                btnAdmin.Visible = true;
            }
            //puts the persons name on screen...makes them feel like a person....not a number i guess.
            menuPersonName.InnerText = Request.Cookies["name"].Value;
        }
        catch (Exception ex)
        {
            //if anything goes wrong here i assume they are not allowed and force them to login.
            Response.Redirect("~/login.aspx");
        }
        clearButtons();
        //this bit of code. gets the session that remembers what tab you were on between pages.
        //its almost like we care about people...
        //the only 3 options for this
        // dept
        // staff
        // admin
        switch (Session["tab"].ToString())
        {
        case "dept":
            btnDepartment.CssClass  = "tabSelected leftMenuButton";
            accordContent.InnerHtml = CompanyDepartment.getDepartmentsForLeftMenu();
            break;

        case "staff":
            btnStaff.CssClass       = "tabSelected leftMenuButton leftMenuButtonMoveLeft";
            accordContent.InnerHtml = CompanyStaffMember.getStaffMembersForLeftMenu();
            break;

        case "admin":
            btnAdmin.CssClass       = "tabSelected leftMenuButton leftMenuButtonMoveLeft";
            accordContent.InnerHtml = SystemMethods.adminLeftMenu();
            break;
        }
    }
Ejemplo n.º 34
0
 protected abstract string FormatSystemMethods(SystemMethods systemMethod);
 protected abstract string FormatSystemMethods(SystemMethods systemMethod);
Ejemplo n.º 36
0
 public virtual string FormatSystemMethods(SystemMethods value)
 {
     throw new NotSupportedException($"The system method {value} is not supported.");
 }
Ejemplo n.º 37
0
 protected override string FormatSystemMethods(SystemMethods systemMethod)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 38
0
 public ICreateColumnOptionBuilder WithDefault(SystemMethods method)
 {
     Expression.Column.DefaultValue = method;
     return(this);
 }
Ejemplo n.º 39
0
 public static SystemUser attemptLogin(string enteredPass, string enteredEmail)
 {
     /* user accountStatus codes
      * 1 - Account Ok
      * 2 - Account Reset
      * 3 - Account Locked
      * 4 - Account Wrong
      * 5 - Not allowed to login
      */
     //this trys to login a user.
     try
     {
         //this first lines attempt to find the account
         DataTable theUser = SystemUser.userLogin(enteredEmail, enteredPass);
         //from that some tests are done to see if its vaild and allowed to login.
         //first test is to get the user role and check if that role is allowed to login
         if (!SystemUser.allowedLogin(Int32.Parse(theUser.Rows[0]["roleId"].ToString())))
         {
             //error 5 not allowed
             return(new SystemUser(5));
         }
         //next makes sure the account is not locked.
         if (Int32.Parse(theUser.Rows[0]["locked"].ToString()) == 1)
         {
             //error 3 account locked
             return(new SystemUser(3));
         }
         //this test makes sure your password is not 30 days old.
         if (DateTime.Parse(theUser.Rows[0]["resetDate"].ToString()) <= DateTime.Today)
         {
             //error code 2 reset password
             return(new SystemUser(2, Int32.Parse(theUser.Rows[0]["userId"].ToString())));
         }
         //this checks to see if an admin is making you change your password.
         if (Int32.Parse(theUser.Rows[0]["reset"].ToString()) == 1)
         {
             //error code 2 reset password
             return(new SystemUser(2, Int32.Parse(theUser.Rows[0]["userId"].ToString())));
         }
         //this then gets the user id.
         int userId = Int32.Parse(theUser.Rows[0]["userId"].ToString());
         //this makes the user a session key to use.
         //this reuses the saltMaker so session keys are from 100-300 chars
         string SessionKey = SystemMethods.saltMaker();
         //this adds a row into the loginTracker Table
         //it also gets the user ip.
         SystemUser.newUserLogin(userId, 0, SystemMethods.getIp());
         //this updates the users lastLogin date.
         SystemUser.updateLoginDate(userId);
         //this makes them a row in the active sessions table.
         SystemUser.insertNewSession(userId, SessionKey);
         //this then returns the user back with the information need to go on.
         return(new SystemUser(Int32.Parse(theUser.Rows[0]["roleId"].ToString()), userId, theUser.Rows[0]["firstName"].ToString(), theUser.Rows[0]["lastName"].ToString(), theUser.Rows[0]["email"].ToString(), 1, SessionKey));
     }
     catch (Exception ex)
     {
         //this means something when wrong.
         //this line add a new row into logintracker because it was still an attempt.
         //this also gets the users ip.
         SystemUser.newUserLogin(getUserIdByEmail(enteredEmail), 1, SystemMethods.getIp());
         //this add 1 to failedlogins on an account.
         SystemUser.wrongLogin(enteredEmail);
         //error code 4 wrong login.
         return(new SystemUser(4));
     }
 }
Ejemplo n.º 40
0
 public IAlterTableColumnOptionOrAddColumnOrAlterColumnSyntax WithDefault(SystemMethods method)
 {
     CurrentColumn.DefaultValue = method;
     return(this);
 }
 public IAlterColumnOptionSyntax WithDefault(SystemMethods method)
 {
     return(WithDefaultValue(method));
 }