Exemple #1
0
    private void possession()
    {
        long id;

        Int64.TryParse(hdnSelected.Value, out id);
        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);
        }

        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);
    }
Exemple #2
0
 protected void GridRowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Verify")
     {
         long id;
         Int64.TryParse(e.CommandArgument.ToString(), out id);
         Response.Redirect(string.Format("~/user/submission.aspx?applicationid={0}&returnurl=admin/verification.aspx&verify=true", id));
     }
     if (e.CommandName == "view")
     {
         long id;
         Int64.TryParse(e.CommandArgument.ToString(), out id);
         Response.Redirect(string.Format("~/user/submission.aspx?applicationid={0}&returnurl=admin/verification.aspx", id));
     }
     if (e.CommandName == "reject")
     {
         long id;
         Int64.TryParse(e.CommandArgument.ToString(), out id);
         tbAllotmentApplication application = AllotementApplications.GetApplication(id);
         application.Status = (int)ApplicationStatus.rejected;
         AllotementApplications.SaveApplications(application);
         lblMessage.Text    = "Application has been rejected sucessfully!";
         lblMessage.Visible = true;
         BindData();
     }
 }
    protected void GridRowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Verify")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            Response.Redirect(string.Format("~/user/submission.aspx?applicationid={0}&returnurl=admin/verification.aspx&verify=true", id));
        }
        if (e.CommandName == "view")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);

            tblUser _user = Users.getUserByUserName(HttpContext.Current.User.Identity.Name);
            //or Admin is viewing the application,application is pending, allow user through this step
            if (AllotementApplications.GetApplication(id).Status == 0 || _user.Roleid == 1)
            {
                Response.Redirect(string.Format("~/user/submission.aspx?applicationid={0}&returnurl=user/application.aspx", id));
            }
            else
            {
                Response.Redirect(string.Format("~/user/processapplication.aspx?applicationId={0}", id));
            }
        }
    }
Exemple #4
0
 public void grdAllotte_command(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "vacant")
     {
         long id = Convert.ToInt64(e.CommandArgument);
         hdnselected.Value = id.ToString();
         //Allottee.VacantAllottement(id);
         //BindData();
         //tbluserhistory _userhistory = new tbluserhistory();
         //_userhistory.Action = "Allotement";
         //_userhistory.description = _user.Username + " has marked vacant with id " + id;
         //_userhistory.time = DateTime.Now;
         //_userhistory.useraan = _user.AAN;
         //userHistory.Save(_userhistory);
         tblAllottee _allotte = Allottee.GetAllottee(Convert.ToInt64(e.CommandArgument));
         txtName.Text          = AllotementApplications.GetApplication(_allotte.ApplicationId.Value).tblUser.fullName;
         txtQuarternumber.Text = _allotte.QuarterNumber;
         popVacant.Show();
     }
     else if (e.CommandName == "Retention")
     {
         long        id       = Convert.ToInt64(e.CommandArgument);
         tblAllottee _allotte = Allottee.GetAllottee(Convert.ToInt64(e.CommandArgument));
         txtRetName.Text                  = AllotementApplications.GetApplication(_allotte.ApplicationId.Value).tblUser.fullName;
         txtRetQuarerNumber.Text          = _allotte.QuarterNumber;
         txtDateOfRetension.Text          = string.Empty;
         txtdateofretensionupto.Text      = string.Empty;
         txtRemarks.Text                  = string.Empty;
         ddlRetentionPeriod.SelectedIndex = -1;
         ddlRetentionRule.SelectedIndex   = -1;
         hdnselected.Value                = id.ToString();
         ModalPopupExtender1.Show();
     }
 }
Exemple #5
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();
        }
    }
Exemple #6
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);
    }
Exemple #7
0
    private void BindData()
    {
        List <AllotementApplication> lstAllotmentApplications = AllotementApplications.GetAllotedUsers(ApplicationStatus.Allotted, Convert.ToInt64(drpQuarterCatergory.SelectedValue));

        if (lstAllotmentApplications != null)
        {
            lstAllotmentApplications = lstAllotmentApplications.OrderBy(x => x.UserName).ToList(); //Order by
        }
        grdQuarters.DataSource = lstAllotmentApplications;
        grdQuarters.DataBind();
    }
