public static List <AllotementApplication> GetAllotedUsers(ApplicationStatus status, long categoryId) { DataClassesDataContext dataContext = new DataClassesDataContext(); var applications = dataContext.uspGetAllotedUsers(Convert.ToInt32(status), Convert.ToInt32(categoryId)); List <AllotementApplication> allotements = new List <AllotementApplication>(); foreach (var application in applications) { AllotementApplication obj = new AllotementApplication(); obj.Id = application.ID; obj.Status = (ApplicationStatus)application.Status; obj.AAN = application.AAN; obj.Dept = application.OfficeName; obj.AlreadyAllottedQuarter = application.OtherQuarterNumber; obj.GradePay = GradePay.GetPayGradesById(Convert.ToInt64(application.GradePay)); obj.Designation = application.DesignationName; obj.UserName = application.fullName; obj.QuarterType = application.QuarterCategoryName; obj.Cast = application.Cast; obj.QuarterNumber = application.QuarterNumber; obj.DateOfAllottment = application.DateOfAllotement.HasValue ? application.DateOfAllotement.Value : DateTime.Now; if (application.DateOfjoining.HasValue) { obj.dateOfJoining = application.DateOfjoining.Value; } allotements.Add(obj); } return(allotements); }
public static List <AllotementApplication> GetPendingAndVerifiedApplications(long categoryId) { DataClassesDataContext dataContext = new DataClassesDataContext(); var applications = (from application in dataContext.tbAllotmentApplications where (application.Status == Convert.ToInt32(ApplicationStatus.Verified) || application.Status == Convert.ToInt32(ApplicationStatus.Pending)) && application.QuarterCategory == categoryId select application).OrderBy(x => x.DateOfjoining); List <AllotementApplication> allotements = new List <AllotementApplication>(); foreach (var application in applications) { AllotementApplication obj = new AllotementApplication(); obj.Id = application.ID; obj.Status = (ApplicationStatus)application.Status; obj.AAN = application.tblUser.AAN; obj.Dept = application.tblOffice.Name; obj.AlreadyAllottedQuarter = application.OtherQuarterNumber; obj.GradePay = GradePay.GetPayGradesById(Convert.ToInt64(application.GradePay)); obj.Designation = application.tblDesignation.Name; obj.UserName = application.tblUser.fullName; obj.QuarterType = application.tblQuarterCategory.Name; obj.Cast = application.Cast; if (application.tblUser.DateOfJoining.HasValue) { obj.dateOfJoining = application.tblUser.DateOfJoining.Value; } allotements.Add(obj); } return(allotements); }
private void BindGradePay() { drpGradePay.SelectedIndex = -1; //drpGradePay.DataSource = GradePay.GetPayGradesByCategroy(Convert.ToInt64(drpQuarterCategory.SelectedValue)); drpGradePay.DataSource = GradePay.GetAllGradePays(); drpGradePay.DataBind(); drpGradePay.Items.Insert(0, new ListItem("-select--", "-1")); }
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(); } }
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; } }
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; } }