private void BindData() { try { if (Request.QueryString["ProjectID"] != null) { var DC = new DataClassesDataContext(); IList <string> Data = ProjectObject.GetProjectDetail(Convert.ToInt32(Request.QueryString["ProjectID"])); ltrProjectName.Text = Data[1]; //ProjectManager tblProject Project = DC.tblProjects.Single(obj => obj.ProjectID == Convert.ToInt32(Data[0])); tblEmployee Manager = DC.tblEmployees.Single(ob => ob.EmpID == Project.ManagerID); ltrManager.Text = Manager.FirstName + " " + Manager.LastName; rptModule.DataSource = ProjectObject.BindModule(Convert.ToInt32(Request.QueryString["ProjectID"])); rptModule.DataBind(); foreach (RepeaterItem Item in rptModule.Items) { HiddenField ModuleID = (HiddenField)Item.FindControl("hdnModuleID"); Repeater TaskList = (Repeater)Item.FindControl("rptTrackTask"); Literal ltrTeamLeader = (Literal)Item.FindControl("ltrTeamLeader"); //TeamLeader int cnt = DC.tblTeamModules.Count(obTeam => obTeam.ModuleID == Convert.ToInt32(ModuleID.Value)); if (cnt > 0) { tblTeamModule TeamLeader = DC.tblTeamModules.Single(obTeam => obTeam.ModuleID == Convert.ToInt32(ModuleID.Value)); tblEmployee TeamLeaderData = DC.tblEmployees.Single(ob => ob.EmpID == TeamLeader.EmpID); ltrTeamLeader.Text = TeamLeaderData.FirstName + " " + TeamLeaderData.LastName; } else { ltrTeamLeader.Text = "Unassigned"; } TaskList.DataSource = ProjectObject.BindTask(Convert.ToInt32(ModuleID.Value)); TaskList.DataBind(); foreach (RepeaterItem Items in TaskList.Items) { string Duration = "---"; //string DurationLeft = "---"; HiddenField hdnCreatedOn = (HiddenField)Items.FindControl("hdnCreatedOn"); HiddenField hdnAssignDay = (HiddenField)Items.FindControl("hdnAssignDay"); HiddenField hdnSubDate = (HiddenField)Items.FindControl("hdnSubDate"); HiddenField hdnIsActive = (HiddenField)Items.FindControl("hdnIsActive"); HiddenField hdnIsComplete = (HiddenField)Items.FindControl("hdnIsComplete"); HiddenField hdnTaskID = (HiddenField)Items.FindControl("hdnTaskID"); Literal ltrEmp = (Literal)Items.FindControl("ltrEmp"); //Literal ltrStatus = (Literal)Items.FindControl("ltrStatus"); Literal ltrAssignDate = (Literal)Items.FindControl("ltrAssignDate"); Literal ltrSubmitionDate = (Literal)Items.FindControl("ltrSubmitionDate"); string val = hdnSubDate.Value; if (hdnTaskID.Value != "") { tblTask TaskData = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(hdnTaskID.Value)); if ((DC.tblTeamMembers.Count(ob => ob.TaskID == TaskData.TaskID)) > 0) { tblTeamMember TeamMemberData = DC.tblTeamMembers.Single(ob => ob.TaskID == TaskData.TaskID); tblEmployee EmpData = DC.tblEmployees.Single(ob => ob.EmpID == TeamMemberData.EmpID); ltrEmp.Text = EmpData.FirstName + " " + EmpData.LastName; } else { ltrEmp.Text = "---"; } } if (hdnAssignDay.Value != "" && hdnSubDate.Value != "") { TimeSpan Days = Convert.ToDateTime(hdnSubDate.Value) - Convert.ToDateTime(hdnAssignDay.Value); Duration = Convert.ToInt32(Days.TotalDays).ToString(); //TimeSpan DaysLeft = Convert.ToDateTime(hdnSubDate.Value) - DateTime.Now; //DurationLeft = Convert.ToInt32(DaysLeft.TotalDays).ToString(); } else if (hdnAssignDay.Value == "" && hdnSubDate.Value == "") { TimeSpan Days = Convert.ToDateTime(hdnSubDate.Value) - Convert.ToDateTime(hdnCreatedOn.Value); Duration = Convert.ToInt32(Days.TotalDays).ToString(); } Literal ltrDuration = (Literal)Items.FindControl("ltrDuration"); //Literal ltrDurationLeft = (Literal)Items.FindControl("ltrDurationLeft"); ltrDuration.Text = Duration + " Days"; //if (Convert.ToInt32(DurationLeft) < 0) //{ // ltrDurationLeft.Text = "Completed"; //} //else //{ // ltrDurationLeft.Text = DurationLeft + " DaysLeft"; //} //ProjectStatus //if (hdnIsActive.Value == "True" && (hdnIsComplete.Value == "" || hdnIsComplete.Value == "False") && ltrSubmitionDate.Text != "") //{ // ltrStatus.Text = "Resolve"; //} //else if (hdnIsActive.Value == "True" && (hdnIsComplete.Value == "" || hdnIsComplete.Value == "False")) //{ // ltrStatus.Text = "Running"; // ltrSubmitionDate.Text = "---"; //} //else if (hdnIsActive.Value == "False" && (hdnIsComplete.Value == "" || hdnIsComplete.Value == "False")) //{ // ltrStatus.Text = "Panding"; // ltrSubmitionDate.Text = "---"; //} //else if (hdnIsActive.Value == "True" && hdnIsComplete.Value == "True") //{ // ltrStatus.Text = "Completed"; // ltrDurationLeft.Text = "Completed"; //} //else //{ // ltrStatus.Text = "---"; // ltrSubmitionDate.Text = "---"; //} } } } } catch (Exception ex) { int session = Convert.ToInt32(Session["AdminID"].ToString()); string PageName = System.IO.Path.GetFileName(Request.Url.AbsolutePath); string MACAddress = GetMacAddress(); AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress); ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true); } }
protected void btnSave_Click(object sender, EventArgs e) { var DC = new DataClassesDataContext(); tblTask TaskData = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == TaskData.ModuleID); tblTeamModule TeamModuleData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(TaskData.ModuleID)); int cntTeamMember = DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (cntTeamMember > 0) { tblTeamMember NewTeamMember = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (ddEmployee.SelectedValue != "") { NewTeamMember.EmpID = Convert.ToInt32(ddEmployee.SelectedValue); tblNotification NotificationCancel = new tblNotification(); NotificationCancel.Title = "Team Leader Cancelling"; NotificationCancel.Description = "You are cancel Employee for" + " " + TaskData.Title + " " + "work in" + " " + lblProName.Text; NotificationCancel.CreatedOn = DateTime.Now; NotificationCancel.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblNotifications.InsertOnSubmit(NotificationCancel); tblNotificationDetail DetailCancel = new tblNotificationDetail(); DetailCancel.NotificationID = DetailCancel.NotificationID; DetailCancel.PersonID = TeamModuleData.EmpID; DetailCancel.IsAdmin = false; DetailCancel.IsRead = false; DetailCancel.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(DetailCancel); } tblNotification Notification = new tblNotification(); Notification.Title = "Assign Team Leader"; Notification.Description = "You are selected Employee for" + " " + TaskData.Title + " " + "work in" + " " + lblProName.Text; Notification.CreatedOn = DateTime.Now; Notification.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblNotifications.InsertOnSubmit(Notification); tblNotificationDetail Detail = new tblNotificationDetail(); Detail.NotificationID = Notification.NotificationID; Detail.PersonID = TeamModuleData.EmpID; Detail.IsAdmin = false; Detail.IsRead = false; Detail.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(Detail); } else { tblTeamMember NewTeamMember = new tblTeamMember(); if (ddEmployee.SelectedValue != "") { NewTeamMember.EmpID = Convert.ToInt32(ddEmployee.SelectedValue); } NewTeamMember.TaskID = Convert.ToInt32(ltrTaskID.Text); NewTeamMember.TeamID = Convert.ToInt32(TeamModuleData.TeamID); NewTeamMember.CreatedOn = DateTime.Now; NewTeamMember.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblTeamMembers.InsertOnSubmit(NewTeamMember); tblNotification Notification = new tblNotification(); Notification.Title = "Assign Team Leader"; Notification.Description = "You are selected Employee for" + " " + TaskData.Title + " " + "work in" + " " + lblProName.Text; Notification.CreatedOn = DateTime.Now; Notification.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblNotifications.InsertOnSubmit(Notification); tblNotificationDetail Detail = new tblNotificationDetail(); Detail.NotificationID = Notification.NotificationID; Detail.PersonID = TeamModuleData.EmpID; Detail.IsAdmin = false; Detail.IsRead = false; Detail.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(Detail); } TaskData.Title = txtTaskName.Text; TaskData.Description = txtCkEditor.Text; if (txtDDate.Text == "") { TaskData.DeadlineDate = Convert.ToDateTime(lblDDate.Text); } else { TaskData.DeadlineDate = Convert.ToDateTime(txtDDate.Text); } if (ddPriority.SelectedValue != "") { TaskData.Priority = Convert.ToInt32(ddPriority.SelectedValue); } if (ddRisk.SelectedValue != "") { TaskData.Risk = Convert.ToInt32(ddRisk.SelectedValue); } TaskData.State = Convert.ToInt32(ddState.SelectedValue); tblTeamMember MemberData = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); int cntEmpAppraisal = DC.tblEmpAppraisals.Count(ob => ob.EmpID == MemberData.EmpID); 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 { 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.CreatedOn = DateTime.Now; EmpAppraisalData.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblEmpAppraisals.InsertOnSubmit(EmpAppraisalData); } DC.SubmitChanges(); Response.Redirect("TaskDetail.aspx"); }
protected void Page_Load(object sender, EventArgs e) { try { var DC = new DataClassesDataContext(); if (Session["EmpID"] == null) { Response.Redirect("ClientLogin.aspx"); } if (!IsPostBack) { //Session["TaskID"] = 1; tblTask Data = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(Session["TaskID"])); tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == Data.ModuleID); tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID); lblProName.Text = ProjectData.Title; txtTaskName.Text = Data.Title; ltrTaskID.Text = Data.TaskID.ToString(); rptAddSkill.DataSource = ProjectObject.ViewSkill(); rptAddSkill.DataBind(); if (Data.State == 1) { ddState.SelectedIndex = 0; } else if (Data.State == 2) { ddState.SelectedIndex = 1; } else if (Data.State == 3) { ddState.SelectedIndex = 2; } else if (Data.State == 4) { ddState.SelectedIndex = 3; } else { ddState.SelectedIndex = 0; } if (Data.Priority == 1) { ddPriority.SelectedIndex = 1; } else if (Data.Priority == 2) { ddPriority.SelectedIndex = 2; } else if (Data.Priority == 3) { ddPriority.SelectedIndex = 3; } else if (Data.Priority == 4) { ddPriority.SelectedIndex = 4; } else if (Data.Priority == 5) { ddPriority.SelectedIndex = 5; } else { ddPriority.SelectedIndex = 0; } if (Data.Risk == 1) { ddRisk.SelectedIndex = 1; } else if (Data.Risk == 2) { ddRisk.SelectedIndex = 2; } else if (Data.Risk == 3) { ddRisk.SelectedIndex = 3; } else { ddRisk.SelectedIndex = 0; } if (Data.DeadlineDate == null) { lblDDate.Text = "Select Deadline Date"; } else { lblDDate.Text = Convert.ToDateTime(Data.DeadlineDate).ToShortDateString(); } txtCkEditor.Text = Data.Description; lblModuleName.Text = ModuleData.Title; ltrModuleDescription.Text = ModuleData.Description; ltrModuleAssignDate.Text = Convert.ToDateTime(ModuleData.AssignDate).ToShortDateString(); ltrModuleDeadlineDate.Text = Convert.ToDateTime(ModuleData.DeadlineDate).ToShortDateString(); int cnt = DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (cnt > 0) { tblTeamMember TeamMemberData = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (TeamMemberData.EmpID == null) { lblEmployee.Text = "Unassigned"; } else { int cntEmp = DC.tblEmployees.Count(ob => ob.EmpID == TeamMemberData.EmpID); if (cntEmp > 0) { tblEmployee EmpData = DC.tblEmployees.Single(ob => ob.EmpID == TeamMemberData.EmpID); lblEmployee.Text = EmpData.FirstName + " " + EmpData.LastName; if (EmpData.ProfilePic != null) { imgEmployee.ImageUrl = "Admin/EmpUpload/" + EmpData.ProfilePic; } else { imgEmployee.ImageUrl = "img/notassigned-user.svg"; } } else { lblEmployee.Text = "Unassigned"; imgEmployee.ImageUrl = "img/notassigned-user.svg"; } } } else { lblEmployee.Text = "Unassigned"; imgEmployee.ImageUrl = "img/notassigned-user.svg"; } hdnTaskFile.Value = ModuleData.TaskFile; if (hdnTaskFile.Value == null) { divTaskFile.Visible = false; } if (Session["PersonType"].ToString() != "") { if (Session["PersonType"].ToString() == "Employee") { lnkbtnModuleAssign.Enabled = false; rngQuality.Attributes.Add("disabled", "false"); rngAvialibility.Attributes.Add("disabled", "false"); rngCommunication.Attributes.Add("disabled", "false"); rngCooperation.Attributes.Add("disabled", "false"); ddPriority.Attributes.Add("disabled", "false"); ddRisk.Attributes.Add("disabled", "false"); lnkbtnAddSkill.Visible = false; LinkButton12.Enabled = false; ddState.Items.RemoveAt(0); //rngQuality.Attributes.CssStyle.Add("") //PanelPlanning.Visible = false; } else if (Session["PersonType"].ToString() == "ProjectManager") { lnkbtnModuleAssign.Enabled = false; rngQuality.Attributes.Add("disabled", "false"); rngAvialibility.Attributes.Add("disabled", "false"); rngCommunication.Attributes.Add("disabled", "false"); rngCooperation.Attributes.Add("disabled", "false"); ddPriority.Attributes.Add("disabled", "false"); ddRisk.Attributes.Add("disabled", "false"); lnkbtnAddSkill.Visible = false; ddState.Enabled = false; //ddState.Items.RemoveAt(1); } } } if (Session["errorDDate"] != null) { tblTask errorTask = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); tblModule errorModule = DC.tblModules.Single(ob => ob.ModuleID == errorTask.ModuleID); errorDDate.Text = "Please Enter Date Between " + Convert.ToDateTime(errorTask.AssignDate).ToShortDateString() + " and " + Convert.ToDateTime(errorModule.DeadlineDate).ToShortDateString() + "."; errorDDate.Visible = true; Session["errorDDate"] = null; } } 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); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["EmpID"] == null) { Response.Redirect("ClientLogin.aspx"); } if (!IsPostBack) { //Session["TaskID"] = 1; var DC = new DataClassesDataContext(); tblTask Data = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(Session["TaskID"])); tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == Data.ModuleID); tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID); lblProName.Text = ProjectData.Title; txtTaskName.Text = Data.Title; ltrTaskID.Text = Data.TaskID.ToString(); rptAddSkill.DataSource = ProjectObject.ViewSkill(); rptAddSkill.DataBind(); if (Data.State == 1) { ddState.SelectedIndex = 0; } else if (Data.State == 2) { ddState.SelectedIndex = 1; } else if (Data.State == 3) { ddState.SelectedIndex = 2; } else if (Data.State == 4) { ddState.SelectedIndex = 3; } else { ddState.SelectedIndex = 0; } if (Data.Priority == 1) { ddPriority.SelectedIndex = 1; } else if (Data.Priority == 2) { ddPriority.SelectedIndex = 2; } else if (Data.Priority == 3) { ddPriority.SelectedIndex = 3; } else if (Data.Priority == 4) { ddPriority.SelectedIndex = 4; } else if (Data.Priority == 5) { ddPriority.SelectedIndex = 5; } else { ddPriority.SelectedIndex = 0; } if (Data.Risk == 1) { ddRisk.SelectedIndex = 1; } else if (Data.Risk == 2) { ddRisk.SelectedIndex = 2; } else if (Data.Risk == 3) { ddRisk.SelectedIndex = 3; } else { ddRisk.SelectedIndex = 0; } lblDDate.Text = Convert.ToDateTime(Data.DeadlineDate).ToShortDateString(); txtCkEditor.Text = Data.Description; lblModuleName.Text = ModuleData.Title; ltrModuleDescription.Text = ModuleData.Description; ltrModuleAssignDate.Text = Convert.ToDateTime(ModuleData.AssignDate).ToShortDateString(); ltrModuleDeadlineDate.Text = Convert.ToDateTime(ModuleData.DeadlineDate).ToShortDateString(); int cnt = DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (cnt > 0) { tblTeamMember TeamMemberData = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (TeamMemberData.EmpID == null) { lblEmployee.Text = "Unassigned"; } else { tblEmployee EmpData = DC.tblEmployees.Single(ob => ob.EmpID == TeamMemberData.EmpID); lblEmployee.Text = EmpData.FirstName + " " + EmpData.LastName; if (EmpData.ProfilePic != null) { imgEmployee.ImageUrl = "Admin/EmpUpload/" + EmpData.ProfilePic; } else { imgEmployee.ImageUrl = "img/notassigned-user.svg"; } } } else { lblEmployee.Text = "Unassigned"; imgEmployee.ImageUrl = "img/notassigned-user.svg"; } hdnTaskFile.Value = ModuleData.TaskFile; if (hdnTaskFile.Value == null) { divTaskFile.Visible = false; } if (Session["PersonType"].ToString() != "") { if (Session["PersonType"].ToString() == "Employee") { lnkbtnModuleAssign.Enabled = false; rngQuality.Attributes.Add("disabled", "false"); rngAvialibility.Attributes.Add("disabled", "false"); rngCommunication.Attributes.Add("disabled", "false"); rngCooperation.Attributes.Add("disabled", "false"); ddPriority.Attributes.Add("disabled", "false"); ddRisk.Attributes.Add("disabled", "false"); lnkbtnAddSkill.Visible = false; ddState.Items.RemoveAt(0); //rngQuality.Attributes.CssStyle.Add("") //PanelPlanning.Visible = false; } } } }
protected void btnSave_Click(object sender, EventArgs e) { try { var DC = new DataClassesDataContext(); tblTask TaskData = DC.tblTasks.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == TaskData.ModuleID); tblTeamModule TeamModuleData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(TaskData.ModuleID)); int cntTeamMember = DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (cntTeamMember > 0) { tblTeamMember NewTeamMember = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if (ddEmployee.SelectedValue != "") { NewTeamMember.EmpID = Convert.ToInt32(ddEmployee.SelectedValue); tblNotification NotificationCancel = new tblNotification(); NotificationCancel.Title = "Team Leader Cancelling"; NotificationCancel.Description = "You are cancel Employee for" + " " + TaskData.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 = TeamModuleData.EmpID; DetailCancel.IsAdmin = false; DetailCancel.IsRead = false; DetailCancel.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(DetailCancel); } tblNotification Notification = new tblNotification(); Notification.Title = "Assign Team Leader"; Notification.Description = "You are selected Employee for" + " " + TaskData.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 = TeamModuleData.EmpID; Detail.IsAdmin = false; Detail.IsRead = false; Detail.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(Detail); } else { if (ddEmployee.SelectedValue != "") { tblTeamMember NewTeamMember = new tblTeamMember(); NewTeamMember.EmpID = Convert.ToInt32(ddEmployee.SelectedValue); NewTeamMember.TaskID = Convert.ToInt32(ltrTaskID.Text); NewTeamMember.TeamID = Convert.ToInt32(TeamModuleData.TeamID); NewTeamMember.CreatedOn = DateTime.Now; NewTeamMember.CreatedBy = Convert.ToInt32(Session["EmpID"]); DC.tblTeamMembers.InsertOnSubmit(NewTeamMember); DC.SubmitChanges(); tblNotification Notification = new tblNotification(); Notification.Title = "Assign Team Leader"; Notification.Description = "You are selected Employee for" + " " + TaskData.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 = TeamModuleData.EmpID; Detail.IsAdmin = false; Detail.IsRead = false; Detail.IsNotify = false; DC.tblNotificationDetails.InsertOnSubmit(Detail); } } TaskData.Title = txtTaskName.Text; TaskData.Description = txtCkEditor.Text; //tblModule ModuleData1 = DC.tblModules.Single(ob => ob.ModuleID == ModuleData.ModuleID); tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID); if (txtDDate.Text != "") { if (Convert.ToDateTime(txtDDate.Text) < ModuleData.DeadlineDate && Convert.ToDateTime(txtDDate.Text) > TaskData.AssignDate) { if (txtDDate.Text == "") { if (lblDDate.Text != "Select Deadline Date") { TaskData.DeadlineDate = Convert.ToDateTime(lblDDate.Text); } } else { TaskData.DeadlineDate = Convert.ToDateTime(txtDDate.Text); } } else { Session["errorDDate"] = true; } } if (ddPriority.SelectedValue != "") { TaskData.Priority = Convert.ToInt32(ddPriority.SelectedValue); } if (ddRisk.SelectedValue != "") { TaskData.Risk = Convert.ToInt32(ddRisk.SelectedValue); } TaskData.State = Convert.ToInt32(ddState.SelectedValue); //int cnt = DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); if ((DC.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)) > 0)) { tblTeamMember MemberData = DC.tblTeamMembers.Single(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.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.tblTeamMembers.Count(ob => ob.TaskID == Convert.ToInt32(ltrTaskID.Text)); 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("TaskDetail.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); } }