Exemple #8
0
    private void BindPriorityListGrid()
    {
        List <AllotementApplication> lstAllottmentApplication = AllotementApplications.GetPendingApplications(ApplicationStatus.Verified, Convert.ToInt64(drpQuarterCatergory.SelectedValue));
        //lstAllottmentApplication = lstAllottmentApplication.OrderBy(x => x.UserName).ToList(); //Order by name

        long floor = 2; //First floor

        if (!string.IsNullOrEmpty(Request["type"]) && Convert.ToString(Request["type"]) == "medical")
        {
            floor = 1; //Ground floor
        }

        List <Quarerinfo> lstQuarterInfo = Quarters.GetAllVacantQuarters(Convert.ToInt64(drpQuarterCatergory.SelectedValue));

        if (floor == 2)
        {
            lstQuarterInfo = lstQuarterInfo.Where(quarter => quarter.QuarterNumber.Contains('A') ||
                                                  quarter.QuarterNumber.Contains('B') ||
                                                  quarter.QuarterNumber.Contains('C') ||
                                                  quarter.QuarterNumber.Contains('D')).ToList();
        }
        else if (floor == 1)
        {
            lstQuarterInfo = lstQuarterInfo.Where(quarter => !(quarter.QuarterNumber.Contains('A') ||
                                                               quarter.QuarterNumber.Contains('B') ||
                                                               quarter.QuarterNumber.Contains('C') ||
                                                               quarter.QuarterNumber.Contains('D'))).ToList();

            if (lstAllottmentApplication != null)
            {
                //Filter allotment applications as per medical conditions
                lstAllottmentApplication = lstAllottmentApplication.Where(x => x.MedicalCategory).ToList();
            }
        }

        lstQuarterInfo = lstQuarterInfo.Take(lstAllottmentApplication.Count).ToList(); //Taking as many records there

        int totalApplications = Math.Min(lstAllottmentApplication.Count, lstQuarterInfo.Count);

        for (int count = 0; count < totalApplications; count++)
        {
            string quarterNumber = "N/A";
            if (lstQuarterInfo.Any() && lstQuarterInfo[count] != null && !string.IsNullOrEmpty(lstQuarterInfo[count].QuarterNumber))
            {
                quarterNumber = lstQuarterInfo[count].QuarterNumber;
            }
            lstAllottmentApplication[count].QuarterNumber = quarterNumber;
        }

        grdQuarters.DataSource = lstAllottmentApplication;
        grdQuarters.DataBind();
    }
Exemple #9
0
 private void bindAAN()
 {
     if (applicationid <= 0)
     {
         tblUser _usr = Users.getUserByUserName(HttpContext.Current.User.Identity.Name);
         txtAAN.Text      = _usr.AAN;
         txtUsername.Text = _usr.fullName;
     }
     else
     {
         txtAAN.Text = AllotementApplications.GetApplication(applicationid).tblUser.AAN;
     }
 }
    private void BindApplicationData()
    {
        tbAllotmentApplication appication = AllotementApplications.GetApplication(applicationid);
        tblUser user = Users.getUserByAAN(appication.tblUser.AAN);

        drpOffice.SelectedValue           = user.BaseOfficeId.ToString();
        drpQuarterCatergory.SelectedValue = appication.QuarterCategory.ToString();
        txtDor.Text          = user.DateOfRetirement.Value.ToShortDateString();
        txtDoj.Text          = user.DateOfJoining.Value.ToShortDateString();
        txtAllotteeName.Text = user.AAN;
        bindQuarter();
        drpQuarterCatergory.Enabled = false;
        drpOffice.Enabled           = false;
        drpDesignation.Enabled      = false;
    }
