Esempio n. 1
0
 protected void btnSignUp_Click(object sender, EventArgs e)
 {
     UsersClass.UserEmail    = txtEmail.Text.Trim();
     UsersClass.UserName     = txtUserName.Text.Trim();
     UsersClass.UserPassword = txtPassword.Text.Trim();
     UsersClass.AddUser();
 }
Esempio n. 2
0
        private void btnModifyProfile_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtModifyProfilePassword.Text == txtModifyProfileConfirm.Text)
                {
                    user.passwordUsers = txtModifyProfilePassword.Text;
                }
                else
                {
                    txtModifyProfilePassword.Clear();
                    txtModifyProfileConfirm.Clear();
                }
                if (IsValidData())
                {
                    user.firstNameUsers = txtModifyProfileFirstName.Text;
                    user.lastNameUsers  = txtModifyProfileLastName.Text;
                    user.emailUsers     = txtModifyProfileEmail.Text;
                    user.phoneUsers     = txtModifyProfilePhone.Text;
                    user.passwordUsers  = EncriptString.Encrypt(txtModifyProfilePassword.Text, "testEncript"); //Salt/Key

                    this.modify       = user;
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" +
                                ex.GetType().ToString() + "\n" +
                                ex.StackTrace, "Exception");
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            UsersClass user = new UsersClass();

            lblErrorMessage.Text = string.Empty;
            user = UM.FindUser(txtUserName.Text);
            if (user == null)
            {
                lblErrorMessage.Text = "ERROR : USER NAME DOESN'T EXIST!";
                return;
            }

            if (UM.ConfirmPassword(txtPassword.Text) == false)
            {
                lblErrorMessage.Text = "ERROR : EMPTY OR WRONG PASSWORD!";
                return;
            }

            Session["USER_ID"]             = txtUserName.Text;
            Session["CURRENT_DATE"]        = DateTime.Now;
            Session["NET_SESSION_ID"]      = Session.SessionID;
            Session["CLASSIC_SESSION_ID"]  = "";
            Session["SHOW_CLASSIC_WINDOW"] = "FALSE";
            Session.Timeout = 30;

            //  SendToBridge(ref user);
        }
