示例#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);
    }
    protected void grdGuestHouseRequests_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int requestID = Convert.ToInt32(e.CommandArgument);

        if (e.CommandName == "deleteRequest")
        {
            GuestHouseRequest.DeleteRequest(requestID);
        }
        else if (e.CommandName == "allotRequest")
        {
            //Bind dropdowns as per request
            var   currentRow    = ((LinkButton)e.CommandSource).Parent.NamingContainer as GridViewRow;
            Label lblGuestHouse = currentRow.FindControl("lblGuestHouse") as Label;

            ddlRoom.Items.Clear();

            if (lblGuestHouse.Text == "Guest House Sector 17")
            {
                ddlRoom.Items.Add(new ListItem("Ravi"));   //DELUX
                ddlRoom.Items.Add(new ListItem("Beas"));   //DELUX
                ddlRoom.Items.Add(new ListItem("Satluj")); //DELUX
                ddlRoom.Items.Add(new ListItem("Chinab")); //VIP
            }
            else if (lblGuestHouse.Text == "Guest House Sector 42")
            {
                ddlRoom.Items.Add(new ListItem("Room 1")); //DELUX
                ddlRoom.Items.Add(new ListItem("Room 2")); //DELUX
                ddlRoom.Items.Add(new ListItem("Room 3")); //DELUX
            }

            hdnRequestID.Value = requestID.ToString();
            popSelectRoom.Show();
        }
        else if (e.CommandName == "markPaid")
        {
            GuestHouseRequest.MarkPaid(requestID);
            lblLegend.Text = "Payment received successfully and the record has been marked as paid";
        }
        else if (e.CommandName == "cancelBooking")
        {
            GuestHouseRequest.DeleteRequest(requestID);
            lblLegend.Text = "The booking request has been cancelled";
            //Send booking confirmation email
            var   currentRow = ((LinkButton)e.CommandSource).Parent.NamingContainer as GridViewRow;
            Label lblEmail   = currentRow.FindControl("lblEmail") as Label;

            SendmailMessage.SendMail(lblEmail.Text, "*****@*****.**", "Request #" + requestID + " for Guest house has been cancelled"
                                     , "Guest house booking cancelled");
        }

        BindData();
    }
示例#3
0
    protected void btnSubmitInfo_Click(object sender, EventArgs e)
    {
        try
        {
            SendmailMessage.SendMail("*****@*****.**", "*****@*****.**", txtInformation.Text, "Please update my information, AAN : " + txtAAN.Text);
        }
        catch (Exception)
        {
        }
        finally
        {
            lblmessage.Text    = "Your information has successfully been sent to the Administrator";
            lblmessage.Visible = true;

            pnlInfo.Visible = false;
        }
    }
示例#4
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, "*****@*****.**");
    }
示例#5
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //Save Submit and Clear the form

        if (ValidateCaptcha())
        {
            lblMessage.Text = string.Empty;

            //Pre business checks prior to save guest house information submitted by user
            if (GuestHouseRequest.IsGuestHouseAvailable(ddlGuestHouse.SelectedValue, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)))
            {
                //Save guest house information
                long requestId = 0;

                SaveGuestHouseRequest(out requestId);

                lblMessage.Text = "Informaion submitted successfully!";



                //Send booking confirmation email
                SendmailMessage.SendMail(txtEmailAddress.Text, "*****@*****.**", "Request for Guest house " + ddlGuestHouse.SelectedValue + " has been" +
                                         "Received successfully, we will contact you soon", "Request received");

                ClearForm();
            }
            else
            {
                lblMessage.Text = "Guest house " + ddlGuestHouse.SelectedValue + " is not available in selected date range" +
                                  "Please try to book another slot";
            }
        }
        else
        {
            lblMessage.Text = "Please enter valid captcha";
        }
    }
示例#6
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");
    }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SendmailMessage.SendMail("*****@*****.**", "*****@*****.**", "Hi", "test");
 }