Exemple #11
0
    private void BindData()
    {
        tblUser _user = Users.getUserByUserName(HttpContext.Current.User.Identity.Name);

        if (_user.tblRole.name.ToLower().Contains("entry"))
        {
            grdQuarters.DataSource = AllotementApplications.GetPendingApplications(ApplicationStatus.Pending, _user.BaseOfficeId.Value);
            grdQuarters.DataBind();
        }
        else
        {
            grdQuarters.DataSource = AllotementApplications.GetPendingApplications(ApplicationStatus.Pending);
            grdQuarters.DataBind();
        }
    }
Exemple #12
0
 private void bindAAN()
 {
     if (applicationid <= 0)
     {
         /*tblUser _usr = Users.getUserByUserName(HttpContext.Current.User.Identity.Name);
          * txtAAN.Text = _usr.AAN;
          * txtUsername.Text = _usr.fullName;
          * if (_usr.BaseOfficeId.HasValue)
          *  drpOffice.SelectedValue = _usr.BaseOfficeId.Value.ToString();
          * if (_usr.designation.HasValue)
          *  drpdesignations.SelectedValue = _usr.designation.Value.ToString();*/
     }
     else
     {
         txtAAN.Text = AllotementApplications.GetApplication(applicationid).tblUser.AAN;
     }
 }
    protected void btnApplyNew_Click(object sender, EventArgs e)
    {
        tbAllotmentApplication application = AllotementApplications.GetApplication(Convert.ToInt64(applicationId));

        if (application.Status == (int)ApplicationStatus.Verified)
        {
            lblStatus.Text = "You have already applied for the new allotment application, and your application is under process.";
        }
        else if (application.Status == (int)ApplicationStatus.Pending ||
                 application.Status == (int)ApplicationStatus.withdraw) //added on 30.12.2016 as per request from amrinder
        {
            //Change application status to verified
            AllotementApplications.UpdateApplicationStaus(Convert.ToInt64(applicationId), ApplicationStatus.Verified);
            lblStatus.Text = "Your application request is processed further, thanks for your application";
            Response.Redirect("~/user/confirmation.aspx");
        }
    }
    private void BindData()
    {
        tblUser _user = Users.getUserByUserName(HttpContext.Current.User.Identity.Name);

        if (_user.Roleid == 1) //Admin
        {
            lblStatus.Text    = "User applications";
            pnlSearch.Visible = true;
        }

        if (pnlSearch.Visible)
        {
            _user.AAN = txtSearch.Text.Trim();
        }

        grdQuarters.DataSource = AllotementApplications.GetApplicationsByAAn(_user.AAN);
        grdQuarters.DataBind();
    }
Exemple #15
0
    protected void gridCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Allotte")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            // AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);
            Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "Possesed")
        {
            hdnSelected.Value = e.CommandArgument.ToString();
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(Convert.ToInt64(e.CommandArgument));
            txtName.Text          = AllotementApplications.GetApplication(Convert.ToInt64(e.CommandArgument)).tblUser.fullName;
            txtQuarternumber.Text = _allotte.QuarterNumber;

            pop.Show();
        }
        else if (e.CommandName == "Withdraw")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            Allottee.UpdateAllottementStatus(id, AllotementStatus.withdraw);
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(id);
            if (_allotte != null)
            {
                long quarterid = _allotte.tblQuarter.Id;
                _allotte.Status         = (int)AllotementStatus.withdraw;
                _allotte.DateOfwithdraw = DateTime.Now;
                Allottee.Update(_allotte);

                Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, QuarterStatus.Vacant);
            }
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Withdraw";
            _userhistory.description = _user.Username + " has marked Withdraw application with " + id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
            // Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "CancelApplication")
        {
            //Move quarter to vacant list
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.rejected);
            Allottee.UpdateAllottementStatus(id, AllotementStatus.vacant);
            tblAllottee _allotte = Allottee.getAllotteByApplicationid(id);
            if (_allotte != null)
            {
                long quarterid = _allotte.tblQuarter.Id;
                _allotte.Status         = (int)AllotementStatus.vacant;
                _allotte.DateOfVacation = DateTime.Now;
                Allottee.Update(_allotte);

                Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, QuarterStatus.Vacant);
            }
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Cancel";
            _userhistory.description = _user.Username + " has marked cancel application with " + id;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);
        }
        BindData();
        //DataNavigateUrlFormatString="~/admin/Allottee.aspx?Applicationid={0}&returnurl=admin/Prioritizeapplications.aspx"
    }
 private void BindData()
 {
     grdQuarters.DataSource = AllotementApplications.GetPendingApplications(ApplicationStatus.Verified, Convert.ToInt64(drpQuarterCatergory.SelectedValue));
     grdQuarters.DataBind();
 }