Esempio n. 4
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (txtCreateAdminPassword.Text == txtCreateAdminPassword1.Text)
            {
                createdAdmin.passwordUsers = txtCreateAdminPassword.Text;
            }
            else
            {
                txtCreateAdminPassword.Clear();
                txtCreateAdminPassword1.Clear();
            }

            if (IsValidData())
            {
                createdAdmin.firstNameUsers = txtCreateAdminFirstName.Text;
                createdAdmin.lastNameUsers  = txtCreateAdminLastName.Text;
                createdAdmin.emailUsers     = txtCreateAdminEmail.Text;
                createdAdmin.phoneUsers     = txtCreateAdminPhone.Text;

                createdAdmin.passwordUsers = EncriptString.Encrypt(txtCreateAdminPassword.Text, "testEncript"); //Salt/Key
                createdAdmin.roleUsers     = "admin";
                createdAdmin.updatedUsers  = DateTime.Today;
                createdAdmin.createdUsers  = DateTime.Today;
                createdAdmin.approvedUsers = "1";

                this.creativity   = createdAdmin;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Esempio n. 5
0
        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            UsersClass user = new UsersClass();

            user.LogOut(CurrentUserID);
            LogIn l = new LogIn();

            l.Show();
        }
        private void  BindUser()
        {
            DataSet ds = UsersClass.GetList(null, null, null, null, null, null, null, null, null, null, null);

            DDUserID.DataSource     = ds;
            DDUserID.DataTextField  = "FullNameUser";
            DDUserID.DataValueField = "UserID";
            DDUserID.DataBind();
        }
        public static bool CreateProfile(UsersClass user)
        {
            SqlConnection connection      = CompanyDB_Class.GetConnection();
            string        insertStatement =
                "INSERT INTO Users " +
                "( first_name, last_name, email, phone, " +
                "password, role, approved, created, updated ) " +
                "VALUES ( @firstNameUsers, @lastNameUsers, @emailUsers, @phoneUsers, " +
                " @passwordUsers, @roleUsers, @approvedUsers, @createdUsers, @updatedUsers)";
            SqlCommand insertCommand =
                new SqlCommand(insertStatement, connection);

            insertCommand.Parameters.AddWithValue(
                "@firstNameUsers", user.firstNameUsers);
            insertCommand.Parameters.AddWithValue(
                "@lastNameUsers", user.lastNameUsers);
            insertCommand.Parameters.AddWithValue(
                "@emailUsers", user.emailUsers);
            insertCommand.Parameters.AddWithValue(
                "@phoneUsers", user.phoneUsers);
            insertCommand.Parameters.AddWithValue(
                "@roleUsers", user.roleUsers);

            insertCommand.Parameters.AddWithValue(
                "@createdUsers", user.createdUsers);

            insertCommand.Parameters.AddWithValue(
                "@updatedUsers", user.updatedUsers);

            insertCommand.Parameters.AddWithValue(
                "@approvedUsers", user.approvedUsers);
            insertCommand.Parameters.AddWithValue(
                "@passwordUsers", user.passwordUsers);
            try
            {
                connection.Open();
                int count = insertCommand.ExecuteNonQuery();
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
        public static bool ChangeUsers(UsersClass user)
        {
            SqlConnection connection      = CompanyDB_Class.GetConnection();
            string        updateStatement =
                "UPDATE users SET " +
                "first_name = @first_name, " +
                "last_name = @last_name, " +
                "email = @email, " +
                "phone = @phone, " +
                "role = @role, " +
                "updated = @updated, " +
                "password = @password " +
                " WHERE id = @id ";
            SqlCommand updateCommand =
                new SqlCommand(updateStatement, connection);

            updateCommand.Parameters.AddWithValue(
                "@id", user.userID);
            updateCommand.Parameters.AddWithValue(
                "@first_name", user.firstNameUsers);
            updateCommand.Parameters.AddWithValue(
                "@last_name", user.lastNameUsers);
            updateCommand.Parameters.AddWithValue(
                "@email", user.emailUsers);
            updateCommand.Parameters.AddWithValue(
                "@phone", user.phoneUsers);
            updateCommand.Parameters.AddWithValue(
                "@role", user.roleUsers);
            updateCommand.Parameters.AddWithValue(
                "@updated", user.updatedUsers);
            updateCommand.Parameters.AddWithValue(
                "@password", user.passwordUsers);
            try
            {
                connection.Open();
                int count = updateCommand.ExecuteNonQuery();
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
Esempio n. 9
0
        protected void Page_Init(object sender, EventArgs e)
        {
            UsersClass User = (UsersClass)Session["USER_ACCOUNT"];

            if (string.IsNullOrEmpty(User.FullName))
            {
                lblUser.Text = User.Username;
            }
            else
            {
                lblUser.Text = User.FullName;
            }
        }
        public static UsersClass GetUser(string userEmail)
        {
            SqlConnection connection = CompanyDB_Class.GetConnection();
            string        selectStatement
                = "SELECT id, first_name, last_name, email, phone, " +
                  "password, role, approved, created, updated "
                  + "FROM users "
                  + "WHERE email = @userEmail" +
                  " AND role = 'user'" +
                  " AND approved = '1'";
            SqlCommand selectcommand =
                new SqlCommand(selectStatement, connection);

            selectcommand.Parameters.AddWithValue("@userEmail", userEmail);

            try
            {
                connection.Open();
                SqlDataReader custReader =
                    selectcommand.ExecuteReader(CommandBehavior.SingleRow);
                if (custReader.Read())
                {
                    UsersClass user = new UsersClass();
                    user.userID         = (int)custReader["id"];
                    user.firstNameUsers = custReader["first_name"].ToString();
                    user.lastNameUsers  = custReader["last_name"].ToString();
                    user.emailUsers     = custReader["email"].ToString();
                    user.phoneUsers     = custReader["phone"].ToString();
                    user.roleUsers      = custReader["role"].ToString();
                    user.createdUsers   = Convert.ToDateTime(custReader["created"]);
                    user.updatedUsers   = Convert.ToDateTime(custReader["updated"]);
                    user.approvedUsers  = custReader["approved"].ToString();
                    user.passwordUsers  = custReader["password"].ToString();
                    return(user);
                }
                else
                {
                    return(null);
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
Esempio n. 11
0
        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            UsersClass user = new UsersClass();


            if (Session["USER_ACCOUNT"] != null)
            {
                Redirector.Redirect("~/Accounting/DashBoardPanel.aspx");
            }
            else
            {
                lblErrorMessage.Text = string.Empty;

                user = UM.CheckUserAccount(txtUsername.Text, txtPassword.Text);

                if (user == null)
                {
                    pnlError.Visible     = true;
                    lblErrorMessage.Text = "ERROR : USER ACCOUNT DOESN'T EXIST!";
                    return;
                }

                if (user.IsOnline == true)
                {
                    UM.UpdateOnlineStatus(user.ID, false);
                    //pnlError.Visible = true;
                    //lblErrorMessage.Text = "WARNING : USER ACCOUNT ALREADY ONLINE!";
                    //return;
                }
                Session["USER_ACCOUNT"] = user;
                Session["USER_ID"]      = user.ID;
                Session["USER_NAME"]    = user.Username;
                UM.UpdateOnlineStatus(user.ID, true);
                Session.Timeout       = 30;
                Session["USER_ROLES"] = UserRoleManager.GetUserRolesByUserId((int)user.ID);

                #region init log action
                UM.SaveTransactionLog(user, TransactionType.LOGIN);
                #endregion
                Redirector.Redirect("~/Accounting/DashBoardPanel.aspx");
            }
            //Session["CURRENT_DATE"] = DateTime.Now;
            //Session["NET_SESSION_ID"] = Session.SessionID;
            //Session["CLASSIC_SESSION_ID"] = "";
            //Session["SHOW_CLASSIC_WINDOW"] = "FALSE";

            //SendToBridge(ref user);
        }
 private void UsersSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         UsersClass usersClass = UsersBdGrid.SelectedItem as UsersClass;
         bdClassUpdate.UpdateUser(usersClass.Id, UsersMail.Text, UsersName.Text, User.HashPassword(UsersPassword.Text));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         refreshUsersBdGrid();
     }
 }
Esempio n. 13
0
 protected void btnOMessageOK_Click(object sender, EventArgs e)
 {
     try
     {
         UsersClass     userAccount = (UsersClass)Session["USER_ACCOUNT"];
         Message        message     = new Message();
         List <Message> Messages    = MSGManager.GetMessagesToday(DateTime.Today, userAccount.ID);
         message        = Messages.FirstOrDefault();
         message.Status = "READ";
         MSGManager.Save(message);
         btnNewMessage.Visible = false;
     }
     catch (Exception)
     {
         Redirector.Redirect("~/Accounting/DashBoardPanel.aspx");
     }
 }
        private void UsersBdGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (UsersBdGrid.SelectedItem != null)
                {
                    UsersClass usersClass = UsersBdGrid.SelectedItem as UsersClass;

                    UsersName.Text = usersClass.Name;
                    UsersMail.Text = usersClass.Mail;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 15
0
        private void btnChangeUsers_Click(object sender, EventArgs e)
        {
            if (IsValidData())
            {
                changeUser.firstNameUsers = txtChangeUsersFirstName.Text;
                changeUser.lastNameUsers  = txtChangeUsersLastName.Text;
                changeUser.emailUsers     = txtChangeUsersEmail.Text;
                changeUser.phoneUsers     = txtChangeUsersPhone.Text;
                changeUser.roleUsers      = comboBoxChangeUsersRole.Text;
                changeUser.updatedUsers   = DateTime.Now;
                changeUser.passwordUsers  = EncriptString.Encrypt(txtChangeUsersPassword.Text, "testEncript"); //Salt/Key

                this.changes      = changeUser;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Esempio n. 16
0
        private void SendToBridge(ref UsersClass user)
        {
            string sBridgeLocation = ConfigurationManager.AppSettings["BridgeLocation"];
            string sDefaultPage    = ConfigurationManager.AppSettings["DefaultPage"];

            //string sLocation = ConfigurationManager.AppSettings["BridgeLocation"];
            //Response.Write("<form name='bridge' action='http://irms-svr:82/irmsbridge.asp' method='POST' Target='_blank'>");
            Response.Write("<form name='bridge' action='" + sBridgeLocation + "' method='POST'>");
            Response.Write("<input type=hidden name='sessionid' value='" + Session.SessionID + "' >");
            Response.Write("<input type=hidden name='unameid' value='" + this.txtUsername.Text + "' >");
            Response.Write("<input type=hidden name='ulevelid' value='" + user.UserLevelID + "' >");
            Response.Write("<input type=hidden name='udeptid' value='" + user.DeptID + "' >");
            Response.Write("<input type=hidden name='defaultpage' value='" + sDefaultPage + "' >");
            Response.Write("</form>");
            Response.Write("<script>window.document.bridge.submit();</script>");
            Response.End();
        }
Esempio n. 17
0
        protected void Page_Init(object sender, EventArgs e)
        {
            UsersClass user = new UsersClass();

            user = (UsersClass)Session["USER_ACCOUNT"];
            if (user != null)
            {
                UM.UpdateOnlineStatus(user.ID, false);
                Session.Clear();
                Session.Abandon();
            }
            else
            {
                Session.Clear();
                Session.Abandon();
                Redirector.Redirect("~/Accounting/Login.aspx");
            }
        }
        public static List <UsersClass> GetUsers()
        {
            SqlConnection connection = CompanyDB_Class.GetConnection();
            string        selectStatement
                = "SELECT id, first_name, last_name, email, phone, " +
                  "password, role, approved, created, updated "
                  + "FROM users";
            SqlCommand selectcommand =
                new SqlCommand(selectStatement, connection);

            try
            {
                connection.Open();
                SqlDataReader custReader =
                    selectcommand.ExecuteReader();

                List <UsersClass> users = new List <UsersClass>();
                while (custReader.Read())
                {
                    UsersClass user = new UsersClass();
                    user.userID         = (int)custReader["id"];
                    user.firstNameUsers = custReader["first_name"].ToString();
                    user.lastNameUsers  = custReader["last_name"].ToString();
                    user.emailUsers     = custReader["email"].ToString();
                    user.phoneUsers     = custReader["phone"].ToString();
                    user.roleUsers      = custReader["role"].ToString();
                    user.createdUsers   = Convert.ToDateTime(custReader["created"]);
                    user.updatedUsers   = Convert.ToDateTime(custReader["updated"]);
                    user.approvedUsers  = custReader["approved"].ToString();
                    user.passwordUsers  = custReader["password"].ToString();
                    users.Add(user);
                }
                custReader.Close();
                return(users);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
        private void UsersDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (UsersBdGrid.SelectedItem != null)
                {
                    UsersClass usersClass = UsersBdGrid.SelectedItem as UsersClass;

                    bdClassDelete.DeleteRowTable(usersClass.Id, "User");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                refreshUsersBdGrid();
            }
        }
Esempio n. 20
0
 private void ModifyProfile_Load(object sender, EventArgs e)
 {
     user = UsersDB_Class.GetUserByID(user_id.ToString());
     txtModifyProfileFirstName.Text = user.firstNameUsers;
     txtModifyProfileLastName.Text  = user.lastNameUsers;
     txtModifyProfileEmail.Text     = user.emailUsers;
     txtModifyProfilePhone.Text     = user.phoneUsers;
     if (txtModifyProfilePassword.Text != null)
     {
         txtModifyProfilePassword.ForeColor    = Color.Black;
         txtModifyProfilePassword.Text         = "";
         txtModifyProfilePassword.PasswordChar = '*';
     }
     if (txtModifyProfileConfirm.Text != null)
     {
         txtModifyProfileConfirm.ForeColor    = Color.Black;
         txtModifyProfileConfirm.Text         = "";
         txtModifyProfileConfirm.PasswordChar = '*';
     }
 }
Esempio n. 21
0
        private void ModifyProfile_Click(object sender, EventArgs e)
        {
            ModifyProfile modifyProfile = new ModifyProfile(user_id);
            var           result        = modifyProfile.ShowDialog();

            if (result == DialogResult.OK)
            {
                UsersClass modified       = modifyProfile.modify;
                bool       returnedResult = UsersDB_Class.ChangeUsers(modified);
                if (returnedResult)
                {
                    FillListView();
                    MessageBox.Show("User changed");
                }
                else
                {
                    MessageBox.Show("Error");
                }
            }
        }
Esempio n. 22
0
        private void btnCreateAdmin_Click(object sender, EventArgs e)
        {
            CreateAdmin createAdmin = new CreateAdmin();
            var         result      = createAdmin.ShowDialog();

            if (result == DialogResult.OK)
            {
                UsersClass createdAdmin   = createAdmin.creativity;
                bool       returnedResult = UsersDB_Class.CreateAdmin(createdAdmin);
                if (returnedResult)
                {
                    FillListView();
                    MessageBox.Show("Admin created");
                }
                else
                {
                    MessageBox.Show("Error");
                }
            }
        }
Esempio n. 23
0
        private void btn_send_Click(object sender, EventArgs e)
        {
            var rooms = new MessagesClass.Rooms();

            if (cmb_rooms.SelectedIndex == -1 || cmb_rooms.Text == "")
            {
                MessageBox.Show("please Select Receiver Room!");
                return;
            }



            if (rtb_newmessage.Text != "" && cmb_rooms.SelectedIndex != -1)
            {
                rooms = (MessagesClass.Rooms)cmb_rooms.Items[cmb_rooms.SelectedIndex];
            }



            MessagesClass ms   = new MessagesClass();
            UsersClass    user = new UsersClass();
            DataTable     dt   = new DataTable();


            if (rtb_newmessage.Text == "")
            {
                MessageBox.Show("please enter text!");
                return;
            }

            if (currentUserRoomId == rooms.Id)
            {
                MessageBox.Show("you can not send message for youself, so please select another group");
                return;
            }
            if (rtb_newmessage.Text != "" && cmb_rooms.SelectedIndex != -1 && cmb_rooms.Text != "")
            {
                ms.Add(CurrentUserID, rooms.Id, rtb_newmessage.Text, 1, 0);
                rtb_newmessage.Text = "";
            }
        }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = Request.QueryString["action"];

            if (!this.IsPostBack)
            {
                if (action == "logout")
                {
                    UsersClass user = (UsersClass)Session["USER_ACCOUNT"];
                    if (user != null)
                    {
                        UM.UpdateOnlineStatus(user.ID, false);
                        #region log
                        UM.SaveTransactionLog(user, TransactionType.LOGOUT);
                        #endregion
                    }
                    Session.Clear();
                    Session.Abandon();
                }
            }
        }
Esempio n. 25
0
        protected void btnDoneEditing_Click(object sender, EventArgs e)
        {
            btnUpdate.Visible         = true;
            btnCancel.Visible         = false;
            btnDoneEditing.Visible    = false;
            pnlUploadAvatar.Visible   = false;
            txtFullName.ReadOnly      = true;
            txtEmailAddress.ReadOnly  = true;
            txtContactNumber.ReadOnly = true;
            //update user account
            UsersClass UpdatedUserAccount = new UsersClass();

            UpdatedUserAccount.ID            = USER.ID;
            UpdatedUserAccount.Username      = USER.Username;
            UpdatedUserAccount.UserPass      = USER.UserPass;
            UpdatedUserAccount.IsActive      = USER.IsActive;
            UpdatedUserAccount.ContactNumber = txtContactNumber.Text;
            UpdatedUserAccount.DeptID        = USER.DeptID;
            UpdatedUserAccount.Email         = txtEmailAddress.Text;
            UpdatedUserAccount.Gender        = USER.Gender;
            UpdatedUserAccount.UserLevelID   = USER.UserLevelID;
            if (string.IsNullOrEmpty(hfAvatarFileName.Value))
            {
                UpdatedUserAccount.Avatar = USER.Avatar;
            }
            else
            {
                UpdatedUserAccount.Avatar = hfAvatarFileName.Value;
            }
            UpdatedUserAccount.FullName = txtFullName.Text;
            UserManager.Save(UpdatedUserAccount);

            #region log
            Permission.PERMITTED_USER = USER;
            UserManager.Identity      = (int)USER.ID;
            UserManager.SaveTransactionLog(Permission.PERMITTED_USER, TransactionType.UPDATE);
            #endregion
            //reset UserAccount Session
            Session["USER_ACCOUNT"] = UpdatedUserAccount;
        }
Esempio n. 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string sHost = Request.ServerVariables["HTTP_HOST"].ToString();
            if (sHost.ToLower().Contains("tri-livingwell.com"))
            {
                Response.Redirect("/comingsoon.html");
            }
            else
            {
                if (Membership.GetUser() == null)//anonymous
                {
                    Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/main_frame.aspx", true);
                }
                else//logged in
                {
                    string sUsername = Membership.GetUser(AppLib.GetLoggedInUserName()).UserName;
                    SqlConnClass objSqlConnClass = new SqlConnClass();
                    UsersClass objUsersClass = new UsersClass(objSqlConnClass.sqlConnection);
                    string sRole = objUsersClass.GetUserRole(sUsername);
                    if (sRole == "Company")
                    {
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Company/UploadUsersForRegistration.aspx");
                    }
                    else if (sRole == "Administrator")
                    {
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Company/UploadUsersForRegistration.aspx");
                    }

                    else
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "main/main_frame.aspx", false);
                }
            }
        }
        catch (Exception ex)
        { /*Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/main_frame.aspx", true); */
        }
    }
Esempio n. 27
0
        private void btnChangeUsers_Click(object sender, EventArgs e)
        {
            UsersClass userChange = new UsersClass();

            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = listView1.SelectedItems[0];
                userChange.firstNameUsers = item.SubItems[0].Text;
                userChange.lastNameUsers  = item.SubItems[1].Text;
                userChange.phoneUsers     = item.SubItems[2].Text;
                userChange.emailUsers     = item.SubItems[3].Text;
                userChange.createdUsers   = Convert.ToDateTime(item.SubItems[5].Text);
                userChange.updatedUsers   = Convert.ToDateTime(item.SubItems[6].Text);
                userChange.roleUsers      = item.SubItems[7].Text;
                userChange.passwordUsers  = item.SubItems[8].Text;
                userChange.userID         = Convert.ToInt32(item.SubItems[9].Text);

                Change_users updateUser = new Change_users(userChange);
                var          result     = updateUser.ShowDialog();
                if (result == DialogResult.OK)
                {
                    UsersClass changedUser    = updateUser.changes;
                    bool       returnedResult = UsersDB_Class.ChangeUsers(userChange);
                    if (returnedResult)
                    {
                        FillListView();
                        MessageBox.Show("User changed");
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select an user in a list ");
            }
        }
        public WorkWin(UsersClass user)
        {
            InitializeComponent();


            if (File.Exists("Data.txt") == false)
            {
                File.Create("Data.txt");
            }

            if (File.Exists("Data.txt") == true)
            {
                using (StreamReader sr = new StreamReader("Data.txt"))
                {
                    string[] words;
                    for (int i = 0; i < File.ReadLines("Data.txt").Count(); i++)
                    {
                        string str = sr.ReadLine();
                        words = str.Split(new char[] { '@' });
                        users.Add(new UsersClass
                        {
                            Id       = Convert.ToInt32(words[0]),
                            Name     = words[1],
                            LastName = words[2],
                            Login    = words[3],
                            Password = words[4]
                        });
                    }
                }

                DataGrid.ItemsSource = users;
            }
            else
            {
                MessageBox.Show("Отсутствует лист, перезапуск программы!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                this.Close();
            }
        }
Esempio n. 29
0
        private void ProcessMembershipLogin(string username)
        {
            username = username.Replace("'", "''");
            this.cmd.Parameters.Clear();
               // this.cmd.CommandText = string.Format("SELECT UserID, UserName FROM ForumUsers WHERE UserName='******' AND Disabled=0", username);
            this.cmd.CommandText = string.Format("SELECT UserID, Email FROM ForumUsers WHERE Email='{0}' AND Disabled=0", username);
            this.cn.Open();
            DbDataReader dr = cmd.ExecuteReader();
            if (dr.Read()) //if user found if db (already exists)
            {
                Session["aspnetforumUserID"] = (dr[0]).ToString();
                Session["aspnetforumUserName"] = (dr[1]).ToString();
                dr.Close();
            }
            else //user not exists YET - let's add him to our ForumUsers table
            {

                SqlConnClass objSqlConnClass = new SqlConnClass();
                UsersClass objUsersClass = new UsersClass(objSqlConnClass.OpenConnection());

                //DataRow DR = objUsersClass.USR_GET_GetUserInfo(Membership.GetUser().ProviderUserKey.ToString()).Tables[0].Rows[0];
                /*Above line is commented by Netsmartz*/
                DataSet ds = objUsersClass.USR_GET_GetUserInfo(Membership.GetUser().ProviderUserKey.ToString());
                if (ds != null && ds.Tables.Count > 0)
                {
                    DataRow DR = ds.Tables[0].Rows[0];
                    string sUserDisplayName = "";
                    if (DR != null)
                    {
                        sUserDisplayName = DR["FNAME"].ToString() + " " + DR["LNAME"].ToString();
                    }
                    objSqlConnClass.CloseConnection();

                    dr.Close();
                    this.cmd.Parameters.Clear();
                    this.cmd.CommandText = "INSERT INTO ForumUsers (UserID, UserName, Email, [Password], UserDisplayName, Homepage, Interests, RegistrationDate, Disabled, ActivationCode) " +
                        "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
                    Utils.DB.PrepareCommandText(ref cmd);
                    Utils.DB.FillCommandParamaters(ref cmd, Membership.GetUser().ProviderUserKey.ToString(), username, "none", "none", sUserDisplayName, string.Empty, string.Empty, Utils.GetCurrTime(), false, string.Empty);
                    this.cmd.ExecuteNonQuery();

                    this.cmd.Parameters.Clear();
                    this.cmd.CommandText = string.Format("SELECT UserID, UserName FROM ForumUsers WHERE UserName='******' AND Disabled=0", username);
                    dr = cmd.ExecuteReader();
                    dr.Read();
                    Session["aspnetforumUserID"] = (dr[0]).ToString();
                    Session["aspnetforumUserName"] = dr[1].ToString();
                    dr.Close();
                }

            }

            this.cn.Close();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";
        //Response.Write(AppLib.Encrypt("1"));
        try
        {
            // David K. Bowers 04/12/12
            // --- start validate invite id
            // to be a valid instance of the registration page the user must have come in from the invite email link
            // which contains the iid parameter.  The iid parenter is the intCompanyRequestedUsersListId column in
            // the tbl_CompanyRequestedUsersList.  The iid is read from the url and stored in a hidden form field.  If
            // its not in either place then its invalid so redirect them to the resend invite form
            string get_iid = "";
            var giid = Request.QueryString["iid"];
            if (giid != null)
            {
                get_iid = giid.ToString();
                textIID.Value = get_iid;
                iInviteId = Convert.ToInt32(get_iid);
            }
            else
            {

                string hidden_iid = textIID.Value.Trim();
                if (hidden_iid.Length > 0) iInviteId = Convert.ToInt32(hidden_iid);
            }
            if (iInviteId == 0)
            {
                Response.Redirect("ResendInvite.aspx");
            }
            // --- end validate invite id

            objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
            objUsersClass = new UsersClass(objSqlConnClass.sqlConnection);

            DataSet DS = new DataSet();
            DS = objUsersClass.USR_GetInviteCompany(iInviteId);
            if (DS != null)
            {
                iCompanyId = Convert.ToInt32(DS.Tables[0].Rows[0]["intCompanyId"].ToString());
                sCompanyName = DS.Tables[0].Rows[0]["strCompanyName"].ToString();
                sEmpFirstName = DS.Tables[0].Rows[0]["strEmpFirstName"].ToString();
                sEmpLastName = DS.Tables[0].Rows[0]["strEmpLastName"].ToString();
                sEmpEmail = DS.Tables[0].Rows[0]["strEmpEmail"].ToString();
            }

            if (ViewState["gsAccountFrom"] != null)
            {
                gsAccountFrom = ViewState["gsAccountFrom"].ToString();
            }

        /*
         * =====================================================================
         * David Bowers 5/3/2012
         * I can't figure out what this is for so I am commenting it out for now
         * =====================================================================
            //DropDownList ddlCompany = (DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("ddlCompany");
            if (Request.QueryString["cid"] != null && Request.QueryString["id"] != null)
            {
                //ddlCompany.Visible = false;
                BindCompanyDetails();
            }
            else
            {
               // ddlCompany.Visible = true;
            }
        */
            TextBox txtOrganization = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtOrganization");
            txtOrganization.Text = sCompanyName;
            txtOrganization.ReadOnly = true;
            txtOrganization.Visible = true;

            if (!IsPostBack)
            {

        /*
         * =====================================================================
         * David Bowers 5/3/2012
         * I can't figure out what this is for so I am commenting it out for now
         * =====================================================================
                if (Request.QueryString["cid"] == null && Request.QueryString["id"] == null)
                    BindCompanyControl();
        */

                giShowReceipt = 1;
                giSendEmail = 1;
                CreateUserWizard1.FinishDestinationPageUrl = "/";
                CreateUserWizard1.LoginCreatedUser = false;

                //////////////////////////////////////////////////////////
                //Taking the List of Items in DataSets from the Database
                //////////////////////////////////////////////////////////

                // DataSet DegreeDS =

                DataSet StateDS = objBackofficeClass.GET_Items_AnyItemTable("State", "List_StateCountry");
                DataSet CountryDS = objBackofficeClass.GET_Items_AnyItemTable("Country", "List_StateCountry");

                ///////////////////////////////////////////////////////////////////////////////////////
                //Assigning the DropDownList objects by finding the controls from the createuserwizard
                ////////////////////////////////////////////////////////////////////////////////////////

                DropDownList ddlDegree = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlDegree");
                DropDownList ddlYourRole = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlYourRole");
                DropDownList ddlState = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlState");
                DropDownList ddlAccountFromRelationship = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlAccountFromRelationship");
                DropDownList ddlGender = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlGender");
                DropDownList ddlFamilyStatus = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlFamilyStatus");

                /////////////////////////////
                //Binding the DropDownLists
                ////////////////////////////

                ddlDegree = objSqlConnClass.fillDropDown(ddlDegree, "Degree", "List_Items");
                ddlYourRole = objSqlConnClass.fillDropDown(ddlYourRole, "Your Role", "List_Items");
                ddlAccountFromRelationship = objSqlConnClass.fillDropDown(ddlAccountFromRelationship, "Account From Relationship", "List_Items");
                ddlGender = objSqlConnClass.fillDropDown(ddlGender, "Gender", "List_Items");
                ddlFamilyStatus = objSqlConnClass.fillDropDown(ddlFamilyStatus, "Family Status", "List_Items");

                BindDropDownList(ddlState, StateDS);
            }
        }
        catch (Exception ex) { }
        finally
        {
            objSqlConnClass.CloseConnection();
        }
    }
Esempio n. 31
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.timer1.Start();
            UsersClass    user = new UsersClass();
            MessagesClass ms   = new MessagesClass();

            var Users       = user.FetchSenderUsers();
            var Rooms       = ms.FetchRooms();
            var currentUser = Users[CurrentUserID];

            HashSet <MessagesClass.Rooms> rooms             = new HashSet <MessagesClass.Rooms>();
            HashSet <UsersClass.User>     usersWithMessages = new HashSet <UsersClass.User>();

            foreach (DataRow membership in ms.MembershipsWithUserId(CurrentUserID).Rows)
            {
                DataTable dt = new DataTable();
                dt = ms.CompareUserNameAndRoomName((int)membership["room_id"]);

                if (dt != null)
                {
                    var RoomId = (int)dt.Rows[0]["id"];
                    roomsx.Id         = RoomId;
                    currentUserRoomId = RoomId;
                    foreach (var message in ms.GetMessagesOfRoom(RoomId))
                    {
                        //InboxIndexId.Add(i, message.Sender_Id);
                        //i++;
                        //lst_inbox.Items.Add(message);
                        usersWithMessages.Add(Users[message.Sender_Id]);
                    }
                    //var list = lst_inbox.Items.Cast<MessagesClass.Message>().OrderBy(item => item.Date).ToList();
                    //lst_inbox.Items.Clear();
                    //foreach (MessagesClass.Message listItem in list)
                    //{
                    //    lst_inbox.Items.Add(listItem);
                    //}
                }
            }

            foreach (var usr in usersWithMessages)
            {
                //SenderIndexId.Add(usr.Id, j);
                //j++;
                lst_sender.Items.Add(usr);
            }


            foreach (DataRow dr in ms.Search_Rooms().Rows)
            {
                rooms.Add(Rooms[(int)dr["id"]]);
            }


            foreach (var room in rooms)

            {
                cmb_rooms.Items.Add(room);
            }



            btn_CountOfInbox.Text = lst_inbox.Items.Count.ToString();

            lbl_welcomed.Text = "Hi " + currentUser.Name + " " + currentUser.Family;
        }
Esempio n. 32
0
        public void SaveTransactionLog(UsersClass User, TransactionType transactionType)
        {
            AuditTrail        auditTrail = new AuditTrail();
            AuditTrailManager logManager = new AuditTrailManager();

            try
            {
                switch (transactionType)
                {
                case TransactionType.INSERT:
                    auditTrail = new AuditTrail
                    {
                        ActionTaken  = "INSERTED NEW " + new E().GetType().Name + " with an Identity of " + Identity.ToString() + ".",
                        DateRecorded = DateTime.Now,
                        UserName     = User.Username,
                    };
                    break;

                case TransactionType.UPDATE:
                    auditTrail = new AuditTrail
                    {
                        ActionTaken  = "UPDATED Identity " + Identity.ToString() + " IN " + new E().GetType().Name + " DATABASE.",
                        DateRecorded = DateTime.Now,
                        UserName     = User.Username,
                    };
                    break;

                case TransactionType.DELETE:
                    auditTrail = new AuditTrail
                    {
                        ActionTaken  = "DELETED Identity " + Identity.ToString() + " FROM " + new E().GetType().Name + " DATABASE.",
                        DateRecorded = DateTime.Now,
                        UserName     = User.Username,
                    };
                    break;

                case TransactionType.LOGIN:
                    auditTrail = new AuditTrail
                    {
                        UserName     = User.Username,
                        ActionTaken  = "Log into the System.",
                        DateRecorded = DateTime.Now,
                    };
                    break;

                case TransactionType.LOGOUT:
                    auditTrail = new AuditTrail
                    {
                        UserName     = User.Username,
                        ActionTaken  = "Log Out into the System.",
                        DateRecorded = DateTime.Now,
                    };
                    break;

                case TransactionType.CONFIRMED:
                    auditTrail = new AuditTrail
                    {
                        ActionTaken  = "CONFIRMED DR with an Identity " + Identity.ToString() + " FROM " + new E().GetType().Name + " DATABASE.",
                        DateRecorded = DateTime.Now,
                        UserName     = User.Username,
                    };
                    break;

                default:
                    break;
                }
                logManager.Save(auditTrail);
            }
            catch (Exception ex)
            {
                //  throw ex;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";

        try
        {
            objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
            objUsersClass = new UsersClass(objSqlConnClass.sqlConnection);

            if (ViewState["gsAccountFrom"] != null)
            {
                gsAccountFrom = ViewState["gsAccountFrom"].ToString();
            }

            if (!IsPostBack)
            {

                giShowReceipt = 1;
                giSendEmail = 1;
                CreateUserWizard1.FinishDestinationPageUrl = "/";
                CreateUserWizard1.LoginCreatedUser = false;

                //////////////////////////////////////////////////////////
                //Taking the List of Items in DataSets from the Database
                //////////////////////////////////////////////////////////

                // DataSet DegreeDS =

                DataSet StateDS = objBackofficeClass.GET_Items_AnyItemTable("State", "List_StateCountry");
                DataSet CountryDS = objBackofficeClass.GET_Items_AnyItemTable("Country", "List_StateCountry");

                ///////////////////////////////////////////////////////////////////////////////////////
                //Assigning the DropDownList objects by finding the controls from the createuserwizard
                ////////////////////////////////////////////////////////////////////////////////////////

                DropDownList ddlDegree = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlDegree");
                DropDownList ddlState = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlState");
                DropDownList ddlCountry = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlCountry");
                DropDownList ddlAccountFromRelationship = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlAccountFromRelationship");
                DropDownList ddlGender = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlGender");
                DropDownList ddlFamilyStatus = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlFamilyStatus");

                /////////////////////////////
                //Binding the DropDownLists
                ////////////////////////////

                ddlDegree = objSqlConnClass.fillDropDown(ddlDegree, "Degree", "List_Items");
                //ddlYourRole = objSqlConnClass.fillDropDown(ddlYourRole, "Your Role", "List_Items");
                ddlAccountFromRelationship = objSqlConnClass.fillDropDown(ddlAccountFromRelationship, "Account From Relationship", "List_Items");
                ddlGender = objSqlConnClass.fillDropDown(ddlGender, "Gender", "List_Items");
                ddlFamilyStatus = objSqlConnClass.fillDropDown(ddlFamilyStatus, "Family Status", "List_Items");

                BindDropDownList(ddlState, StateDS);
                BindDropDownList(ddlCountry, CountryDS);
            }
        }
        catch (Exception ex) { }
        finally
        {
            objSqlConnClass.CloseConnection();
        }
    }
Esempio n. 34
0
 public Change_users(UsersClass user)
 {
     changeUser = user;
     InitializeComponent();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblError.Text = "";

        try
        {
            //    Response.Write(AppLib.Encrypt("1"));
            /*DateTime dtTodayDate = DateTime.Now;
            DateTime dtBDate = Convert.ToDateTime("16/06/1983");
            Response.Write(dtTodayDate - dtBDate);*/

            objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
            objUsersClass = new UsersClass(objSqlConnClass.sqlConnection);

            if (ViewState["gsAccountFrom"] != null)
            {
                gsAccountFrom = ViewState["gsAccountFrom"].ToString();
            }

            if (Request.QueryString["cid"] != null && Request.QueryString["id"] != null)
            {
                BindCompanyDetails();
                /*TextBox txtOrganization = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtOrganization");
                txtOrganization.Attributes.Add("Readonly", "true");*/
            }

            if (!IsPostBack)
            {
                BindCompanyControl();
                giShowReceipt = 1;
                giSendEmail = 1;
                CreateUserWizard1.FinishDestinationPageUrl = "/";
                CreateUserWizard1.LoginCreatedUser = false;

                //////////////////////////////////////////////////////////
                //Taking the List of Items in DataSets from the Database
                //////////////////////////////////////////////////////////

                // DataSet DegreeDS =

                DataSet StateDS = objBackofficeClass.GET_Items_AnyItemTable("State", "List_StateCountry");
                DataSet CountryDS = objBackofficeClass.GET_Items_AnyItemTable("Country", "List_StateCountry");

                ///////////////////////////////////////////////////////////////////////////////////////
                //Assigning the DropDownList objects by finding the controls from the createuserwizard
                ////////////////////////////////////////////////////////////////////////////////////////

                DropDownList ddlDegree = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlDegree");
                DropDownList ddlYourRole = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlYourRole");
                DropDownList ddlState = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlState");
                DropDownList ddlCountry = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlCountry");
                DropDownList ddlAccountFromRelationship = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlAccountFromRelationship");
                DropDownList ddlGender = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlGender");
                DropDownList ddlFamilyStatus = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ddlFamilyStatus");

                /////////////////////////////
                //Binding the DropDownLists
                ////////////////////////////

                ddlDegree = objSqlConnClass.fillDropDown(ddlDegree, "Degree", "List_Items");
                ddlYourRole = objSqlConnClass.fillDropDown(ddlYourRole, "Your Role", "List_Items");
                ddlAccountFromRelationship = objSqlConnClass.fillDropDown(ddlAccountFromRelationship, "Account From Relationship", "List_Items");
                ddlGender = objSqlConnClass.fillDropDown(ddlGender, "Gender", "List_Items");
                ddlFamilyStatus = objSqlConnClass.fillDropDown(ddlFamilyStatus, "Family Status", "List_Items");

                BindDropDownList(ddlState, StateDS);
                BindDropDownList(ddlCountry, CountryDS);
            }
        }
        catch (Exception ex) { }
        finally
        {
            objSqlConnClass.CloseConnection();
        }
    }