예제 #1
0
        public ActionResult Detail(string RULEID = "", string SCHEMEID = "", string PREPARE_SCHEMEID = "")
        {
            if (!string.IsNullOrWhiteSpace(PREPARE_SCHEMEID))
            {//预备方案
                QUALIFIED_UNQUALIFIED_TEST_ITE          qEntity = null;
                IBLL.IQUALIFIED_UNQUALIFIED_TEST_ITEBLL qBLL    = new QUALIFIED_UNQUALIFIED_TEST_ITEBLL();
                qEntity = qBLL.GetByPREPARE_SCHEMEID_RULEID(PREPARE_SCHEMEID, RULEID);
                if (qEntity != null)
                {
                    ViewBag.HTMLVALUE = qEntity.HTMLVALUE;
                    ViewBag.ITEID     = qEntity.ID;
                }
                else
                {
                    PREPARE_SCHEME          pEntity = new DAL.PREPARE_SCHEME();
                    IBLL.IPREPARE_SCHEMEBLL pBLL    = new BLL.PREPARE_SCHEMEBLL();
                    pEntity = pBLL.GetById(PREPARE_SCHEMEID);
                    if (pEntity != null)
                    {
                        SCHEMEID = pEntity.SCHEMEID;
                    }
                    //方案
                    DAL.PROJECTTEMPLET entity = m_BLL.GetModelByRULEID_SCHEMEID(RULEID, SCHEMEID);
                    if (entity != null)
                    {
                        ViewBag.ID        = entity.ID;
                        ViewBag.HTMLVALUE = entity.HTMLVALUE;
                    }
                    else
                    {
                        ViewBag.ID = string.Empty;
                    }
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(SCHEMEID))
                {
                    //方案
                    DAL.PROJECTTEMPLET entity = m_BLL.GetModelByRULEID_SCHEMEID(RULEID, SCHEMEID);
                    if (entity != null)
                    {
                        ViewBag.ID        = entity.ID;
                        ViewBag.HTMLVALUE = entity.HTMLVALUE;
                    }
                    else
                    {
                        ViewBag.ID = string.Empty;
                    }
                }
            }

            ViewBag.PREPARE_SCHEMEID = PREPARE_SCHEMEID;
            ViewBag.RULEID           = RULEID;
            ViewBag.SCHEMEID         = SCHEMEID;
            return(View());
        }
 /// <summary>
 /// 创建一个合格不合格检定项目
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个合格不合格检定项目</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, QUALIFIED_UNQUALIFIED_TEST_ITE entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
예제 #3
0
        public ActionResult FeiBiaoGe(string PREPARE_SCHEMEID = "", string RULEID = "", string INPUTSTATE = "HGBHG")
        {
            QUALIFIED_UNQUALIFIED_TEST_ITE entity = null;

            ViewBag.ID         = "";
            ViewBag.INPUTSTATE = INPUTSTATE;
            entity             = m_BLL.GetByPREPARE_SCHEMEID_RULEID(PREPARE_SCHEMEID, RULEID);
            if (entity == null)
            {
                entity = new QUALIFIED_UNQUALIFIED_TEST_ITE();
                entity.PREPARE_SCHEMEID = PREPARE_SCHEMEID;
                entity.RULEID           = RULEID;
            }
            else
            {
                ViewBag.ID = entity.ID;
            }

            return(View(entity));
        }