Exemple #17
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;
        }
    }
Exemple #18
0
    protected void gridCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Allotte")
        {
            long   id;
            string aan           = string.Empty;
            string quarterNumber = string.Empty;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);

            tblAllottee _Allottee = null;
            //if (id > 0)
            //{
            //  _Allottee = Allottee.GetAllottee(id);
            //}
            //else
            //{
            var gridRow = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;

            var hidAAN = gridRow.FindControl("hidAAN") as HiddenField;
            aan = hidAAN.Value;
            tblAllottee a = Allottee.GetAllotteeByAAN(aan);

            if (a != null)
            {
                //lblMessage.Text = "User has already allotted quarter!";
                //lblMessage.Visible = true;
                //return;
                _Allottee = a;
            }
            else
            {
                _Allottee = new tblAllottee();
            }
            Label lblQuarterNumber = gridRow.FindControl("lblQuarterNumber") as Label;
            quarterNumber = lblQuarterNumber.Text;

            tblQuarter quarter = Quarters.GetQuarter(quarterNumber);
            if (quarter == null)
            {
                lblMessage.Text    = "Quarter number selected is not valid";
                lblMessage.Visible = true;
                return;
            }
            else if (quarter.Status.HasValue && quarter.Status != (int)QuarterStatus.Vacant)
            {
                lblMessage.Text    = "Quarter is not vacant!";
                lblMessage.Visible = true;
                return;
            }
            quarter.DateOfAllottement = DateTime.Now;
            quarter.Status            = (int)QuarterStatus.Alloted;
            Quarters.Save(quarter);

            //_Allottee = new tblAllottee();

            //}
            _Allottee.QuarterNumber    = quarterNumber;
            _Allottee.AAN              = aan;
            _Allottee.ApplicationId    = id;
            _Allottee.Status           = (int)AllotementStatus.Allotted;
            _Allottee.DateOfAllotement = DateTime.Now;
            //_Allottee.OfficeId = Convert.ToInt32(drpOffice.SelectedValue);
            //_Allottee.Designation =Convert.ToInt32( drpDesignation.SelectedValue);
            //_Allottee.DateOfJoining = Convert.ToDateTime(txtDoj.Text);
            //_Allottee.DateOfRetirement = Convert.ToDateTime(txtDor.Text);
            //_Allottee.Name = txtAllotteeName.Text;
            tbluserhistory _userhistory = new tbluserhistory();
            _userhistory.Action      = "Allotement";
            _userhistory.description = _user.Username + " has allotted quarter " + _Allottee.QuarterNumber + " to user " + _Allottee.AAN;
            _userhistory.time        = DateTime.Now;
            _userhistory.useraan     = _user.AAN;
            userHistory.Save(_userhistory);

            Allottee.Save(_Allottee);
            if (id > 0)
            {
                AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Allotted);

                try
                {
                    //SEND SMS
                    new IntegratedMessageSender().SendMessage("QUARTER_ALLOTTED", _Allottee.QuarterNumber, AllotementApplications.GetApplicationByAAN(aan).ContactNumber);
                }
                catch (Exception)
                {
                    throw;
                }
            }

            BindData();

            ///Response.Redirect("~/admin/Allottee.aspx?Applicationid="+id+"&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "Withdraw")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            BindData();
            // AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.Pos);
        }
        else if (e.CommandName == "Allotte")
        {
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx");
        }
        else if (e.CommandName == "AllotteManual")
        {
            //Manual allocation
            long id;
            Int64.TryParse(e.CommandArgument.ToString(), out id);
            //AllotementApplications.UpdateApplicationStaus(id, ApplicationStatus.withdraw);
            Response.Redirect("~/admin/Allottee.aspx?Applicationid=" + id + "&returnurl=admin/Prioritizeapplications.aspx?selectedCategory=" + drpQuarterCatergory.SelectedValue);
        }
        //DataNavigateUrlFormatString="~/admin/Allottee.aspx?Applicationid={0}&returnurl=admin/Prioritizeapplications.aspx"
    }
