示例#1
0
 protected void cmdRemover_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (ListItem item in lstGroupMembers.Items)
         {
             if (item.Selected)
             {
                 GroupMemberDB.RemoverUser(Convert.ToInt32(item.Value), groupInfo.Group_ID);
             }
         }
         lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
     }
     catch
     {
         lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
     }
 }
示例#2
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            int      userID = ConvertUtility.ToInt32(txtID.Text);
            UserInfo info   = UserDB.GetInfo(userID);

            if (info == null)
            {
                return;
            }

            info.User_Email    = txtEmail.Text.Trim();
            info.User_FullName = txtFullName.Text;
            if (txtPassword.Text.Trim() != string.Empty)
            {
                info.User_Password = SecurityMethod.MD5Encrypt(txtPassword.Text.Trim());
            }

            info.User_Gender   = (dropGender.SelectedValue == "1") ? true : false;
            info.User_Address  = txtAddress.Text;
            info.User_Birthday = txtBirthDay.Text;
            info.User_Phone    = txtPhone.Text;

            info.User_SuperAdmin = chkIsSuperAdmin.Checked;
            try
            {
                UserDB.Update(info);
                foreach (ListItem item in lstGroups.Items)
                {
                    if (item.Selected)
                    {
                        GroupMemberDB.AddUser(info.User_ID, Convert.ToInt32(item.Value));
                    }
                    else
                    {
                        GroupMemberDB.RemoverUser(info.User_ID, Convert.ToInt32(item.Value));
                    }
                }
                lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
            }
            catch
            {
                lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
            }
        }
示例#3
0
        protected void cmdAddNew_Click(object sender, EventArgs e)
        {
            UserInfo info = new UserInfo();

            info.User_Email    = txtEmail.Text.Trim();
            info.User_FullName = txtFullName.Text;
            info.User_Password = SecurityMethod.MD5Encrypt(txtPassword.Text.Trim());

            info.User_Gender   = (dropGender.SelectedValue == "1") ? true : false;
            info.User_Address  = txtAddress.Text;
            info.User_Birthday = txtBirthDay.Text;
            info.User_Phone    = txtPhone.Text;

            info.User_SuperAdmin = chkIsSuperAdmin.Checked;
            try
            {
                txtID.Text = UserDB.Insert(info).ToString();

                foreach (ListItem item in lstGroups.Items)
                {
                    if (item.Selected)
                    {
                        GroupMemberDB.AddUser(Convert.ToInt32(txtID.Text), Convert.ToInt32(item.Value));
                    }
                    else
                    {
                        GroupMemberDB.RemoverUser(Convert.ToInt32(txtID.Text), Convert.ToInt32(item.Value));
                    }
                }

                //Response.Write(FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "md5"));
                //Response.Write("<br />");
                //Response.Write(SecurityMethod.MD5Encrypt(txtPassword.Text.Trim()));

                lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
            }
            catch
            {
                lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
            }
        }