protected void btnadd_Click(object sender, EventArgs e) { string status = "saved"; if (id > 0) { _user = Users.getUser(id); status = "updated"; } else { if (Users.CheckEmail(txtEmailId.Text)) { lblMessage.Text = "Email address already exists!"; lblMessage.Visible = true; return; } if (Users.getUserByUserName(txtUsername.Text) != null) { lblMessage.Text = "User name already exists!"; lblMessage.Visible = true; return; } _user = new tblUser(); } _user.EmailID = txtEmailId.Text; _user.fullName = txtFullName.Text; _user.Username = txtUsername.Text; // _user.DateOfRetirement = Convert.ToDateTime(txtDob.Text).AddYears(60); //_user.DateOfJoining= Convert.ToDateTime(txtDob.Text ); // _user.Addressline1 = txtAddress.Text; if (id <= 0) { _user.Password = txtPassword.Text; } _user.BaseOfficeId = Convert.ToInt32(drpOffice.SelectedValue); _user.Roleid = Convert.ToInt32(drpRoles.SelectedValue); Users.SaveUser(_user); if (id <= 0) { tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User creation"; _userhistory.description = _user.Username + " has created user with userid " + _user.Id; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); string outstring; SendmailMessage.sendEmailMessage("*****@*****.**", _user.EmailID, "", "Account created", "Your account has been created sucessfully!", "", out outstring); } else { tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User creation"; _userhistory.description = _user.Username + " has updated user with userid " + _user.Id; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } Response.Redirect("~/admin/users.aspx?status=" + status); }
protected void 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; } }
protected void btnadd_Click(object sender, EventArgs e) { tblQuarter quarter; if (id > 0) { quarter = Quarters.GetQuarter(id); tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Quarter"; _userhistory.description = _user.Username + " has updated quarter " + txtQuarterNo.Text; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else { quarter = new tblQuarter(); tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Quarter"; _userhistory.description = _user.Username + " has added quarter " + txtQuarterNo.Text; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } quarter.QuarterNumber = txtQuarterNo.Text; quarter.Category = Convert.ToInt32(drpQuarterCat.SelectedValue); //quarter.Floor = Convert.ToInt32(drpFloors.SelectedValue); quarter.Floor = 1; quarter.Status = 0; Quarters.Save(quarter); Response.Redirect("~/admin/Quarters.aspx"); }
protected void btnUpload_click(object sender, EventArgs e) { //if (Page.IsValid) { string filepath = Server.MapPath("~/Images/photogallery"); if (!Directory.Exists(filepath)) { Directory.CreateDirectory(filepath); } filepath += "/" + fileImage.FileName; fileImage.SaveAs(filepath); tblImage newimage = new tblImage(); newimage.title = txtTitle.Text; newimage.CreatedDate = DateTime.Now; newimage.CreatedBy = HttpContext.Current.User.Identity.Name; newimage.Imagepath = "~/Images/photogallery/" + fileImage.FileName; tblPhotos.Save(newimage); lblmessage.Text = "Information has been saved sucessfully!"; lblmessage.Visible = true; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User creation"; _userhistory.description = _user.Username + " has created user with userid " + _user.Id; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } //else //{ // lblmessage.Text = "Only jpeg,gif and png allowed!"; // lblmessage.Visible = true; //} }
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; } }
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 static void Save(tbluserhistory _userhistory) { DataClassesDataContext dataContext = new DataClassesDataContext(); dataContext.tbluserhistories.InsertOnSubmit(_userhistory); dataContext.SubmitChanges(); }
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 drpRoles_SelectedIndexChanged(object sender, EventArgs e) { int roleId = Convert.ToInt32(drpRoles.SelectedValue.ToString()); List <tblRoleRModule> permissions = tblModules.GetRolePermission(roleId); foreach (ListItem item in chkLstModules.Items) { item.Selected = false; } foreach (tblRoleRModule role in permissions) { ListItem item = chkLstModules.Items.FindByValue(role.ModuleId.ToString()); if (item != null) { item.Selected = true; } } tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Role"; _userhistory.description = _user.Username + " has updated permission for role " + roleId; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); }
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); } }
void btnSave_Click(object sender, EventArgs e) { Users.Defer(Convert.ToInt32(hdnSelectedUserId.Value), DateTime.Now.AddMonths(Convert.ToInt32(ddlDeferPeriod.SelectedValue)).Date); // ask for defer date grdUsers.DataBind(); //BindUsers(); lblMessage.Text = "Record deferred successfully!"; lblMessage.Visible = true; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User deferred"; _userhistory.description = _user.Username + " has deferred user with userid " + hdnSelectedUserId.Value; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); }
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 btnadd_Click(object sender, EventArgs e) { tblQuarterCategoryFee categoryfee = new tblQuarterCategoryFee(); //categoryfee.LastUpdatedBy = 1; //categoryfee.Month = Convert.ToDateTime(txtmonth.Text); categoryfee.QuarterCategoryId = Convert.ToInt32(drpQuarterCat.SelectedValue); categoryfee.LicenceFee = Convert.ToDouble(txtLicenceFee.Text); categoryfee.EffectiveDate = Convert.ToDateTime(txtEffectiveDate.Text); LicenceFee.Save(categoryfee); tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "Licence fee"; //_userhistory.description = _user.Username + " has added Licence fee for quarter category " + categoryfee.tblQuarterCategory.Name; // Quartercategory name is selected from the drop down, not from database table.. _userhistory.description = _user.Username + " has added Licence fee for quarter category " + drpQuarterCat.SelectedItem.Text; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); lblmessage.Visible = true; lblmessage.Text = "Information saved successfully!"; }
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 grdCommad(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "deleteuser") { long userid = Convert.ToInt64(e.CommandArgument); Users.Delete(userid); grdUsers.DataBind(); //BindUsers(); lblMessage.Text = "Record deleted successfully!"; lblMessage.Visible = true; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User deletion"; _userhistory.description = _user.Username + " has deleted user with userid " + userid; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else if (e.CommandName == "debarUser") { long userid = Convert.ToInt64(e.CommandArgument); Users.Debar(userid, DateTime.Parse("31/12/" + DateTime.Now.Year)); grdUsers.DataBind(); //BindUsers(); lblMessage.Text = "Record debarred until 31/12/" + DateTime.Now.Year + " successfully!"; lblMessage.Visible = true; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User debarred"; _userhistory.description = _user.Username + " has debarred user with userid " + userid; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else if (e.CommandName == "deferUser") { popDefer.Show(); long userid = Convert.ToInt64(e.CommandArgument); hdnSelectedUserId.Value = userid.ToString(); } else if (e.CommandName == "removeBar") { long userid = Convert.ToInt64(e.CommandArgument); Users.ReactivateUser(userid, true, false); grdUsers.DataBind(); //BindUsers(); lblMessage.Text = "Record reactivated successfully!"; lblMessage.Visible = true; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User reactivated"; _userhistory.description = _user.Username + " has reactivated user with userid " + userid; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } else if (e.CommandName == "removeDefer") { long userid = Convert.ToInt64(e.CommandArgument); Users.ReactivateUser(userid, false, true); grdUsers.DataBind(); //BindUsers(); lblMessage.Text = "Record reactivated successfully!"; lblMessage.Visible = true; tbluserhistory _userhistory = new tbluserhistory(); _userhistory.Action = "User reactivated"; _userhistory.description = _user.Username + " has reactivated user with userid " + userid; _userhistory.time = DateTime.Now; _userhistory.useraan = _user.AAN; userHistory.Save(_userhistory); } }
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" }
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"); } }