예제 #4
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public Common.ClientResult.Result Post([FromBody] QUALIFIED_UNQUALIFIED_TEST_ITE entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {
                string currentPerson = GetCurrentPerson();
                entity.CREATETIME   = DateTime.Now;
                entity.CREATEPERSON = currentPerson;

                entity.ID = Result.GetNewId();
                string returnValue = string.Empty;
                if (m_BLL.Create(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",合格不合格检定项目的信息的Id为" + entity.ID, "合格不合格检定项目"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.InsertSucceed;
                    return(result); //提示创建成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",合格不合格检定项目的信息," + returnValue, "合格不合格检定项目"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.InsertFail + returnValue;
                    return(result); //提示插入失败
                }
            }

            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
예제 #5
0
        // PUT api/<controller>/5
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Common.ClientResult.Result Put([FromBody] QUALIFIED_UNQUALIFIED_TEST_ITE entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                string currentPerson = GetCurrentPerson();
                entity.UPDATETIME   = DateTime.Now;
                entity.UPDATEPERSON = currentPerson;

                string returnValue = string.Empty;
                if (m_BLL.Edit(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",合格不合格检定项目信息的Id为" + entity.ID, "合格不合格检定项目"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.UpdateSucceed;
                    return(result); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",合格不合格检定项目信息的Id为" + entity.ID + "," + returnValue, "合格不合格检定项目"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            return(result); //提示输入的数据的格式不对
        }
        public ActionResult Detail(string RULEID = "", string SCHEMEID = "", string PREPARE_SCHEMEID = "")
        {
            Account account = GetCurrentAccount();

            if (account != null)
            {
                if (account.UNDERTAKE_LABORATORYName == "电能")
                {
                    ViewBag.UNDERTAKE_LABORATORYName = "display:none";
                }
                else
                {
                    ViewBag.UNDERTAKE_LABORATORYName = "";
                }
            }
            else
            {
                ViewBag.UNDERTAKE_LABORATORYName = "";
            }

            //account.RoleIds
            if (!string.IsNullOrWhiteSpace(PREPARE_SCHEMEID))
            {//预备方案
                QUALIFIED_UNQUALIFIED_TEST_ITE          qEntity = null;
                IBLL.IQUALIFIED_UNQUALIFIED_TEST_ITEBLL qBLL    = new QUALIFIED_UNQUALIFIED_TEST_ITEBLL();
                qEntity = qBLL.GetByPREPARE_SCHEMEID_RULEID(PREPARE_SCHEMEID, RULEID);
                if (qEntity != null)
                {
                    ViewBag.HTMLVALUE = qEntity.HTMLVALUE;
                    ViewBag.ITEID     = qEntity.ID;
                }
                else
                {
                    PREPARE_SCHEME          pEntity = new DAL.PREPARE_SCHEME();
                    IBLL.IPREPARE_SCHEMEBLL pBLL    = new BLL.PREPARE_SCHEMEBLL();
                    pEntity = pBLL.GetById(PREPARE_SCHEMEID);
                    if (pEntity != null)
                    {
                        SCHEMEID = pEntity.SCHEMEID;
                    }
                    //方案
                    DAL.PROJECTTEMPLET entity = m_BLL.GetModelByRULEID_SCHEMEID(RULEID, SCHEMEID);
                    if (entity != null)
                    {
                        ViewBag.ID        = entity.ID;
                        ViewBag.HTMLVALUE = entity.HTMLVALUE;
                    }
                    else
                    {
                        ViewBag.ID = string.Empty;
                    }
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(SCHEMEID))
                {
                    //方案
                    DAL.PROJECTTEMPLET entity = m_BLL.GetModelByRULEID_SCHEMEID(RULEID, SCHEMEID);
                    if (entity != null)
                    {
                        ViewBag.ID        = entity.ID;
                        ViewBag.HTMLVALUE = entity.HTMLVALUE;
                    }
                    else
                    {
                        ViewBag.ID = string.Empty;
                    }
                }
            }

            ViewBag.PREPARE_SCHEMEID = PREPARE_SCHEMEID;
            ViewBag.RULEID           = RULEID;
            ViewBag.SCHEMEID         = SCHEMEID;
            return(View());
        }
예제 #7
0
        /// <summary>
        /// 根据ID获取数据模型
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public QUALIFIED_UNQUALIFIED_TEST_ITE Get(string id)
        {
            QUALIFIED_UNQUALIFIED_TEST_ITE item = m_BLL.GetById(id);

            return(item);
        }
예제 #8
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="ID">原编号</param>
        /// <param name="PREPARE_SCHEMEID">预备方案ID</param>
        /// <param name="RULEID">检测项ID</param>
        /// <param name="CONCLUSION">结论</param>
        /// <param name="REMARK">注</param>
        /// <param name="HTMLVALUE"></param>
        /// <param name="INPUTSTATE">录入格式</param>
        /// <returns></returns>
        public ActionResult Save(string ID = "", string PREPARE_SCHEMEID = "", string RULEID = "", string CONCLUSION = "", string REMARK = "", string HTMLVALUE = "", string INPUTSTATE = "")
        {
            string returnValue = string.Empty;

            Common.ClientResult.Result     result = new Common.ClientResult.Result();
            QUALIFIED_UNQUALIFIED_TEST_ITE entity = new QUALIFIED_UNQUALIFIED_TEST_ITE();
            string currentPerson = GetCurrentPerson();

            entity.CREATETIME       = DateTime.Now;
            entity.CREATEPERSON     = currentPerson;
            entity.RULEID           = RULEID;
            entity.ID               = Result.GetNewId();
            entity.PREPARE_SCHEMEID = PREPARE_SCHEMEID;
            entity.HTMLVALUE        = Server.UrlDecode(HTMLVALUE);//解码
            entity.CONCLUSION       = CONCLUSION;
            entity.REMARK           = REMARK;
            entity.INPUTSTATE       = INPUTSTATE;


            IBLL.IVTEST_ITEBLL vBLL    = new BLL.VTEST_ITEBLL();
            DAL.VTEST_ITE      vEntity = vBLL.GetById(PREPARE_SCHEMEID, RULEID);
            if (vEntity != null)
            {
                entity.RULENAME     = vEntity.NAME;
                entity.RULENJOINAME = vEntity.NAMEOTHER;
                entity.SORT         = vEntity.SORT;
                entity.INPUTSTATE   = vEntity.INPUTSTATE;
            }
            if (vEntity != null && !string.IsNullOrWhiteSpace(vEntity.ID))
            {
                ID = vEntity.ID;
            }
            if (ID != null && ID.Trim() != "")
            {
                if (!m_BLL.Delete(ref validationErrors, ID))
                {
                    LogClassModels.WriteServiceLog(Suggestion.DeleteFail + ",预备方案检测项的Id为" + entity.ID, "预备方案检测项");//写入日志
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.InsertFail + returnValue;
                    return(Json(result)); //提示插入失败
                }
            }


            if (m_BLL.Create(ref validationErrors, entity))
            {
                LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",预备方案检测项的Id为" + entity.ID, "预备方案检测项"
                                               );//写入日志
                result.Code = Common.ClientCode.Succeed;
                //result.Message = Suggestion.InsertSucceed;
                result.Message = entity.ID;
                return(Json(result)); //提示创建成功
            }
            else
            {
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",预备方案检测项," + returnValue, "预备方案检测项"
                                               );//写入日志
                result.Code    = Common.ClientCode.Fail;
                result.Message = Suggestion.InsertFail + returnValue;
                return(Json(result)); //提示插入失败
            }
        }