Exemple #19
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;
        }
    }
Exemple #20
0
    private void BindApplicationData()
    {
        tbAllotmentApplication application = AllotementApplications.GetApplication(applicationid);

        if (application != null)
        {
            //DateTime DateOfBirth, DateOfjoining, DateOfDebared, dateofret;
            //DateTime.TryParse(txtDob.Text, out DateOfBirth);
            //DateTime.TryParse(txtEmployedfrom.Text, out DateOfjoining);
            //DateTime.TryParse(txtDateOfRetirement.Text, out dateofret);
            drpGradePay.SelectedValue = application.GradePay;
            txtUsername.Text          = application.Name;

            if (application.Designation.HasValue)
            {
                drpdesignations.SelectedValue = application.Designation.Value.ToString();
            }
            if (application.OfficeId.HasValue)
            {
                drpOffice.SelectedValue = application.OfficeId.Value.ToString();
            }
            txtAuditAddress.Text            = application.OtherQuarterAddress;
            txtQuartertype.SelectedValue    = Convert.ToString(application.OtherQuarterType);
            drpAllotedQuarter.SelectedValue = application.OtherQuarterNumber;
            if (application.JobType.HasValue)
            {
                drpJobType.SelectedValue = application.JobType.Value.ToString();
            }
            drpSex.SelectedValue             = application.Sex.ToString();
            ddlMedicalCategory.SelectedValue = application.MedicalCategory.ToString();
            txtContactNumber.Text            = application.ContactNumber;
            //application.Status = 0;
            //application.Userid = Users.getUserByUserName(HttpContext.Current.User.Identity.Name).Id;

            tblUser _user = Users.getUser(application.Userid.Value);
            if (application.DateOfBirth.HasValue)
            {
                txtDob.Text = application.DateOfBirth.Value.ToShortDateString();
            }
            //txtPayBand.Text = application.QuarterNumber;
            foreach (ListItem ino in drpcategory.Items)
            {
                if (!string.IsNullOrEmpty(application.Cast) && ino.Text.ToLower() == application.Cast.ToLower())
                {
                    ino.Selected = true;
                }
            }
            if (_user.DateOfJoining.HasValue)
            {
                txtEmployedfrom.Text = _user.DateOfJoining.Value.ToShortDateString();
            }
            if (_user.DateOfRetirement.HasValue)
            {
                txtDateOfRetirement.Text = _user.DateOfRetirement.Value.ToShortDateString();
            }

            txtAAN.Text          = _user.AAN;
            txtEmailAddress.Text = _user.EmailID;
            txtPUCDACode.Text    = _user.EmployeeCode;
            txtAadharNumber.Text = _user.AadharNumber;
            txtPAN.Text          = _user.PanNumber;

            //_user.DateOfJoining = DateOfjoining;
            //_user.DateOfRetirement = dateofret;
            if (application.IsSublet.HasValue)
            {
                isSubletTrue.Checked = application.IsSublet.Value;
            }


            if (!isSubletTrue.Checked)
            {
                isSubletFalse.Checked = true;
            }
            if (application.IsDebarred.HasValue)
            {
                isDebarred.Checked = application.IsDebarred.Value;
            }
            if (application.QuarterCategory.HasValue)
            {
                drpQuarterCategory.SelectedValue = application.QuarterCategory.Value.ToString();
            }
            if (isDebarred.Checked)
            {
                if (application.DebarredDate.HasValue)
                {
                    txtDebaredDate.Text = application.DebarredDate.Value.ToShortDateString();
                }
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "showdebarred", "showbarredDate(1);", true);
            }
            else
            {
                isDebarredNO.Checked = true;
            }
            if (application.IsOtherAccomendation.HasValue)
            {
                isauditpooyes.Checked = application.IsOtherAccomendation.Value;
            }
            if (!isauditpooyes.Checked)
            {
                isauditpoono.Checked = true;
            }
            else
            {
                txtAuditAllotteName.Text        = application.OtherAllotteName;
                txtAuditAddress.Text            = application.OtherQuarterAddress;
                txtQuartertype.SelectedValue    = Convert.ToString(application.OtherQuarterType);
                drpAllotedQuarter.SelectedValue = application.OtherQuarterNumber;
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "showaudit", "showAudit(1);", true);
            }
            grdmembers.DataSource = Tblmemberinfo.GetMemberinfo(application.ID);
            grdmembers.DataBind();
        }
    }
