Esempio n. 1
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        string status = "saved";

        if (id > 0)
        {
            _user  = Users.getUser(id);
            status = "updated";
        }
        else
        {
            if (Users.CheckEmail(txtEmailId.Text))
            {
                lblMessage.Text    = "Email address already exists!";
                lblMessage.Visible = true;
                return;
            }
            if (Users.getUserByUserName(txtUsername.Text) != null)
            {
                lblMessage.Text    = "User name already exists!";
                lblMessage.Visible = true;
                return;
            }
            _user = new tblUser();
        }
        _user.EmailID  = txtEmailId.Text;
        _user.fullName = txtFullName.Text;
        _user.Username = txtUsername.Text;
        // _user.DateOfRetirement = Convert.ToDateTime(txtDob.Text).AddYears(60);
        //_user.DateOfJoining= Convert.ToDateTime(txtDob.Text );
        // _user.Addressline1 = txtAddress.Text;
        if (id <= 0)
        {
            _user.Password = txtPassword.Text;
        }
        _user.BaseOfficeId = Convert.ToInt32(drpOffice.SelectedValue);
        _user.Roleid       = Convert.ToInt32(drpRoles.SelectedValue);
        Users.SaveUser(_user);
        if (id <= 0)
        {
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "User creation";
            _userhistory.description = _user.Username + " has created user with userid " + _user.Id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
            string outstring;
            SendmailMessage.sendEmailMessage("*****@*****.**", _user.EmailID, "", "Account created", "Your account has been created sucessfully!", "", out outstring);
        }
        else
        {
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "User creation";
            _userhistory.description = _user.Username + " has updated user with userid " + _user.Id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
        Response.Redirect("~/admin/users.aspx?status=" + status);
    }
Esempio n. 2
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        if (!Users.CheckEmail(txtEmailId.Text))
        {
            lblmessage.Text    = "Email address does't exists!";
            lblmessage.Visible = true;
            return;
        }
        tblUser _user     = Users.getUserEmail(txtEmailId.Text);
        string  outstring = "";

        if (_user != null)
        {
            SendmailMessage.sendEmailMessage("*****@*****.**", _user.EmailID, "", "Account Password", "Your password is :" + _user.Password, "", out outstring);
        }
        else
        {
            lblmessage.Text    = "Invalid user!";
            lblmessage.Visible = true;
        }
        //SendmailMessage.SendMail(txtEmailId.Text, "*****@*****.**");
    }
Esempio n. 3
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        string status = "saved";

        if (Users.CheckEmail(txtEmailId.Text))
        {
            lblMessage.Text    = "Email address already exists!";
            lblMessage.Visible = true;
            return;
        }
        if (Users.getUserByUserName(txtUsername.Text) != null)
        {
            lblMessage.Text    = "User name already exists!";
            lblMessage.Visible = true;
            return;
        }
        _user             = new tblUser();
        _user.Password    = txtPassword.Text;
        _user.designation = Convert.ToInt64(drpDesignation.SelectedValue);
        _user.Roleid      = 4;
        _user.EmailID     = txtEmailId.Text;
        _user.fullName    = txtFullName.Text;
        _user.Username    = txtUsername.Text;
        //_user.DateOfRetirement = Convert.ToDateTime(txtDob.Text).AddYears(60);
        //_user.DateOfJoining = Convert.ToDateTime(txtDob.Text);
        ////_user.Addressline1 = txtAddress.Text;
        _user.BaseOfficeId = Convert.ToInt32(drpOffice.SelectedValue);
        Users.SaveUser(_user);
        //Response.Redirect("~/admin/users.aspx?status=" + status);
        string outstring;

        SendmailMessage.sendEmailMessage("*****@*****.**", _user.EmailID, "", "Account created", "Your account has been created sucessfully!", "", out outstring);
        lblMessage.Text    = "Information saved sucessfully!";
        lblMessage.Visible = true;
        Response.Redirect("~/Confirmation.aspx");
    }