예제 #1
0
        public JsonResult AddModule(VM_Module module)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    tblModule aModule = new tblModule();

                    aModule.ModuleName      = module.ModuleName;
                    aModule.ModuleOrder     = module.ModuleOrder;
                    aModule.ModuleIcon      = module.ModuleIcon;
                    aModule.WorkShopId      = Int32.Parse(SessionManger.WorkShopOfLoggedInUser(Session).ToString());
                    aModule.CreatedBy       = SessionManger.LoggedInUser(Session);
                    aModule.CreatedDateTime = DateTime.Now;
                    aModule.EditedBy        = null;
                    aModule.EditedDateTime  = null;

                    unitOfWork.ModuleRepository.Insert(aModule);
                    unitOfWork.Save();

                    return(Json(new { success = true, successMessage = "Module Added Successfully!" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, errorMessage = ex }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { success = false, errorMessage = "Fill Up all required filled" }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #2
0
        public static tblModule GetModuleObject(Type type, Process process, object objComponent)
        {
            var tblModule = new tblModule {
                ModuleId = Guid.NewGuid()
            };

            if (type.Name == "__ComObject")
            {
                var modules            = process.Modules.AppendHiddenModules(process).OrderBy(p => p.ModuleName);
                var pGetQueryInterface = GetQueryInterfacePtr(objComponent);
                var module             = modules.Single(m2 => ((uint)pGetQueryInterface).IsBetween((uint)m2.BaseAddress, (uint)(m2.BaseAddress + m2.ModuleMemorySize)));

                tblModule.ModuleName     = module.ModuleName;
                tblModule.ModuleFileName = module.FileName;
                tblModule.IsClrModule    = false;
            }
            else
            {
                var assembly = type.Assembly;

                tblModule.ModuleName     = assembly.GetNameParts().AssemblyName;
                tblModule.ModuleFileName = assembly.CodeBase;
                tblModule.IsClrModule    = true;
            }

            return(tblModule);
        }
 protected void lnkTaskFile_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);
         tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID);
         Response.Clear();
         Response.ContentType = "application/zip";
         Response.AddHeader("content-disposition", "filename=" + ProjectData.Title + "_Supporting_TaskFile" + ".zip");
         using (ZipFile zip = new ZipFile())
         {
             zip.AddDirectory(Server.MapPath("UploadFiles/") + @hdnTaskFile.Value);
             zip.Save(Response.OutputStream);
         }
     }
     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
        public ActionResult Update(VM_Module module)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    tblModule aModule = unitOfWork.ModuleRepository.GetByID(module.ModuleId);

                    aModule.ModuleName     = module.ModuleName;
                    aModule.ModuleOrder    = module.ModuleOrder;
                    aModule.ModuleIcon     = module.ModuleIcon;
                    aModule.EditedBy       = SessionManger.LoggedInUser(Session);
                    aModule.EditedDateTime = DateTime.Now;


                    unitOfWork.ModuleRepository.Update(aModule);
                    unitOfWork.Save();

                    return(Json(new { success = true, successMessage = "Module Info update successfully." }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, errorMessage = ex }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { success = false, errorMessage = "Model is not valid" }, JsonRequestBehavior.AllowGet));
            }
        }
    protected void LinkButton12_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);

        Session["ModuleID"] = ModuleData.ModuleID;
        Response.Redirect("ModuleDetail.aspx");
    }
 public JsonResult AddModule(tblModule module)
 {
     try
     {
         unitOfWork.ModuleRepository.Insert(module);
         unitOfWork.Save();
         return(Json(new { success = true, successMessage = " Successfully Added" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, errorMessage = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
 public JsonResult EditMoudleById(tblModule module)
 {
     try
     {
         unitOfWork.ModuleRepository.Update(module);
         unitOfWork.Save();
         return(Json(new { success = true, successMessage = "Successfully Edited" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception exception)
     {
         return(Json(new { success = false, errorMessage = exception.Message }, JsonRequestBehavior.AllowGet));
     }
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            var DC = new DataClassesDataContext();
            if (fileUploadTask.HasFiles)
            {
                tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == Convert.ToInt32(ltrModuleID.Text));
                if (ModuleData.TaskFile == null)
                {
                    string FolderName = DateTime.Now.ToString("ddMMyyyyHmmss");
                    string folderPath = Server.MapPath("UploadFiles/" + FolderName + "/");

                    //check whether directory (folder) exists.
                    if (!Directory.Exists(folderPath))
                    {
                        //if directory (folder) does not exists. create it.
                        Directory.CreateDirectory(folderPath);
                    }
                    foreach (HttpPostedFile uploadedfile in fileUploadTask.PostedFiles)
                    {
                        //uploadedfile.SaveAs(System.IO.Path.Combine(Server.MapPath(folderPath), uploadedfile.FileName));
                        uploadedfile.SaveAs(folderPath + Path.GetFileName(uploadedfile.FileName));
                        lblFileName.Text += string.Format("<br />{0}", uploadedfile.FileName);
                    }
                    ModuleData.TaskFile = FolderName;
                }
                else
                {
                    foreach (HttpPostedFile uploadedfile in fileUploadTask.PostedFiles)
                    {
                        //uploadedfile.SaveAs(System.IO.Path.Combine(Server.MapPath(folderPath), uploadedfile.FileName));
                        uploadedfile.SaveAs(Server.MapPath("UploadFiles/" + ModuleData.TaskFile + "/") + Path.GetFileName(uploadedfile.FileName));
                        lblFileName.Text += string.Format("<br />{0}", uploadedfile.FileName);
                    }
                }
            }
            DC.SubmitChanges();
        }
        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);
        }
    }
예제 #9
0
        public static void AddModuleInfo(this tblModule tblModule, Type type, Process process, object objComponent)
        {
            if (type.Name == "__ComObject")
            {
                var modules = process.Modules.AppendHiddenModules(process);
                var pUnk    = Marshal.GetIUnknownForObject(objComponent);
            }
            else
            {
                var assembly = type.Assembly;

                tblModule.ModuleName     = assembly.GetNameParts().AssemblyName;
                tblModule.ModuleFileName = assembly.CodeBase;
                tblModule.IsClrModule    = true;
            }
        }
    protected void lnkTaskFile_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);
        tblProject ProjectData = DC.tblProjects.Single(ob => ob.ProjectID == ModuleData.ProjectID);

        Response.Clear();
        Response.ContentType = "application/zip";
        Response.AddHeader("content-disposition", "filename=" + ProjectData.Title + "_Supporting_TaskFile" + ".zip");
        using (ZipFile zip = new ZipFile())
        {
            zip.AddDirectory(Server.MapPath("UploadFiles/") + @hdnTaskFile.Value);
            zip.Save(Response.OutputStream);
        }
    }
예제 #11
0
 public ActionResult DeleteModule(int id)
 {
     if (ClsCheckRole.CheckQuyen(3, 3, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
     {
         tblModule tblmodule = db.tblModules.Find(id);
         var       result    = string.Empty;
         db.tblModules.Remove(tblmodule);
         db.SaveChanges();
         result = "Bạn đã xóa thành công.";
         return(Json(new { result = result }));
     }
     else
     {
         var result = string.Empty;
         result = "Bạn không có quyền thay đổi tính năng này";
         return(Json(new { result = result }));
     }
 }
예제 #12
0
    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");
    }
        public JsonResult GetModuleById(int?id)
        {
            try
            {
                var newModule = new tblModule();
                var module    = unitOfWork.ModuleRepository.GetByID(id);
                newModule.module_id    = module.module_id;
                newModule.module_icon  = module.module_icon;
                newModule.module_order = module.module_order;
                newModule.module_name  = module.module_name;

                return(Json(new { result = newModule }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                return(Json(new { result = exception.Message }, JsonRequestBehavior.AllowGet));
            }
        }
 protected void LinkButton12_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);
         Session["ModuleID"] = ModuleData.ModuleID;
         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);
     }
 }
예제 #15
0
        public ActionResult Create(tblModule tblmodule, FormCollection collection)
        {
            db.tblModules.Add(tblmodule);
            db.SaveChanges();
            #region [Updatehistory]
            Updatehistoty.UpdateHistory("Add User", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
            #endregion
            if (collection["btnSave"] != null)
            {
                Session["Thongbao"] = "<div  class=\"alert alert-info alert1\">Bạn đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";

                return(Redirect("/Module/Index"));
            }
            if (collection["btnSaveCreate"] != null)
            {
                Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm danh mục  mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                return(Redirect("/Module/Create"));
            }
            return(Redirect("Index"));
        }
예제 #16
0
 public ActionResult Edit(int id = 0)
 {
     if ((Request.Cookies["Username"] == null))
     {
         return(RedirectToAction("LoginIndex", "Login"));
     }
     if (ClsCheckRole.CheckQuyen(3, 2, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
     {
         tblModule tblmodule = db.tblModules.Find(id);
         if (tblmodule == null)
         {
             return(HttpNotFound());
         }
         return(View(tblmodule));
     }
     else
     {
         return(Redirect("/Users/Erro"));
     }
 }
        public JsonResult GetAllMoudle()
        {
            try
            {
                List <tblModule> newModule = new List <tblModule>();
                var moduleList             = unitOfWork.ModuleRepository.Get().ToList();
                foreach (var module in moduleList)
                {
                    tblModule aModule = new tblModule();

                    aModule.module_name  = module.module_name;
                    aModule.module_icon  = module.module_icon;
                    aModule.module_order = module.module_order;
                    aModule.module_id    = module.module_id;
                    newModule.Add(aModule);
                }

                return(Json(new { result = newModule, success = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                return(Json(new { result = exception.Message }));
            }
        }
예제 #18
0
        public ActionResult Edit(tblModule tblmodule, int id, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblmodule).State = EntityState.Modified;

                db.SaveChanges();
                #region [Updatehistory]
                Updatehistoty.UpdateHistory("Edit Module", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
                #endregion
                if (collection["btnSave"] != null)
                {
                    Session["Thongbao"] = "<div  class=\"alert alert-info alert1\">Bạn đã sửa  thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";

                    return(Redirect("/Module/Index"));
                }
                if (collection["btnSaveCreate"] != null)
                {
                    Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                    return(Redirect("/Module/Create"));
                }
            }
            return(View(tblmodule));
        }
    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;
                }
            }
        }
    }
예제 #20
0
        private static void BuildModuleSymbolsTable(this SdkInterfaceLibraryEntities entities, tblModule tblModule)
        {
            var     cvdump    = @"C:\Projects\MC\RazorViewsDesigner\Microsoft.Pdb\cvdump\cvdump.exe";
            var     startInfo = new ProcessStartInfo(cvdump, string.Format("-p \"{0}\"", tblModule.ModuleFileName));
            var     output    = string.Empty;
            var     error     = string.Empty;
            int     exitCode;
            Process process;

            startInfo.CreateNoWindow         = false;
            startInfo.UseShellExecute        = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError  = true;

            process = new Process();

            process.EnableRaisingEvents = true;
            process.StartInfo           = startInfo;

            process.OutputDataReceived += (s, e) =>
            {
                output += e.Data + "\r\n";
            };

            process.ErrorDataReceived += (s, e) =>
            {
                error += e.Data + "\r\n";
            };

            process.Start();

            process.BeginOutputReadLine();
            process.BeginErrorReadLine();

            process.WaitForExit();

            exitCode = process.ExitCode;

            //exitCode = 0;
            //output = File.ReadAllText(@"C:\Projects\MC\RazorViewsDesigner\Net2Html5Package\InterfaceLibrary\cvdump.txt");
            //error = string.Empty;

            if (error.Trim().IsNullOrEmpty())
            {
                var pattern = @"^S_PUB32: \[(?<segment>[\da-zA-Z]*?):(?<offset>[\da-zA-Z]*?)\], Flags: (?<flags>[\da-zA-Z]*?), (?<symbol>.*$)$";
                var regex   = new Regex(pattern);
                var lines   = output.Split('\n', StringSplitOptions.RemoveEmptyEntries);

                foreach (var readLine in lines)
                {
                    var line = readLine.Trim();

                    if (regex.IsMatch(line))
                    {
                        var match            = regex.Match(line.Trim());
                        var segment          = match.Groups["segment"].Value;
                        var offset           = match.Groups["offset"].Value;
                        var flags            = match.Groups["flags"].Value;
                        var symbol           = match.Groups["symbol"].Value;
                        var tblModuleSymbols = entities.tblModuleSymbols;
                        var tblModuleSymbol  = new tblModuleSymbol
                        {
                            ModuleSymbolId    = Guid.NewGuid(),
                            ModuleId          = tblModule.ModuleId,
                            Segment           = segment,
                            Offset            = offset,
                            Flags             = flags,
                            DecoratedSymbol   = symbol,
                            UndecoratedSymbol = UndecorateSymbol(symbol)
                        };

                        tblModuleSymbols.AddObject(tblModuleSymbol);
                        entities.SaveChanges();
                    }
                }
            }
            else
            {
                SetStatus("Errors from cvdump: \r\n\r\n{0}", error);
            }

            SetStatus("Exit code from cvdump: {0}", exitCode);
        }
    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");
    }
예제 #22
0
        public ActionResult Index(int?page, string id, FormCollection collection)
        {
            if ((Request.Cookies["Username"] == null))
            {
                return(RedirectToAction("LoginIndex", "Login"));
            }
            if (ClsCheckRole.CheckQuyen(3, 0, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
            {
                var ListModule = db.tblModules.ToList();

                const int pageSize   = 20;
                var       pageNumber = (page ?? 1);
                // Thiết lập phân trang
                var ship = new PagedListRenderOptions
                {
                    DisplayLinkToFirstPage                      = PagedListDisplayMode.Always,
                    DisplayLinkToLastPage                       = PagedListDisplayMode.Always,
                    DisplayLinkToPreviousPage                   = PagedListDisplayMode.Always,
                    DisplayLinkToNextPage                       = PagedListDisplayMode.Always,
                    DisplayLinkToIndividualPages                = true,
                    DisplayPageCountAndCurrentLocation          = false,
                    MaximumPageNumbersToDisplay                 = 5,
                    DisplayEllipsesWhenNotShowingAllPageNumbers = true,
                    EllipsesFormat                     = "&#8230;",
                    LinkToFirstPageFormat              = "Trang đầu",
                    LinkToPreviousPageFormat           = "«",
                    LinkToIndividualPageFormat         = "{0}",
                    LinkToNextPageFormat               = "»",
                    LinkToLastPageFormat               = "Trang cuối",
                    PageCountAndCurrentLocationFormat  = "Page {0} of {1}.",
                    ItemSliceAndTotalFormat            = "Showing items {0} through {1} of {2}.",
                    FunctionToDisplayEachPageNumber    = null,
                    ClassToApplyToFirstListItemInPager = null,
                    ClassToApplyToLastListItemInPager  = null,
                    ContainerDivClasses                = new[] { "pagination-container" },
                    UlElementClasses                   = new[] { "pagination" },
                    LiElementClasses                   = Enumerable.Empty <string>()
                };
                ViewBag.ship = ship;
                if (Session["Thongbao"] != null && Session["Thongbao"] != "")
                {
                    ViewBag.thongbao    = Session["Thongbao"].ToString();
                    Session["Thongbao"] = "";
                }
                if (collection["btnDelete"] != null)
                {
                    foreach (string key in Request.Form.Keys)
                    {
                        var checkbox = "";
                        if (key.StartsWith("chk_"))
                        {
                            checkbox = Request.Form["" + key];
                            if (checkbox != "false")
                            {
                                if (ClsCheckRole.CheckQuyen(3, 3, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
                                {
                                    int       ids       = Convert.ToInt32(key.Remove(0, 4));
                                    tblModule tblmodule = db.tblModules.Find(ids);
                                    db.tblModules.Remove(tblmodule);
                                    db.SaveChanges();
                                    return(RedirectToAction("Index"));
                                }
                                else
                                {
                                    return(Redirect("/Users/Erro"));
                                }
                            }
                        }
                    }
                }
                return(View(ListModule.ToPagedList(pageNumber, pageSize)));
            }
            else
            {
                return(Redirect("/Users/Erro"));
            }
        }
예제 #23
0
    protected void rptResolve_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        var DC = new DataClassesDataContext();
        int ID = Convert.ToInt32(e.CommandArgument);

        if (e.CommandName == "OpenPanelViewTask")
        {
            Panel       pnl     = (Panel)e.Item.FindControl("PanelAddTask");
            Repeater    rpt     = (Repeater)e.Item.FindControl("rptTask");
            HiddenField hdn     = (HiddenField)e.Item.FindControl("hdnCnt");
            TextBox     txtTask = (TextBox)e.Item.FindControl("txtAddTask");
            rpt.DataSource = ProjectObject.GetTaskList(Convert.ToInt32(e.CommandArgument));
            rpt.DataBind();

            if (hdn.Value == "0")
            {
                pnl.Visible = true;
                hdn.Value   = "1";
            }
            else if (hdn.Value == "1")
            {
                pnl.Visible = false;
                hdn.Value   = "0";
            }
        }
        else if (e.CommandName == "View")
        {
            Session["ModuleID"] = e.CommandArgument;
            Response.Redirect("ModuleDetail.aspx");
            //Response.Write(e.CommandArgument);
            //var Data = ProjectObject.BindProjectModule(Convert.ToInt32(e.CommandArgument));
            //lblProName.Text = Session["ProjectName"].ToString();
            //txtModuleName.Text = Data.Description;
            //foreach(RepeaterItem item in rptDetail.Items)
            //{
            //    Label lbl = (Label)item.FindControl("lblProjectName");
            //    lbl.Text = Session["ProjectName"].ToString();
            //}

            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal({backdrop:'static', keyboard: false});", true);
        }
        else if (e.CommandName == "EditModuleName")
        {
            TextBox     txtModuleTitle = (TextBox)e.Item.FindControl("txtModuleTitle");
            Label       lblModuleTitle = (Label)e.Item.FindControl("lblModuleTitle");
            HiddenField hdnModuleID    = (HiddenField)e.Item.FindControl("hdnModuleID");
            if (txtModuleTitle.Text != lblModuleTitle.Text)
            {
                tblModule ModuleData = DC.tblModules.Single(ob => ob.ModuleID == Convert.ToInt32(hdnModuleID.Value));
                ModuleData.Title = txtModuleTitle.Text;
                DC.SubmitChanges();
                txtModuleTitle.Visible = false;
                lblModuleTitle.Visible = true;
            }
            else
            {
                txtModuleTitle.Visible = true;
                lblModuleTitle.Visible = false;
            }
        }
        else if (e.CommandName == "OpenPanelAddTask")
        {
            //hdnAddTaskModuleID.Value = e.CommandArgument.ToString();
            ViewState["myModuleID"] = e.CommandArgument;
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal({backdrop:'static', keyboard: false});", true);
        }
        else if (e.CommandName == "DeleteModule")
        {
            HiddenField hdnModuleID = (HiddenField)e.Item.FindControl("hdnModuleID");
            tblModule   ModuleData  = DC.tblModules.Single(ob => ob.ModuleID == Convert.ToInt32(hdnModuleID.Value));
            ModuleData.IsActive = false;
            DC.SubmitChanges();
        }
    }
예제 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        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;
        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;
    }
    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);
        }
    }
예제 #26
0
        public static string GetComponentTypeName(this SdkInterfaceLibraryEntities entities, tblModule tblModule, Type type, Guid typeGuid)
        {
            if (tblModule.IsClrModule)
            {
                return(type.FullName);
            }
            else
            {
                var imageFile = tblModule.ModuleFileName;

                SetStatus("Searching for component type name for {0}", type.Name);

                if (tblModule.tblModuleSymbols.Count == 0)
                {
                    SetStatus("Building symbol table for {0}. This may take several minutes.", tblModule.ModuleName);

                    entities.BuildModuleSymbolsTable(tblModule);
                }

                throw new NotImplementedException();
            }
        }
    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);
        }
    }