Exemple #21
0
    private void BindApplicationData()
    {
        tbAllotmentApplication application = AllotementApplications.GetApplication(applicationid);

        if (application != null)
        {
            //DateTime DateOfBirth, DateOfjoining, DateOfDebared, dateofret;
            //DateTime.TryParse(txtDob.Text, out DateOfBirth);
            //DateTime.TryParse(txtEmployedfrom.Text, out DateOfjoining);
            //DateTime.TryParse(txtDateOfRetirement.Text, out dateofret);
            lblGradePay.Text = GradePay.GetPayGradesById(Convert.ToInt64(application.GradePay));
            txtUsername.Text = application.Name;

            if (application.Designation.HasValue)
            {
                lbldesignations.Text = Allottee.GetDesignationName(application.Designation.Value).ToString();
            }
            if (application.OfficeId.HasValue)
            {
                lblOffice.Text = Offices.GetOfficeName(application.OfficeId.Value).ToString();
            }
            txtAuditAddress.Text  = application.OtherQuarterAddress;
            txtQuartertype.Text   = application.OtherQuarterNumber;
            txtContactNumber.Text = application.ContactNumber;
            if (application.JobType.Value == 0)
            {
                drpJobType.Text = "Permanent";
            }
            else
            {
                drpJobType.Text = "Temporary";
            }
            if (application.Sex.Value == 0)
            {
                lblSex.Text = "Female";
            }
            else
            {
                lblSex.Text = "Male";
            }


            tblUser _user = Users.getUser(application.Userid.Value);
            if (application.DateOfBirth.HasValue)
            {
                txtDob.Text = application.DateOfBirth.Value.ToShortDateString();
            }
            lblcategory.Text = application.Cast;

            if (_user.DateOfJoining.HasValue)
            {
                txtEmployedfrom.Text = _user.DateOfJoining.Value.ToShortDateString();
            }
            if (_user.DateOfRetirement.HasValue)
            {
                txtDateOfRetirement.Text = _user.DateOfRetirement.Value.ToShortDateString();
            }
            //_user.DateOfJoining = DateOfjoining;
            //_user.DateOfRetirement = dateofret;
            if (application.IsSublet.HasValue)
            {
                isSubletTrue.Checked = application.IsSublet.Value;
            }


            if (!isSubletTrue.Checked)
            {
                lblSublet.Text        = "Yes";
                isSubletFalse.Checked = true;
            }
            else
            {
                lblSublet.Text = "No";
            }

            if (application.IsDebarred.HasValue)
            {
                isDebarred.Checked = application.IsDebarred.Value;
            }
            if (application.QuarterCategory.HasValue)
            {
                lblQuarterCategory.Text = Quarters.GetQuarterCategoryName(application.QuarterCategory.Value).ToString();
            }
            if (isDebarred.Checked)
            {
                lblDebarred.Text = "Yes";
                if (application.DebarredDate.HasValue)
                {
                    txtDebaredDate.Text = application.DebarredDate.Value.ToShortDateString();
                }
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "showdebarred", "showbarredDate(1);", true);
            }
            else
            {
                lblDebarred.Text     = "No";
                isDebarredNO.Checked = true;
            }
            if (application.IsOtherAccomendation.HasValue)
            {
                isauditpooyes.Checked = application.IsOtherAccomendation.Value;
            }
            if (!isauditpooyes.Checked)
            {
                lblauditpooyes.Text  = "No";
                isauditpoono.Checked = true;
            }
            else
            {
                lblauditpooyes.Text      = "Yes";
                txtAuditAllotteName.Text = application.OtherAllotteName;
                txtAuditAddress.Text     = application.OtherQuarterAddress;
                txtQuartertype.Text      = application.OtherQuarterNumber;
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "showaudit", "showAudit(1);", true);
            }
            grdmembers.DataSource = Tblmemberinfo.GetMemberinfo(application.ID);
            grdmembers.DataBind();
        }
    }
