示例#1
0
    protected void gridCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Allotte")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);

            var gridRow = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;


            HiddenField hidApplicationId = gridRow.FindControl("hidApplicationId") as HiddenField;

            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);
            Response.Redirect("~/admin/Allottee.aspx?appid=" + hidApplicationId.Value + "&ChangeRequestID=" + id + "&returnurl=admin/ViewChangeRequest.aspx");
        }
        else if (e.CommandName == "Withdraw")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            DataClassesDataContext dataContext = new DataClassesDataContext();
            var requests = from request in dataContext.tblChangeRequests where request.Id == id select request;
            tblChangeRequest tblreject = requests.FirstOrDefault();
            if (tblreject != null)
            {
                //Added on January 24,2017
                tblAllottee allottee = Allottee.GetAllotteeByAAN(tblreject.AAN);
                Quarters.UpdateQuarterStatus(allottee.QuarterNumber, QuarterStatus.Vacant);

                //update allottee
                //Reset the quarter to previous one at the time of change request
                allottee.QuarterNumber = tblreject.QuarterNumber;
                Allottee.Update(allottee);
                //Added on January 24,2017 end

                dataContext.tblChangeRequests.DeleteOnSubmit(tblreject);
                dataContext.SubmitChanges();
            }
            BindGrid();
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.rejected);
            //Quarters.UpdateQuarterStatus(tblreject.QuarterNumber, QuarterStatus.Vacant); //Commented on Dec 12,2016 purposely
        }
        else if (e.CommandName == "Possesed")
        {
            var        gridRow    = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;
            LinkButton lnkAllotte = gridRow.FindControl("lnkAllotte") as LinkButton;
            hdnChangeRequestId.Value = lnkAllotte.CommandArgument;

            hdnSelected.Value = e.CommandArgument.ToString();
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(Convert.ToInt64(e.CommandArgument));
            txtName.Text = AllotementApplications.GetApplication(Convert.ToInt64(e.CommandArgument)).tblUser.fullName;
            if (_allotte != null)
            {
                txtQuarternumber.Text = _allotte.QuarterNumber;
            }

            pop.Show();
        }
    }
示例#2
0
    private void possession()
    {
        long id;

        Int64.TryParse(hdnSelected.Value, out id);

        long changeRequestId;

        Int64.TryParse(hdnChangeRequestId.Value, out changeRequestId);


        AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        tbAllotmentApplication app      = AllotementApplications.GetApplication(id);
        tblAllottee            _allotte = Allottee.getAllotteByApplicationid(id);

        if (_allotte != null)
        {
            DateTime _dateofPossession;
            DateTime.TryParse(txtDateOfPossession.Text, out _dateofPossession);
            _allotte.Status           = (int)AllotementStatus.Possessed;
            _allotte.DateOfPossession = _dateofPossession;
            Allottee.Update(_allotte);
        }

        if (id > 0)
        {
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        }

        DataClassesDataContext dataContext = new DataClassesDataContext();
        var requests = from request in dataContext.tblChangeRequests where request.Id == changeRequestId select request;

        /*tblChangeRequest tblDelete = requests.FirstOrDefault();
         * if (tblDelete != null)
         * {
         *  dataContext.tblChangeRequests.DeleteOnSubmit(tblDelete);
         *  dataContext.SubmitChanges();
         * } //Finally deleting the change request changed on 02-06-2016*/

        tblChangeRequest tblUpdate = requests.FirstOrDefault();

        if (tblUpdate != null)
        {
            tblUpdate.Status = (int)ChangeRequestStatus.Approved;
            dataContext.SubmitChanges(); //Updating the status of request to approved
        }

        tbluserhistory _userhistory = new tbluserhistory();

        _userhistory.Action      = "Possession";
        _userhistory.description = _user.Username + " has marked possesed application with " + id;
        _userhistory.time        = DateTime.Now;
        _userhistory.useraan     = _user.AAN;
        userHistory.Save(_userhistory);
    }
