Beispiel #1
0
        /// <summary>
        /// 删除项目
        /// </summary>
        /// <param name="Id">项目ID</param>
        /// <param name="remark">删除理由</param>
        /// <param name="account">删除人员</param>
        /// <returns></returns>
        public bool DleProject(string Id, string remark, string account)
        {
            bool       result   = false;
            tb_project _Project = ef.tb_project.Where(p => p.Id == Id).FirstOrDefault();

            try
            {
                _Project.IsUsed     = false;
                _Project.DelAccount = account;
                _Project.DeleteTime = DateTime.Now;
                _Project.DelRemark  = remark;
                result = true;
            }
            catch (Exception)
            {
            }
            return(result);
        }
Beispiel #2
0
        //修改项目信息
        public JsonResult EditProjectInfo(ProjectInfo projectInfo)
        {
            ResultModel result = new ResultModel();

            try
            {
                tb_project newData = _ProjectBusiness.GetProjectInfoById(projectInfo.Id).FirstOrDefault();
                newData = projectInfo.ConvertToT <tb_project>(newData);
                if (String.IsNullOrEmpty(newData.Id))
                {
                    newData.Id = GetNewGuid();
                }

                newData.UpdateTime = DateTime.Now;
                newData.UpdateUser = loginUser.Id;

                _PREBusiness.DelProPRE(newData.Id);
                if (projectInfo.ProPREs != null)
                {
                    _PREBusiness.AddListProPRE(projectInfo.ProPREs, newData.Id);
                }

                if (projectInfo.ProImgs != null)
                {
                    _ProjectBusiness.AddProImgList(projectInfo.ProImgs, newData.Id);
                }

                ef.SaveChanges();
                result.ResultCode = 1;
                result.ResultData = newData;
            }
            catch (DbEntityValidationException dex)
            {
                dex.ToString();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Json(result));
        }
Beispiel #3
0
        /// <summary>
        /// 添加新项目
        /// </summary>
        /// <returns></returns>
        public JsonResult AddProjectInfo(ProjectInfo projectInfo)
        {
            ResultModel result = new ResultModel();

            try
            {
                tb_project newData = projectInfo.ConvertToT <tb_project>();
                if (String.IsNullOrEmpty(newData.Id))
                {
                    newData.Id = GetNewGuid();
                }
                newData.InsertTime     = DateTime.Now;
                newData.UpdateTime     = DateTime.Now;
                newData.InvestmentTime = DateTime.Now;

                if (projectInfo.ProPREs != null)
                {
                    _PREBusiness.AddListProPRE(projectInfo.ProPREs, newData.Id);
                }
                if (projectInfo.ProImgs != null)
                {
                    _ProjectBusiness.AddProImgList(projectInfo.ProImgs, newData.Id);
                }


                ef.tb_project.Add(newData);
                ef.SaveChanges();
                result.ResultCode = 1;
                result.ResultData = newData;
            }
            catch (DbEntityValidationException dex)
            {
                dex.ToString();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Json(result));
        }