コード例 #1
0
        public ActionResult CreatOrUpdateSelfRepairPlanByEngr(int appId, int selfRepairPlanId, string steps, string tools, double timecost, string isspare, string spareparts, string type)
        {
            bool result = false;
            SelfRepairPlanDto selfRepairPlanDto = new SelfRepairPlanDto();

            selfRepairPlanDto.Step            = steps;
            selfRepairPlanDto.Tool            = tools;
            selfRepairPlanDto.TimeCost        = timecost;
            selfRepairPlanDto.IsUseSpareParts = isspare;
            selfRepairPlanDto.SparePartsInfo  = spareparts;
            var selfRepairPlan = Mapper.Map <SelfRepairPlanDto, SelfRepairPlan>(selfRepairPlanDto);
            int selfPlanId     = 0;

            if (string.Equals(type, "Create"))
            {
                result = repairDAL.InsertNewSelfRepairPlan(selfRepairPlan, appId, out selfPlanId);
            }
            if (string.Equals(type, "modify"))
            {
                result = repairDAL.UpdateSelfRepairPlan(selfRepairPlan, selfRepairPlanId);
            }
            if (result)
            {
                return(Content(new { msg = "成功", status = "success", phase = CurrentStatus.自修方案待审.ToString(), methodCategory = MethodCategory.自修.ToString(), SelfRepairPlanID = selfPlanId }.ToJsonString()));
            }
            else
            {
                return(Content(new { msg = "失败", status = "failed" }.ToJsonString()));
            }
        }
コード例 #2
0
        public ActionResult GetSelfRepairPlanByAppId(int selfRepairPlanId)
        {
            SelfRepairPlan    resultM   = repairDAL.SelfRepairPlanByAppId(selfRepairPlanId);
            SelfRepairPlanDto resultDto = Mapper.Map <SelfRepairPlan, SelfRepairPlanDto>(resultM);

            if (resultDto != null)
            {
                return(Content(new { msg = "找到方案", status = "success", data = resultDto }.ToJsonString()));
            }
            else
            {
                return(Content(new { msg = "未找到方案", status = "failed" }.ToJsonString()));
            }
        }