protected void changeStatus_OnClick(object sender, EventArgs e) { //var id = _projId; var stats = 0; var selected = String.Empty; var taskId = Convert.ToInt32(tasks.SelectedValue); foreach (ListItem item in statusDropdown.Items) { if (item.Selected) { selected = item.Value; stats = Status(selected); break; } } var taskStatus = Convert.ToInt32(stats); var task = _insendluEntities.Tasks.Single(x => x.id == taskId); task.status = taskStatus; _insendluEntities.Entry(task).State = EntityState.Modified; _insendluEntities.SaveChanges(); SetTasks(_user); }
protected void btnEditReference_OnClick(object sender, EventArgs e) { var referee = Session["Reference"] as Reference; var show = showValue.Checked; if (referee != null) { referee.client_name = client_Name.Text; referee.project_details = projectDetails.Text; referee.project_value = projValue.Text; referee.show_value = show; _insendluEntities.Entry(referee).State = EntityState.Modified; _insendluEntities.SaveChanges(); editRefPopUp.Hide(); } }
protected void Send_OnClick(object sender, EventArgs e) { var email = forgotPassemail.Value; var user = _insendluEntities.Users.Single(x => x.email == email); if (user != null) { user.password = null; _insendluEntities.Entry(user).State = EntityState.Modified; _insendluEntities.SaveChanges(); var tempPass = user.name + user.surname + "$"; var path = Server.MapPath("~/Templates/forgotpasswordtemplate.html"); var encryptedPass = _encryptor.Encrypt(tempPass); user.temporary_password = encryptedPass; _insendluEntities.Entry(user).State = EntityState.Modified; _insendluEntities.SaveChanges(); _emailService.SendEmail(email, encryptedPass, path, user.name); } }
protected void Update_OnClick(object sender, EventArgs e) { var id = Convert.ToInt64(Session["ID"]); var modification = DateTime.Now; var comp = companyBackground.Content; var execSumm = execSummary.Content; var costP = costPlan.Content; var methodol = propMethodology.Content; var poli = riskanalysis.Content; var projDesc = descriptionPro.Text; var projName = projectName.Text; var conlusion = conclusion.Content; var proj = _projectService.GetProject(id); proj.description = projDesc; proj.name = projName; proj.conclusion = conlusion; proj.modified_at = modification; _insendluEntities.Entry(proj).State = System.Data.Entity.EntityState.Modified; _insendluEntities.SaveChanges(); var execSummar = (from exec in _insendluEntities.ExecutiveSummaries where exec.proj_id == id select exec).SingleOrDefault(); UpdateExecSummary(execSumm, execSummar, modification); var plan = (from cost in _insendluEntities.ProjectCostPlans where cost.proj_id == id select cost).SingleOrDefault(); UpdateCostPlan(costP, plan, modification); var company = (from compan in _insendluEntities.Companies where compan.proj_id == id select compan).SingleOrDefault(); UpdateCompany(comp, company, modification); var methodology = (from meth in _insendluEntities.ProjectMethodologies where meth.proj_id == id select meth).SingleOrDefault(); UpdateProjectMethodology(methodol, methodology, modification); var policy = (from polic in _insendluEntities.ProjectPolicies where polic.proj_id == id select polic).SingleOrDefault(); UpdateprojectPolicy(poli, policy, modification); SaveProject(proj); Response.Redirect("~/ActiveProjects.aspx"); }
protected void btnAddUsers_OnClick(object sender, EventArgs e) { var nonSystemMember = nonSystemUser.Text ?? string.Empty; var userLis = Request.Form[userList.UniqueID]; var projName = Session["proName"].ToString(); var role = memberDuty.Text ?? string.Empty; if (string.IsNullOrEmpty(userLis) && string.IsNullOrEmpty(nonSystemMember)) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "alert", "alert('Please select user to assign to project')", true); return; } var workLogger = _projectService.GetWorkLogByName(projName); if (!string.IsNullOrEmpty(userLis)) { workLogger.members = workLogger.members + "," + userLis; } if (!string.IsNullOrEmpty(nonSystemMember)) { workLogger.non_system_user = workLogger.non_system_user != null ? workLogger.non_system_user + "," + nonSystemMember : nonSystemMember; } if (!string.IsNullOrEmpty(role)) { workLogger.duties = role; } try { _insendluEntities.Entry(workLogger).State = EntityState.Modified; _insendluEntities.SaveChanges(); } catch (Exception exception) { Console.WriteLine(exception); throw; } finally { memberDuty.Text = string.Empty; nonSystemUser.Text = string.Empty; } }
private void UpdatePassword(string password, string email, string temp) { var user = _userService.GetUserByEmailAndTempPass(email, temp); if (user != null) { var enCrypt = _encryptor.Encrypt(password); user.password = enCrypt; user.status = 1; user.temporary_password = String.Empty; _insendluEntities.Entry(user).State = EntityState.Modified; int success = _insendluEntities.SaveChanges(); if (success == 1) { Session["passupdated"] = true; Response.Redirect("index.aspx"); } } }
protected void Update_OnClick(object sender, EventArgs e) { var id = Convert.ToInt64(Session["ID"]); var modification = DateTime.Now; var comp = RemoveHtml(companyBackground.Content); var execSumm = RemoveHtml(execSummary.Content); var costP = RemoveHtml(costPlan.Content); var methodol = RemoveHtml(propMethodology.Content); var poli = RemoveHtml(policyNum.Content); var projDesc = RemoveHtml(descriptionPro.Text); var projName = ProjName.Value; var conlusion = RemoveHtml(conclusion.Content); var bee = RemoveHtml(BBEstatus.Content); var coverpage = RemoveHtml(coverPage.Content); var implement = RemoveHtml(implemantation.Content); var jvCompany = RemoveHtml(jvcompany.Content); var scope = RemoveHtml(projScope.Content); var projRef = RemoveHtml(projReference.Content); var team = RemoveHtml(projTeam.Content); var riskAnalysis = RemoveHtml(riskanalysis.Content); var whyC = RemoveHtml(whyChoose.Content); var proj = _projectService.GetProjectById(id); proj.description = projDesc; proj.name = projName; proj.project_type = type.Value; proj.conclusion = conlusion; proj.modified_at = modification; _insendluEntities.Entry(proj).State = System.Data.Entity.EntityState.Modified; _insendluEntities.SaveChanges(); var execSummar = (from exec in _insendluEntities.ExecutiveSummaries where exec.proj_id == id select exec).SingleOrDefault(); UpdateExecSummary(execSumm, execSummar, modification); var cover = (from exec in _insendluEntities.ProjectCoverPages where exec.proj_id == id select exec).SingleOrDefault(); UpdateCoverpage(coverpage, cover, modification); var beeStats = (from exec in _insendluEntities.BEEStatus where exec.proj_id == id select exec).SingleOrDefault(); UpdateBeeStatus(bee, beeStats, modification); var implementation = (from exec in _insendluEntities.ProjectImplementationTimes where exec.proj_id == id select exec).SingleOrDefault(); UpdateImplementation(implement, implementation, modification); var jv = (from exec in _insendluEntities.projectJVCompanies where exec.proj_id == id select exec).SingleOrDefault(); UpdateJVCompany(jvCompany, jv, modification); var scopOfwork = (from exec in _insendluEntities.ProjectScopeOfWorks where exec.proj_id == id select exec).SingleOrDefault(); UpdateScopeOfWork(scope, scopOfwork, modification); var reference = (from exec in _insendluEntities.ProjectReferences where exec.proj_id == id select exec).SingleOrDefault(); UpdateReference(projRef, reference, modification); var risk = (from exec in _insendluEntities.RiskAnalysis where exec.proj_id == id select exec).SingleOrDefault(); UpdateRiskAnalysis(riskAnalysis, risk, modification); var proTeam = (from exec in _insendluEntities.ProjectTeams where exec.proj_id == id select exec).SingleOrDefault(); UpdateProjectTeam(team, proTeam, modification); var whyChoze = (from exec in _insendluEntities.WhyChooseBizs where exec.proj_id == id select exec).SingleOrDefault(); UpdateWhyChoose(whyC, whyChoze, modification); var plan = (from cost in _insendluEntities.ProjectCostPlans where cost.proj_id == id select cost).SingleOrDefault(); UpdateCostPlan(costP, plan, modification); var company = (from compan in _insendluEntities.Companies where compan.proj_id == id select compan).SingleOrDefault(); UpdateCompany(comp, company, modification); var methodology = (from meth in _insendluEntities.ProjectMethodologies where meth.proj_id == id select meth).SingleOrDefault(); UpdateProjectMethodology(methodol, methodology, modification); var policy = (from polic in _insendluEntities.ProjectPolicies where polic.proj_id == id select polic).SingleOrDefault(); UpdateprojectPolicy(poli, policy, modification); SaveProject(proj); Response.Redirect("~/Proposals.aspx"); }
protected void addTask_OnClick(object sender, EventArgs e) { //var checkDate = CheckPreviousDate(dueDate.Text); //if (checkDate) //{ // lblError.Visible = true; // return; //} //lblError.Visible = false; var taskDescription = taskDesciption.Text; var id = Convert.ToInt64(Session["ID"]); var taskDoc = new TaskDocument(); var stats = 0; var selectedUserId = Convert.ToInt32(userList.SelectedValue); if (attachments.HasFile) { var files = attachments.PostedFiles; foreach (var file in files) { var fileName = Page.Server.MapPath("~/Uploads/TaskDocuments/" + Path.GetFileName(file.FileName)); file.SaveAs(fileName); var fileByte = _imageService.ReadToEnd(file.InputStream); taskDoc = _insedlu.TaskDocuments.Add( new TaskDocument { name = fileName, created_at = DateTime.Today, file = fileByte }); try { _insedlu.SaveChanges(); } catch (DbEntityValidationException exception) { Console.WriteLine(exception.EntityValidationErrors); throw; } } } if (!string.IsNullOrEmpty(taskDescription)) { var date = DateTime.ParseExact(dueDate.Text, "dd/MM/yyyy", null); var todaysDate = DateTime.Today; var numberOfDays = GetRemainingDays(date, todaysDate); var task = new Task { created_at = DateTime.Now, body = taskDescription, modified_at = DateTime.Now, due_date = date, user_id = (int)id, status = (int)TaskStatus.Assigned, task_document_id = taskDoc.id, number_of_days_left = numberOfDays }; myTasksList.Text = task.body; var check = _projectService.SaveTask(task); var taskComplete = new TaskCompletion { completion = numberOfDays.ToString(), task_id = (int)task.id }; _insedlu.TaskCompletions.Add(taskComplete); _insedlu.SaveChanges(); stats = Status("Assigned"); var taskStatus = Convert.ToInt32(stats); //var task = _insedlu.Tasks.Single(x => x.id == taskId); task.status = taskStatus; task.assigned_to = selectedUserId; _insedlu.Entry(task).State = EntityState.Modified; _insedlu.SaveChanges(); if (check == 1) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "alert", "alert('Task saved successfully')", true); } } SetTasks(_id); }