Exemple #22
0
 protected void btnverify_Click(object sender, EventArgs e)
 {
     AllotementApplications.UpdateApplicationStaus(applicationid, ApplicationStatus.Verified);
     Response.Redirect("~/" + Request["returnurl"]);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["applicationId"] == null)
        {
            Response.Redirect("~/user/application.aspx");
        }
        else if (Request["applicationId"] != null)
        {
            applicationId = Convert.ToString(Request["applicationId"]);
        }
        tbAllotmentApplication application = AllotementApplications.GetApplication(Convert.ToInt64(applicationId));

        categoryId = application.QuarterCategory.Value;

        if (!Page.IsPostBack)
        {
            tblUser user = Users.getUser(application.Userid.Value);

            DateTime?dt = null;
            //Check if user is debarred or deferred
            if (Users.IsUserDeferred(user.Id, out dt))
            {
                Response.Redirect("~/user/notallowed.aspx");
            }

            if (Users.IsUserDebarred(user.Id, out dt))
            {
                Response.Redirect("~/user/notallowed.aspx?debar=true");
            }


            lblFullname.Text        = user.fullName;
            lblDesignation.Text     = Users.GetUserDesignation(user.Id);
            lblAllottedQuarter.Text = "N/A";

            var allottee = Allottee.GetAllotteeByAAN(user.AAN);
            if (allottee != null && (allottee.Status.Value == ((int)AllotementStatus.Possessed) || allottee.Status.Value == ((int)AllotementStatus.ChangeRequested)))
            {
                string allottedQuarter = allottee.QuarterNumber;
                lblAllottedQuarter.Text = allottedQuarter;
            }

            if (application.QuarterCategory.HasValue && !Quarters.IsQuarterCategoryActive(application.QuarterCategory.Value))
            {
                submissionClosedPanel.Visible = true;
                return;
            }
            else
            {
                //Quarter category is active
                if (lblAllottedQuarter.Text == "N/A" || application.Status == (int)ApplicationStatus.Pending) //New allottment cases
                {
                    if (application.MedicalCategory.HasValue && application.MedicalCategory.Value >= 0)       //Medical grounds
                    {
                        applyForQuarterMedicalGroundsPanel.Visible = true;
                        btnNewAllottmentMedical.Enabled            = true;
                    }
                    else
                    {
                        applyForQuarterPanel.Visible = true;
                        btnNewAllottment.Enabled     = true;
                    }
                }
                else
                {
                    if (application.MedicalCategory.HasValue && application.MedicalCategory.Value >= 0) //Medical grounds
                    {
                        applyForQuarterMedicalGroundsPanel.Visible = true;
                        btnChangeRequestMedical.Enabled            = true;
                    }
                    else
                    {
                        applyForQuarterPanel.Visible = true;
                        btnChangeRequest.Enabled     = true;
                    }
                }

                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 &&
                                           (_requested.Status == (int)ChangeRequestStatus.Pending ||
                                            _requested.Status == (int)ChangeRequestStatus.Approved)
                                           select _requested;

                if (_alreadyRequested.FirstOrDefault() != null)
                {
                    var changeRequest = _alreadyRequested.FirstOrDefault();
                    pnlChangeRequestInformation.Visible = true;
                    btnChangeRequest.Enabled            = false;
                    btnChangeRequestMedical.Enabled     = false;

                    lblRequestID.Text        = changeRequest.Id.ToString();
                    lblFirstPreference.Text  = changeRequest.FirstPerference ?? "N/A";
                    lblSecondPreference.Text = changeRequest.SecondPerference ?? "N/A";
                    lblThirdPreference.Text  = changeRequest.ThirdPerference ?? "N/A";
                }
                else
                {
                    pnlChangeRequestInformation.Visible = false;
                }
            }
            BindData();
        }

        changeRequests            = new DataClassesDataContext().tblChangeRequests.ToList();
        grdQuarters.RowDataBound += new GridViewRowEventHandler(grdQuarters_RowDataBound);
    }
    protected void btnadd_Click(object sender, EventArgs e)
    {
        tblAllottee _Allottee = null;

        if (id > 0)
        {
            _Allottee = Allottee.GetAllottee(id);
        }
        else
        {
            tblAllottee a = Allottee.GetAllotteeByAAN(txtAllotteeName.Text);
            if (a != null)
            {
                _Allottee = a;
                //lblmessage.Text = "User has already allotted quarter!";
                //lblmessage.Visible = true;
                //return;
            }

            if (a == null)
            {
                _Allottee = new tblAllottee();
            }

            tblQuarter quarter = Quarters.GetQuarter(drpQuarter.SelectedValue);
            if (quarter == null)
            {
                lblmessage.Text    = "Please enter valid number";
                lblmessage.Visible = true;
                return;
            }
            else if (quarter.Status.HasValue && quarter.Status != (int)QuarterStatus.Vacant)
            {
                lblmessage.Text    = "Quarter is not vacant!";
                lblmessage.Visible = true;
                return;
            }
            quarter.DateOfAllottement = DateTime.Now;
            quarter.Status            = (int)QuarterStatus.Alloted;
            Quarters.Save(quarter);

            //_Allottee = new tblAllottee();
        }
        _Allottee.QuarterNumber    = drpQuarter.SelectedValue;
        _Allottee.AAN              = txtAllotteeName.Text;
        _Allottee.ApplicationId    = applicationid;
        _Allottee.Status           = btnAddUpdate.Text == "Add Change Request" ? (int)AllotementStatus.ChangeRequested : (int)AllotementStatus.Possessed;
        _Allottee.DateOfAllotement = DateTime.Now;
        //_Allottee.OfficeId = Convert.ToInt32(drpOffice.SelectedValue);
        //_Allottee.Designation =Convert.ToInt32( drpDesignation.SelectedValue);
        //_Allottee.DateOfJoining = Convert.ToDateTime(txtDoj.Text);
        //_Allottee.DateOfRetirement = Convert.ToDateTime(txtDor.Text);
        //_Allottee.Name = txtAllotteeName.Text;
        tbluserhistory _userhistory = new tbluserhistory();

        _userhistory.Action      = "Allotement";
        _userhistory.description = _user.Username + " has allotted quarter " + _Allottee.QuarterNumber + " to user " + _Allottee.AAN;
        _userhistory.time        = DateTime.Now;
        _userhistory.useraan     = _user.AAN;
        userHistory.Save(_userhistory);

        Allottee.Save(_Allottee);
        if (applicationid > 0)
        {
            AllotementApplications.UpdateApplicationStaus(applicationid, btnAddUpdate.Text == "Add Change Request" ? ApplicationStatus.ChangeRequested : ApplicationStatus.Allotted);
        }
        if (!string.IsNullOrEmpty(Request["returnurl"]))
        {
            Response.Redirect("~/" + Request["returnurl"]);
        }
        else
        {
            Response.Redirect("~/admin/Allottees.aspx");
        }
    }