コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            var DC = new DataClassesDataContext();
            if (Session["EmpID"] == null)
            {
                Response.Redirect("ClientLogin.aspx");
            }

            if (!IsPostBack)
            {
                var Data = ProjectObject.BindProjectModule(Convert.ToInt32(Session["ModuleID"]));

                lblProName.Text        = Session["ProjectName"].ToString();
                txtModuleName.Text     = Data.Title;
                ltrModuleID.Text       = Data.ModuleID.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;
                lblTask.Text           = ProjectObject.BindTotalTask(Convert.ToInt32(Data.ModuleID)).ToString();
                rptTaskList.DataSource = ProjectObject.GetTaskList(Convert.ToInt32(Data.ModuleID));
                rptTaskList.DataBind();
                rptTaskFile.DataSource = ProjectObject.GetTaskList(Convert.ToInt32(Data.ModuleID));
                rptTaskFile.DataBind();
                foreach (RepeaterItem item in rptTaskFile.Items)
                {
                    HiddenField hdn = (HiddenField)item.FindControl("hdnSubmittedFile");
                    if (hdn.Value == "")
                    {
                        item.Visible = false;
                    }
                }
                int cnt = DC.tblTeamModules.Count(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                if (cnt > 0)
                {
                    tblTeamModule ModuleData = DC.tblTeamModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                    if (ModuleData.EmpID == null)
                    {
                        lblTeamLeader.Text = "Unassigned";
                    }
                    else
                    {
                        int cntEmp = DC.tblEmployees.Count(ob => ob.EmpID == ModuleData.EmpID);
                        if (cntEmp > 0)
                        {
                            tblEmployee EmpData = DC.tblEmployees.Single(ob => ob.EmpID == ModuleData.EmpID);
                            lblTeamLeader.Text = EmpData.FirstName + " " + EmpData.LastName;
                            if (EmpData.ProfilePic != null)
                            {
                                imgTeamLeader.ImageUrl = "Admin/EmpUpload/" + EmpData.ProfilePic;
                            }
                            else
                            {
                                imgTeamLeader.ImageUrl = "img/notassigned-user.svg";
                            }
                        }
                        else
                        {
                            lblTeamLeader.Text     = "Unassigned";
                            imgTeamLeader.ImageUrl = "img/notassigned-user.svg";
                        }
                    }
                }
                else
                {
                    lblTeamLeader.Text     = "Unassigned";
                    imgTeamLeader.ImageUrl = "img/notassigned-user.svg";
                }
            }
            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;
                }
            }
            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;
                }
                else if (Session["PersonType"].ToString() == "TeamLeader")
                {
                    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)
            {
                tblModule  errorModule  = DC.tblModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                tblProject errorProject = DC.tblProjects.Single(ob => ob.ProjectID == errorModule.ProjectID);
                errorDDate.Text       = "Please Enter Date Between " + Convert.ToDateTime(errorModule.AssignDate).ToShortDateString() + " and " + Convert.ToDateTime(errorProject.DeadlineDate).ToShortDateString() + ".";
                errorDDate.Visible    = true;
                Session["errorDDate"] = null;
            }
            if (Session["errorClose"] != null)
            {
                errorDDate.Text       = "All Task are not Completed.";
                errorDDate.Visible    = true;
                Session["errorClose"] = null;
            }

            //rptTaskList.DataSource =
        }
        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);
        }
    }
コード例 #4
0
    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");
    }