public IHttpActionResult PuttblTeam(int id, tblTeam tblTeam) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblTeam.Id) { return(BadRequest()); } db.Entry(tblTeam).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblTeamExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void SaveTeamDetails(TeamModel TeamModel) { if (TeamModel.Id == 0) { var team = new tblTeam() { COMPANYID = TeamModel.CompanyId, TEAMCREATED = DateTime.Now, TEAMDESC = TeamModel.Teamdesc, TEAMNAME = TeamModel.TeamName, TEAMSTATUS = "A" }; entity.tblTeams.Add(team); } else { var y = entity.tblTeams.FirstOrDefault(t => t.ID == TeamModel.Id); y.COMPANYID = TeamModel.CompanyId; y.TEAMCREATED = DateTime.Now; y.TEAMDESC = TeamModel.Teamdesc; y.TEAMNAME = TeamModel.TeamName; y.TEAMSTATUS = "A"; } entity.SaveChanges(); }
public IHttpActionResult GettblTeam(int id) { tblTeam tblTeam = db.tblTeams.Find(id); if (tblTeam == null) { return(NotFound()); } return(Ok(tblTeam)); }
public IHttpActionResult PosttblTeam(tblTeam tblTeam) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblTeams.Add(tblTeam); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tblTeam.Id }, tblTeam)); }
public IHttpActionResult DeletetblTeam(int id) { tblTeam tblTeam = db.tblTeams.Find(id); if (tblTeam == null) { return(NotFound()); } db.tblTeams.Remove(tblTeam); db.SaveChanges(); return(Ok(tblTeam)); }
protected void txtAddModuleName_TextChanged(object sender, EventArgs e) { ProjectObject.AddModule(txtAddModuleName.Text, Convert.ToInt32(hdnProjectID.Value), Convert.ToInt32(Session["EmpID"])); var DC = new DataClassesDataContext(); tblModule ModuleData = (from obj in DC.tblModules orderby obj.ModuleID descending select obj).First(); tblTeam TeamData = new tblTeam(); TeamData.ProjectID = Convert.ToInt32(Session["ProjectID"]); TeamData.Description = txtAddModuleName.Text; TeamData.CreatedOn = DateTime.Now; TeamData.CreatedBy = Convert.ToInt32(Session["EmpID"]); TeamData.ModuleID = ModuleData.ModuleID; DC.tblTeams.InsertOnSubmit(TeamData); DC.SubmitChanges(); Response.Redirect("ProjectMaster.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { try { var DC = new DataClassesDataContext(); tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text)); tblTeam TeamData = DC.tblTeams.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text)); int cnt = DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text)); if (cnt > 0) { tblTeamModule TeamModuleNewData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text)); if (ddTeamLeader.SelectedValue != "") { tblNotification NotificationCancel = new tblNotification(); NotificationCancel.Title = "Team Leader Cancelling"; NotificationCancel.Description = "You are cancel Team Leader for" + " " + ModuleData.Title + " " + "work in" + " " + lblProName.Text; NotificationCancel.CreatedOn = DateTime.Now; NotificationCancel.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblNotifications.InsertOnSubmit(NotificationCancel); DC.SubmitChanges(); tblNotification NID = (from obID in DC.tblNotifications orderby obID.NotificationID descending select obID).First(); tblNotificationDetail DetailCancel = new tblNotificationDetail(); DetailCancel.NotificationID = NID.NotificationID; DetailCancel.PersonID = TeamModuleNewData.EmpID; DetailCancel.IsAdmin = false; DetailCancel.IsRead = false; DetailCancel.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(DetailCancel); TeamModuleNewData.EmpID = Convert.ToInt32(ddTeamLeader.SelectedValue); //Notification Cancellation } //Notification tblNotification Notification = new tblNotification(); Notification.Title = "Assign Team Leader"; Notification.Description = "You are selected Team Leader for" + " " + ModuleData.Title + " " + "work in" + " " + lblProName.Text; Notification.CreatedOn = DateTime.Now; Notification.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblNotifications.InsertOnSubmit(Notification); DC.SubmitChanges(); tblNotification NID2 = (from obID in DC.tblNotifications orderby obID.NotificationID descending select obID).First(); tblNotificationDetail Detail = new tblNotificationDetail(); Detail.NotificationID = NID2.NotificationID; Detail.PersonID = TeamModuleNewData.EmpID; Detail.IsAdmin = false; Detail.IsRead = false; Detail.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(Detail); } else { if (ddTeamLeader.SelectedValue != "") { tblTeamModule TeamModuleNewData = new tblTeamModule(); TeamModuleNewData.EmpID = Convert.ToInt32(ddTeamLeader.SelectedValue); TeamModuleNewData.TeamID = TeamData.TeamID; TeamModuleNewData.CreatedOn = DateTime.Now; TeamModuleNewData.CreatedBy = Convert.ToInt32(Session["EmpID"]); TeamModuleNewData.ModuleID = Convert.ToInt32(ltrModuleID.Text); DC.tblTeamModules.InsertOnSubmit(TeamModuleNewData); DC.SubmitChanges(); //Notification tblNotification Notification = new tblNotification(); Notification.Title = "Assign Team Leader"; Notification.Description = "You are selected Team Leader for" + " " + ModuleData.Title + " " + "work in" + " " + lblProName.Text; Notification.CreatedOn = DateTime.Now; Notification.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblNotifications.InsertOnSubmit(Notification); DC.SubmitChanges(); tblNotification NID = (from obID in DC.tblNotifications orderby obID.NotificationID descending select obID).First(); tblNotificationDetail Detail = new tblNotificationDetail(); Detail.NotificationID = NID.NotificationID; Detail.PersonID = TeamModuleNewData.EmpID; Detail.IsAdmin = false; Detail.IsRead = false; Detail.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(Detail); } } ModuleData.Title = txtModuleName.Text; ModuleData.Description = txtCkEditor.Text; tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID); if (txtDDate.Text != "") { if (Convert.ToDateTime(txtDDate.Text) < ProjectData.DeadlineDate && Convert.ToDateTime(txtDDate.Text) > ModuleData.AssignDate) { if (txtDDate.Text == "") { if (lblDDate.Text != "Select Deadline Date") { ModuleData.DeadlineDate = Convert.ToDateTime(lblDDate.Text); } } else { ModuleData.DeadlineDate = Convert.ToDateTime(txtDDate.Text); } } else { Session["errorDDate"] = true; } } if (ddPriority.SelectedValue != "") { ModuleData.Priority = Convert.ToInt32(ddPriority.SelectedValue); } if (ddRisk.SelectedValue != "") { ModuleData.Risk = Convert.ToInt32(ddRisk.SelectedValue); } if (ddState.SelectedIndex == 3) { int TaskPanding = DC.tblTasks.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text) && ob.State != 4); if (TaskPanding > 0) { Session["errorClose"] = true; } else { ModuleData.State = Convert.ToInt32(ddState.SelectedValue); } } else { ModuleData.State = Convert.ToInt32(ddState.SelectedValue); } if ((DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text))) > 0) { tblTeamModule MemberData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text)); int cntEmpAppraisal = DC.tblEmpAppraisals.Count(ob => ob.EmpID == MemberData.EmpID); if (MemberData.EmpID != null) { if (cntEmpAppraisal > 0) { tblEmpAppraisal EmpAppraisalData = DC.tblEmpAppraisals.Single(ob => ob.EmpID == MemberData.EmpID); EmpAppraisalData.Quality = EmpAppraisalData.Quality + Convert.ToDecimal(rngQuality.Text); EmpAppraisalData.Avialibility = EmpAppraisalData.Avialibility + Convert.ToDecimal(rngAvialibility.Text); EmpAppraisalData.Communication = EmpAppraisalData.Communication + Convert.ToDecimal(rngCommunication.Text); EmpAppraisalData.Cooperation = EmpAppraisalData.Cooperation + Convert.ToDecimal(rngCooperation.Text); } else { int cntAppraisal = DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text)); //Response.Redirect(cntAppraisal.ToString()); if (cntAppraisal > 0) { tblEmpAppraisal EmpAppraisalData = new tblEmpAppraisal(); EmpAppraisalData.EmpID = MemberData.EmpID; EmpAppraisalData.Quality = Convert.ToDecimal(rngQuality.Text); EmpAppraisalData.Avialibility = Convert.ToDecimal(rngAvialibility.Text); EmpAppraisalData.Communication = Convert.ToDecimal(rngCommunication.Text); EmpAppraisalData.Cooperation = Convert.ToDecimal(rngCooperation.Text); EmpAppraisalData.Skills = Convert.ToDecimal(0.0); EmpAppraisalData.Deadlines = Convert.ToDecimal(0.0); EmpAppraisalData.CreatedOn = DateTime.Now; EmpAppraisalData.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblEmpAppraisals.InsertOnSubmit(EmpAppraisalData); } } } } DC.SubmitChanges(); Response.Redirect("ModuleDetail.aspx"); } catch (Exception ex) { int session = Convert.ToInt32(Session["EmpID"].ToString()); string PageName = System.IO.Path.GetFileName(Request.Url.AbsolutePath); string MACAddress = GetMacAddress(); AddErrorLog(ref ex, PageName, "Employee", session, 0, MACAddress); ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true); } }