Ejemplo n.º 1
0
        public string UpdateProject(ProjectEntity ProjectDtl)
        {
            string strResponse       = string.Empty;
            short  UsTCurrentVersion = 0;

            try
            {
                var ProjectComponent      = new ProjectComponent();
                var currentProjectDetails = ProjectComponent.GetProjectDetailByID(ProjectDtl.Proj_ProjectID);
                int ProjectID             = currentProjectDetails.Proj_ProjectID;
                UsTCurrentVersion = Convert.ToInt16(currentProjectDetails.Proj_Version);
                bool _currentStatus = false;

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

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

                    var Org = new ProjectComponent();
                    int r   = Org.UpdateProjectDetail(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 UpdateProject";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
Ejemplo n.º 2
0
        public JsonResult GetProjectByID(int catID)
        {
            ProjectEntity ProjectDetails = null;

            try
            {
                var objDtl = new ProjectComponent();
                ProjectDetails = objDtl.GetProjectDetailByID(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(ProjectDetails, JsonRequestBehavior.AllowGet));
        }