示例#8
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        if (chkDeclaration.Checked == true)
        {
            validatedeclaration.Visible = false;
            tbAllotmentApplication application = new tbAllotmentApplication();
            if (applicationid <= 0)
            {
                DataSet ds = new DataSet();
                ds.ReadXml(Server.MapPath("~/submissionVerfication.xml"));
                DataTable dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    if (!Convert.ToBoolean(dt.Rows[0][0]))
                    {
                        lblmessage.Text    = "Application submission has been closed";
                        lblmessage.Visible = true;
                        return;
                    }
                }

                /*application = AllotementApplications.GetApplicationByAAN(Users.getUserByUserName(HttpContext.Current.User.Identity.Name).AAN);
                 * if (application == null)
                 * {
                 *  application = new tbAllotmentApplication();
                 *  application.SubmissionDate = DateTime.Now;
                 * }
                 * else
                 * {
                 *  lblmessage.Text = "Only one application can be submitted!";
                 *  lblmessage.Visible = true;
                 *  return;
                 * }*/
            }
            else
            {
                application = AllotementApplications.GetApplication(applicationid);
            }
            DateTime DateOfBirth, DateOfjoining, DateOfDebared, dateofret;
            DateTime.TryParse(txtDob.Text, out DateOfBirth);
            DateTime.TryParse(txtEmployedfrom.Text, out DateOfjoining);
            DateTime.TryParse(txtDateOfRetirement.Text, out dateofret);
            application.DateOfBirth         = DateOfBirth;
            application.DateOfjoining       = DateOfjoining;
            application.GradePay            = drpGradePay.SelectedValue;
            application.Name                = txtUsername.Text;
            application.Designation         = Convert.ToInt64(drpdesignations.SelectedValue);
            application.OfficeId            = Convert.ToInt32(drpOffice.SelectedValue);
            application.OtherQuarterAddress = txtAuditAddress.Text;
            if ((txtQuartertype.SelectedValue != null) && (txtQuartertype.SelectedValue != "-1") && (txtQuartertype.SelectedValue != ""))
            {
                application.OtherQuarterType = Convert.ToInt32(txtQuartertype.SelectedValue);
            }
            application.OtherQuarterNumber = drpAllotedQuarter.SelectedValue;
            application.MedicalCategory    = Convert.ToInt32(ddlMedicalCategory.SelectedValue);
            application.JobType            = Convert.ToInt32(drpJobType.SelectedValue);
            application.Sex            = Convert.ToInt32(drpSex.SelectedValue);
            application.Status         = 0;
            application.ContactNumber  = txtContactNumber.Text;
            application.SubmissionDate = DateTime.Now;
            if (applicationid <= 0)
            {
                tblUser user = new tblUser();
                //user.Username = txtUsername.Text;
                user.EmailID           = txtEmailAddress.Text;
                user.EmployeeCode      = txtPUCDACode.Text;
                user.IsPasswordChanged = false;
                user.fullName          = txtUsername.Text;
                user.AAN          = Offices.GetOfficeCode(Convert.ToInt32(drpOffice.SelectedValue)) + user.EmployeeCode;
                user.Username     = user.AAN;
                user.Password     = "******";
                user.BaseOfficeId = Convert.ToInt32(drpOffice.SelectedValue);
                user.Roleid       = 4;//by default viewer role
                user.designation  = Convert.ToInt64(drpdesignations.SelectedValue);
                user.bIsDeleted   = false;

                //application.Userid = Users.getUserByUserName(HttpContext.Current.User.Identity.Name).Id;
                //tblUser _user = Users.getUserByUserName(HttpContext.Current.User.Identity.Name);
                user.DateOfJoining    = DateOfjoining;
                user.DateOfRetirement = dateofret;
                user.AadharNumber     = txtAadharNumber.Text.Trim();
                user.PanNumber        = txtPAN.Text.Trim();

                var app = AllotementApplications.GetApplicationByAAN(user.AAN);

                if (app != null)
                {
                    lblmessage.Text    = "Only one application can be submitted!";
                    lblmessage.Visible = true;
                    return;
                }

                Users.SaveUser(user);

                string emailBody = "Your username/AAN = " + user.AAN + " and Password is " + user.Password;

                try
                {
                    SendmailMessage.SendMail(user.EmailID, "*****@*****.**", emailBody, "Account created");
                }
                catch (Exception ex)
                {
                }
                //Send email here for user AAN and Password

                //Send SMS
                try
                {
                    //new IntegratedMessageSender().SendMessage("NEW_USER", "Username:"******",Password:"******"The application cannot be saved, because specified category is not active";
                lblmessage.Visible = true;
                return;
            }

            application = AllotementApplications.SaveApplications(application);
            if (Session["members"] != null)
            {
                List <tblMember> mem = (List <tblMember>)Session["members"];
                foreach (tblMember meminfo in mem)
                {
                    meminfo.ApplicationId = application.ID;
                }
                Tblmemberinfo.Save(mem);
                Session["members"] = null;
            }
            lblmessage.Visible = true;
            lblmessage.Text    = "Information saved sucessfully";
            Empty();
            lblmessage.Font.Bold = true;
            Response.Redirect("~/user/Confirmation.aspx");
        }
        else
        {
            validatedeclaration.Visible = true;
        }
    }