public string DeleteProjectAllocation(int ID)
        {
            string strResponse = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var Org = new ProjectAssignComponent();
                    int r   = Org.DeleteProjectAllocationDetail(ID);

                    if (r > 0)
                    {
                        strResponse = "Project deleted successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Project does not exists";
                    }
                    else if (r < 0)
                    {
                        strResponse = "Error occured in DeleteProjectAllocation";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
        public string UpdateProjectAllocation(ProjectAllocationEntity ProjectDtl)
        {
            string strResponse = string.Empty;

            short UsTCurrentVersion = 0;

            try
            {
                var projectAllocationComponent = new ProjectAssignComponent();
                var currentRecordDetails       = projectAllocationComponent.GetProjectAllocationDetailByID(ProjectDtl.UProj_UserProjectID);
                int recID = currentRecordDetails.UProj_UserProjectID;
                UsTCurrentVersion = Convert.ToInt16(currentRecordDetails.UProj_Version);
                //bool _currentStatus = false;

                if (ModelState.IsValid)
                {
                    UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                    int             _userID         = 0;
                    if (_objSessioninfo.UserId > 0)
                    {
                        _userID = _objSessioninfo.UserId;
                    }
                    ProjectDtl.UProj_ModifiedBy = _userID;
                    //while udating increment version by1
                    ProjectDtl.UProj_Version = ++UsTCurrentVersion;
                    //ProjectDtl.Ufp_ActiveStatus = _currentStatus;

                    int r = projectAllocationComponent.UpdateProjectAllocationDetail(ProjectDtl);

                    if (r > 0)
                    {
                        strResponse = "Project updated successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Project does not exists";
                    }
                    else if (r < 0)
                    {
                        strResponse = "Error occured in UpdateProjectAllocation";
                    }
                }
            }

            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
        public JsonResult GetProjectByID(int catID)
        {
            ProjectAllocationEntity ProjectDetails = null;

            try
            {
                var objDtl = new ProjectAssignComponent();
                ProjectDetails = objDtl.GetProjectAllocationDetailByID(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(ProjectDetails, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetProjectAllocationCollection(string getGridBasedONRoles, string[] GettingCheckData, int Projectid)
        {
            List <ProjectAllocationEntity> ProjectDetails = null;

            try
            {
                var objDtl = new ProjectAssignComponent();
                ProjectDetails = objDtl.GetProjectAllocationDetail(getGridBasedONRoles, GettingCheckData, Projectid);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(ProjectDetails, JsonRequestBehavior.AllowGet));
        }
        //public string CreateProject([Bind(Exclude = "Ufp_ProjectID")] ProjectEntity ProjectDtl)
        //{
        //    string strResponse = string.Empty;
        //    try
        //    {
        //        var ProjectComponent = new ProjectComponent();

        //        if (ModelState.IsValid)
        //        {
        //            UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
        //            int _userID = _objSessioninfo.UserId;
        //            ProjectDtl.Ufp_CreatedBy = _userID;

        //            var Org = new ProjectComponent();
        //            int r = Org.AddProject(ProjectDtl);
        //            if (r > 0)
        //            {
        //                strResponse = "Record created successfully";
        //            }
        //            else if (r == 0)
        //            {
        //                strResponse = "Record already exists";
        //            }
        //            else if (r < 0)
        //            {
        //                strResponse = "Error occured in CreateProject";
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        return strResponse;
        //    }
        //    return strResponse;
        //}

        //public string UpdateProject(ProjectEntity ProjectDtl)
        //{
        //    string strResponse = string.Empty;
        //    short UsTCurrentVersion = 0;
        //    try
        //    {
        //        var ProjectComponent = new ProjectComponent();
        //        var currentProjectDetails = ProjectComponent.GetProjectDetailByID(ProjectDtl.Ufp_ProjectID);
        //        int ProjectID = currentProjectDetails.Ufp_ProjectID;
        //        UsTCurrentVersion = Convert.ToInt16(currentProjectDetails.Ufp_Version);
        //        bool _currentStatus = false;

        //        //check for version and active status
        //        if (ModelState["Ufp_ActiveStatus"].Value != null)
        //        {
        //            _currentStatus = ProjectDtl.Ufp_ActiveStatus == true;
        //        }

        //        if (ModelState.IsValid)
        //        {
        //            UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
        //            int _userID = _objSessioninfo.UserId;
        //            ProjectDtl.Ufp_ModifiedBy = _userID;
        //            //while udating increment version by1
        //            ProjectDtl.Ufp_Version = ++UsTCurrentVersion;
        //            ProjectDtl.Ufp_ActiveStatus = _currentStatus;

        //            var Org = new ProjectComponent();
        //            int r = Org.UpdateProjectDetail(ProjectDtl);

        //            if (r > 0)
        //            {
        //                strResponse = "Record updated successfully";
        //            }
        //            else if (r == 0)
        //            {
        //                strResponse = "Record does not exists";
        //            }
        //            else if (r < 0)
        //            {
        //                strResponse = "Error occured in UpdateProject";
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        return strResponse;
        //    }
        //    return strResponse;
        //}

        public JsonResult GetUserRoles()
        {
            List <UserEntity> UserRoles = null;

            try
            {
                var objDtl = new ProjectAssignComponent();
                UserRoles = objDtl.GetUserRolenames();
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(UserRoles, JsonRequestBehavior.AllowGet));
        }
        public string CreateProjectAllocation([Bind(Exclude = "Ufp_UsersForProjectsID")] ProjectAllocationEntity ProjectDtl)
        {
            string strResponse = string.Empty;

            try
            {
                //var ProjectComponent = new ProjectAssignComponent();

                //if (ModelState.IsValid)
                //{
                UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                int             _userID         = _objSessioninfo.UserId;
                ProjectDtl.UProj_CreatedBy = _userID;

                var Org = new ProjectAssignComponent();
                int r   = Org.AddProjectAllocation(ProjectDtl);
                if (r > 0)
                {
                    strResponse = "Project created successfully";
                }
                else if (r == 0)
                {
                    strResponse = "Project already exists";
                }
                else if (r < 0)
                {
                    strResponse = "Error occured in CreateProjectAllocation";
                }
                // }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }