protected void btnadd_Click(object sender, EventArgs e) { tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text); if (_allotte != null) { decimal charge = 0; decimal.TryParse(txtDamageCharge.Text, out charge); tbquarterDamage quarterDamage = new tbquarterDamage(); quarterDamage.AAN = _allotte.AAN; quarterDamage.DamageCharges = charge; quarterDamage.Assementdate = Convert.ToDateTime(txtMonth.Text); quarterDamage.Quarternumber = _allotte.tblQuarter.QuarterNumber; quarterDamage.Remarks = txtRemarks.Text; Quarters.AddQuarterDamage(quarterDamage); lblmessage.Text = "Information saved sucessfully!"; lblmessage.Visible = true; empty(); tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Licence fee"; _userhistory.description = _user.Username + " has added quarter damage charges for quarter " + _allotte.tblQuarter.QuarterNumber; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else { lblmessage.Text = "This quarter is not allotted to anyone yet"; lblmessage.Visible = true; } }
public void btnSaveRetension_click(object sender, EventArgs e) { long id = Convert.ToInt64(hdnselected.Value); tblAllottee _allotte = Allottee.GetAllottee(id); if (_allotte != null) { DateTime dateofRetension; DateTime.TryParse(txtDateOfRetension.Text, out dateofRetension); DateTime dateofRetensionupto; DateTime.TryParse(txtdateofretensionupto.Text, out dateofRetensionupto); _allotte.DateOfRetensionUpto = dateofRetensionupto; _allotte.Status = (int)AllotementStatus.Retension; _allotte.DateOfRetension = dateofRetension; _allotte.RetentionReason = ddlRetentionRule.SelectedValue; Allottee.Update(_allotte); BindData(); Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, QuarterStatus.Vacant); 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); } }
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(); } }
private void BindData() { tblAllottee quarter = Allottee.GetAllottee(id); if (quarter != null) { // //drpDesignation.SelectedValue = quarter.Designation.ToString(); tblUser user = Users.getUserByAAN(quarter.AAN); drpQuarterCatergory.SelectedValue = quarter.tblQuarter.Category.ToString(); drpOffice.SelectedValue = user.BaseOfficeId.ToString(); txtAllotteeName.Text = user.AAN; if (user.DateOfRetirement.HasValue) { txtDor.Text = user.DateOfRetirement.Value.ToShortDateString(); } if (user.DateOfJoining.HasValue) { txtDoj.Text = user.DateOfJoining.Value.ToShortDateString(); } bindQuarter(); drpQuarter.SelectedValue = quarter.QuarterNumber; drpQuarterCatergory.Enabled = false; drpOffice.Enabled = false; drpDesignation.Enabled = false; } }
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); }
protected void btnadd_Click(object sender, EventArgs e) { tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text); if (_allotte != null) { tbQuarterLicenceFee fee = new tbQuarterLicenceFee(); fee.AAN = _allotte.AAN; fee.ActualFee = 0; fee.Fee = Convert.ToDecimal(txtLicenceFee.Text); fee.Month = Convert.ToDateTime(txtMonth.Text); fee.QuarterId = _allotte.tblQuarter.Id; fee.ActualFee = LicenceFee.GetLicenceFeebyCategory(_allotte.tblQuarter.Category); fee.Remarks = txtRemarks.Text; LicenceFee.SaveMonthLicencefee(fee); lblmessage.Text = "Information saved sucessfully!"; lblmessage.Visible = true; empty(); tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Licence fee"; _userhistory.description = _user.Username + " has added Licence fee for quarter " + _allotte.tblQuarter.QuarterNumber; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else { lblmessage.Text = "This quarter is not allotted to anyone yet"; lblmessage.Visible = true; } }
protected void QuarterNumber_change(object sender, EventArgs e) { tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text); if (_allotte != null) { tblUser _user = Users.getUserByAAN(_allotte.AAN); if (_user.designation.HasValue) { drpDesignation.SelectedValue = _user.designation.Value.ToString(); } if (_user.BaseOfficeId.HasValue) { drpOffice.SelectedValue = _user.BaseOfficeId.Value.ToString(); } txtAllotteeAAN.Text = _allotte.AAN; txtUserName.Text = _user.fullName; drpQuarterCatergory.SelectedValue = _allotte.tblQuarter.tblQuarterCategory.Id.ToString(); tblQuarterCategoryFee fee = LicenceFee.GetQuarterCategeryFee(_allotte.tblQuarter.tblQuarterCategory.Id); if (fee != null && fee.LicenceFee.HasValue) { txtLicenceFee.Text = fee.LicenceFee.Value.ToString(); } } else { lblmessage.Text = "This quarter is not allotted to anyone yet"; lblmessage.Visible = true; btnAddUpdate.Enabled = false; } }
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(); } }
private void Intilize() { drpDesignation.DataSource = Allottee.GetDesignations(); drpDesignation.DataBind(); drpOffice.DataSource = Offices.GetAlloffices(); drpOffice.DataBind(); drpQuarterCatergory.DataSource = Quarters.GetQuarterCategory(); drpQuarterCatergory.DataBind(); }
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); }
protected void btnadd_Click(object sender, EventArgs e) { tblQuarter _quarter = Quarters.GetQuarter(txtQuarterNumber.Text); if (_quarter != null) { pnl.Visible = true; drpQuarterCatergory.SelectedValue = _quarter.tblQuarterCategory.Id.ToString(); grdLicenceFee.DataSource = LicenceFee.GetLicencefee(txtQuarterNumber.Text); grdLicenceFee.DataBind(); } else { lblmessage.Text = "Invalid quarter"; lblmessage.Visible = true; return; } tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text); if (_allotte != null) { tblUser _user = Users.getUserByAAN(_allotte.AAN); if (_user.designation.HasValue) { drpDesignation.SelectedValue = _user.designation.Value.ToString(); } if (_user.BaseOfficeId.HasValue) { drpOffice.SelectedValue = _user.BaseOfficeId.Value.ToString(); } txtAllotteName.Text = _user.fullName; txtAllotteeAAN.Text = _allotte.AAN; if (_allotte.DateOfPossession.HasValue) { txtDateOfPossession.Text = _allotte.DateOfPossession.Value.ToShortDateString(); } if (_allotte.DateOfVacation.HasValue) { txtActualDateOfVacation.Text = _allotte.DateOfVacation.Value.ToShortDateString(); } if (_allotte.DateOfRetension.HasValue) { txtDueDateOfVacation.Text = _allotte.DateOfRetension.Value.AddMonths(8).ToShortDateString(); } txtRetentionPeriod.Text = "8"; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Licence fee"; _userhistory.description = _user.Username + " has added Licence fee for quarter " + _allotte.tblQuarter.QuarterNumber; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } }
protected void QuarterNumber_change(object sender, EventArgs e) { tblAllottee _allotte = Allottee.GetAllottee(txtQuarterNumber.Text); if (_allotte != null) { tblUser _user = Users.getUserByAAN(_allotte.AAN); txtAllotteeAAN.Text = _allotte.AAN; } else { lblmessage.Text = "This quarter is not allotted to anyone yet"; lblmessage.Visible = true; btnAddUpdate.Enabled = false; } }
protected void btnVacant_click(object sender, EventArgs e) { int id = Convert.ToInt32(hdnselected.Value); tblAllottee _allotte = Allottee.GetAllottee(id); if (_allotte != null) { DateTime dateofVacation; DateTime.TryParse(txtDateOfVacation.Text, out dateofVacation); _allotte.Status = (int)AllotementStatus.vacant; _allotte.DateOfVacation = dateofVacation; Allottee.Update(_allotte); BindData(); Quarters.UpdateQuarterStatus(_allotte.tblQuarter.Id, (int)QuarterStatus.Vacant, "Quarter marked as vacant.", txtDateOfVacation.Text); 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); } }
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); }
private void BindDesignation() { drpDesignation.DataSource = Allottee.GetDesignations(); drpDesignation.DataBind(); drpDesignation.Items.Insert(0, new ListItem("-select--", "-1")); }
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 = Allottee.GetRetentedAllotte(Convert.ToInt64(drpQuarterCatergory.SelectedValue)); grdQuarters.DataBind(); }
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" }
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"); } }
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(); } }