示例#3
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        DataClassesDataContext dataContext = new DataClassesDataContext();

        string aan = Users.getUserByUserName(HttpContext.Current.User.Identity.Name).AAN;
        var    _alreadyRequested = from _requested in dataContext.tblChangeRequests where _requested.AAN == aan select _requested;

        if (_alreadyRequested.FirstOrDefault() != null)
        {
            empty();
            lblmessage.Text    = "You have already submitted request!";
            lblmessage.Visible = true;
            return;
        }

        tblChangeRequest changeRequest = new tblChangeRequest();

        changeRequest.AAN             = aan;
        changeRequest.FirstPerference = drpFirstPerference.SelectedValue;
        if (drpsecondPerference.SelectedValue == "-1")
        {
            changeRequest.SecondPerference = string.Empty;
        }
        else
        {
            changeRequest.SecondPerference = drpsecondPerference.SelectedValue;
        }
        if (drpThirdPerference.SelectedValue == "-1")
        {
            changeRequest.ThirdPerference = string.Empty;
        }
        else
        {
            changeRequest.ThirdPerference = drpThirdPerference.SelectedValue;
        }
        //changeRequest.SecondPerference = drpsecondPerference.SelectedValue;
        //changeRequest.ThirdPerference = drpThirdPerference.SelectedValue;
        changeRequest.QuarterCategory  = Convert.ToInt32(drpQuarterCategory.SelectedValue);
        changeRequest.QuarterNumber    = drpAllotedQuarter.SelectedValue;
        changeRequest.Name             = txtUsername.Text;
        changeRequest.dateofsubmission = DateTime.Now;
        dataContext.tblChangeRequests.InsertOnSubmit(changeRequest);
        dataContext.SubmitChanges();
        empty();
        lblmessage.Text    = "Information has been saved sucessfully!";
        lblmessage.Visible = true;
    }
示例#4
0
    private void BindRequestData()
    {
        DataClassesDataContext datacontext = new DataClassesDataContext();
        var changeReuest          = from request in datacontext.tblChangeRequests where request.Id == changeReuestId select request;
        tblChangeRequest _request = changeReuest.FirstOrDefault();
        tblUser          user     = Users.getUserByAAN(_request.AAN);

        drpOffice.SelectedValue           = user.BaseOfficeId.ToString();
        drpQuarterCatergory.SelectedValue = _request.QuarterCategory.ToString();
        if (user.DateOfRetirement.HasValue)
        {
            txtDor.Text = user.DateOfRetirement.Value.ToShortDateString();
        }
        if (user.DateOfJoining.HasValue)
        {
            txtDoj.Text = user.DateOfJoining.Value.ToShortDateString();
        }
        txtAllotteeName.Text = user.AAN;
        bindQuarter();
        drpQuarterCatergory.Enabled = false;
        drpOffice.Enabled           = false;
        drpDesignation.Enabled      = false;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //Save change request
        DataClassesDataContext dataContext = new DataClassesDataContext();

        string aan = Users.getUserByUserName(HttpContext.Current.User.Identity.Name).AAN;
        var    _alreadyRequested = from _requested in dataContext.tblChangeRequests where _requested.AAN == aan select _requested;

        if (_alreadyRequested.FirstOrDefault() != null)
        {
            lblStatus.Text = "You have already submitted a change request!";
            return;
        }

        string firstPreferrence = string.Empty;
        string secondPreference = string.Empty;
        string thirdPreference  = string.Empty;

        foreach (GridViewRow row in grdQuarters.Rows)
        {
            RadioButton radPriority1 = row.FindControl("radPriority1") as RadioButton;
            RadioButton radPriority2 = row.FindControl("radPriority2") as RadioButton;
            RadioButton radPriority3 = row.FindControl("radPriority3") as RadioButton;

            if (firstPreferrence == string.Empty && radPriority1.Checked)
            {
                firstPreferrence = ((Label)row.FindControl("lblQuarterNumber")).Text;
            }

            if (secondPreference == string.Empty && radPriority2.Checked)
            {
                secondPreference = ((Label)row.FindControl("lblQuarterNumber")).Text;
            }

            if (thirdPreference == string.Empty && radPriority3.Checked)
            {
                thirdPreference = ((Label)row.FindControl("lblQuarterNumber")).Text;
            }
        }

        if (string.IsNullOrEmpty(firstPreferrence) &&
            string.IsNullOrEmpty(secondPreference) &&
            string.IsNullOrEmpty(thirdPreference))
        {
            lblStatus.Text = "Please select a valid preference.";
            return;
        }

        tblChangeRequest changeRequest = new tblChangeRequest();

        changeRequest.AAN             = aan;
        changeRequest.FirstPerference = firstPreferrence;
        if (string.IsNullOrEmpty(secondPreference))
        {
            changeRequest.SecondPerference = string.Empty;
        }
        else
        {
            changeRequest.SecondPerference = secondPreference;
        }
        if (string.IsNullOrEmpty(thirdPreference))
        {
            changeRequest.ThirdPerference = string.Empty;
        }
        else
        {
            changeRequest.ThirdPerference = thirdPreference;
        }

        changeRequest.QuarterCategory  = Convert.ToInt32(categoryId);
        changeRequest.QuarterNumber    = lblAllottedQuarter.Text;
        changeRequest.Name             = lblFullname.Text;
        changeRequest.dateofsubmission = DateTime.Now;
        dataContext.tblChangeRequests.InsertOnSubmit(changeRequest);
        dataContext.SubmitChanges();

        Response.Redirect("~/user/confirmation.aspx");
    }
示例#6
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (chkDeclaration.Checked == true)
        {
            validatedeclaration.Visible = false;
            tbAllotmentApplication application;
            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.GetApplication(applicationid);
                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.MedicalCategory    = Convert.ToInt32(ddlMedicalCategory.SelectedValue);
            application.OtherQuarterNumber = drpAllotedQuarter.SelectedValue;
            application.JobType            = Convert.ToInt32(drpJobType.SelectedValue);
            application.Sex = Convert.ToInt32(drpSex.SelectedValue);
            //application.Status = 0;
            application.ContactNumber = txtContactNumber.Text;
            //if (applicationid <= 0)
            {
                //application.Userid = Users.getUserByUserName(HttpContext.Current.User.Identity.Name).Id;
                tblUser user = Users.getUser(application.Userid.Value);

                //user.Username = txtUsername.Text;
                user.EmailID      = txtEmailAddress.Text;
                user.fullName     = txtUsername.Text;
                user.BaseOfficeId = Convert.ToInt32(drpOffice.SelectedValue);
                user.Roleid       = 4;//by default viewer role
                user.designation  = Convert.ToInt64(drpdesignations.SelectedValue);
                user.EmployeeCode = txtPUCDACode.Text;
                user.AadharNumber = txtAadharNumber.Text.Trim();
                user.PanNumber    = txtPAN.Text.Trim();

                //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;
                Users.SaveUser(user);
            }
            //else
            //{

            //}
            application.Cast       = drpcategory.SelectedItem.Text;
            application.IsSublet   = isSubletTrue.Checked;
            application.IsDebarred = isDebarred.Checked;

            //int quarterCategoryId = Convert.ToInt32(drpQuarterCategory.SelectedValue);
            long quarterCategoryId = GradePay.GetQuarterCategoryByGradePay(Convert.ToInt32(drpGradePay.SelectedValue));

            if (application.QuarterCategory != quarterCategoryId) //Previous category is different than the new one
            {
                //Put status of the application under pending state again, to be reviewed further
                application.Status = 0;

                //Delete the change requests taken by the user if any to changerequested state
                //And when user category is changed
                tblUser          user                  = Users.getUser(application.Userid.Value);
                var              dataContext           = new DataClassesDataContext();
                tblChangeRequest changeRequestToUpdate = dataContext.tblChangeRequests
                                                         .Where(x => x.AAN.ToLower() == user.AAN.ToLower() &&
                                                                (x.Status == (int)ChangeRequestStatus.Pending ||
                                                                 x.Status == (int)ChangeRequestStatus.Approved)).FirstOrDefault();

                if (changeRequestToUpdate != null)
                {
                    //changeRequestToUpdate.Status = (int)ChangeRequestStatus.Done;
                    changeRequestToUpdate.Status = (int)ChangeRequestStatus.Pending;

                    //dataContext.tblChangeRequests.DeleteOnSubmit(changeRequestToDelete);
                    dataContext.SubmitChanges();
                }
            }

            application.QuarterCategory = quarterCategoryId;
            if (isDebarred.Checked)
            {
                DateTime.TryParse(txtDebaredDate.Text, out DateOfDebared);
                application.DebarredDate = DateOfDebared;
            }
            application.IsOtherAccomendation = isauditpooyes.Checked;
            if (isauditpooyes.Checked)
            {
                application.OtherAllotteName    = txtAuditAllotteName.Text;
                application.OtherQuarterAddress = txtAuditAddress.Text;
                application.OtherQuarterType    = Convert.ToInt32(txtQuartertype.SelectedValue);
                application.OtherQuarterNumber  = drpAllotedQuarter.SelectedValue;
            }

            if (!IsQuarterCategoryActive(quarterCategoryId))
            {
                lblmessage.Text    = "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;
            if (!string.IsNullOrEmpty(Request["returnurl"]))
            {
                Response.Redirect("~/" + Request["returnurl"]);
            }
            else
            {
                Response.Redirect("~/user/Confirmation.aspx");
            }
        }
        else
        {
            validatedeclaration.Visible = true;
        }
    }