コード例 #1
0
ファイル: DC_CrossDayLife.cs プロジェクト: uwitec/KMEasyCare
        /// <summary>
        /// 这边是查询的
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public BaseResponse <DayLife> QueryDayLife(int FeeNo, int year, int num)
        {
            //加载子项目
            var response = new BaseResponse <DayLife>();

            //这边获取list的集合
            DayLife CheckReclist = new DayLife();

            DC_DayLifeCarerec DayLifeCarereclist = new DC_DayLifeCarerec();

            DC_DAYLIFECAREREC regQuestion = new DC_DAYLIFECAREREC();

            List <DC_DAYLIFECAREREC> regQuestionlist = new List <DC_DAYLIFECAREREC>();
            //这边默认本周为0

            StringBuilder sb  = new StringBuilder();
            string        sql = string.Format("select * from DC_DAYLIFECAREREC where DC_DAYLIFECAREREC.FEENO='" + FeeNo + "' and DC_DAYLIFECAREREC.WEEKNUMBER='" + num + "' and DATE_FORMAT( current_timestamp(),'%Y' )='" + year + "' and DC_DAYLIFECAREREC.DELFLAG<>1");

            sb.Append(sql);

            //这边默认的是时间

            using (TWSLTCContext context = new TWSLTCContext())
            {
                var daylife = context.Database.SqlQuery <DC_DAYLIFECAREREC>(sb.ToString()).ToList().FirstOrDefault();

                if (daylife != null)
                {
                    DayLifeCarereclist.REGNO          = daylife.REGNO;
                    DayLifeCarereclist.REGNAME        = daylife.REGNAME;
                    DayLifeCarereclist.SEX            = daylife.SEX;
                    DayLifeCarereclist.FAMILYMESSAGE  = daylife.FAMILYMESSAGE;
                    DayLifeCarereclist.CONTACTMATTERS = daylife.CONTACTMATTERS;
                    DayLifeCarereclist.ID             = daylife.ID;
                    DayLifeCarereclist.NURSEAIDES     = daylife.NURSEAIDES;
                    DayLifeCarereclist.RESIDENTNO     = daylife.RESIDENTNO;
                    DayLifeCarereclist.WEEKNUMBER     = Convert.ToString(daylife.WEEKNUMBER);
                    DayLifeCarereclist.WEEKSTARTDATE  = daylife.WEEKSTARTDATE;
                }
            }

            List <DC_DayLifeCaredtl> DayLifeCaredtlist = new List <DC_DayLifeCaredtl>();

            if (DayLifeCarereclist.ID > 0)
            {
                List <DC_DAYLIFECAREDTL> DayLifeCaredtl = unitOfWork.GetRepository <DC_DAYLIFECAREDTL>().dbSet.Where(m => m.ID == DayLifeCarereclist.ID).ToList();

                Mapper.CreateMap <DC_DAYLIFECAREDTL, DC_DayLifeCaredtl>();

                Mapper.Map(DayLifeCaredtl, DayLifeCaredtlist);
            }

            CheckReclist.DayLifeRec     = DayLifeCarereclist;
            CheckReclist.DayLifeCaredtl = DayLifeCaredtlist;

            response.Data = CheckReclist;
            //  response.PagesCount = regQuestionlist.Count;

            return(response);
        }
コード例 #2
0
ファイル: DC_CrossDayLife.cs プロジェクト: uwitec/KMEasyCare
        //点击编辑的历史的记录
        public BaseResponse <DayLife> QueryShowDayLifeList(string id)
        {
            //加载子项目
            var response = new BaseResponse <DayLife>();

            //这边获取list的集合
            DayLife CheckReclist = new DayLife();

            DC_DayLifeCarerec DayLifeCarereclist = new DC_DayLifeCarerec();

            DC_DAYLIFECAREREC regQuestion = new DC_DAYLIFECAREREC();

            var ID = Convert.ToInt32(id);

            // 这边只有一条的信息
            regQuestion = unitOfWork.GetRepository <DC_DAYLIFECAREREC>().dbSet.Where(m => m.ID == ID).OrderByDescending(m => m.CREATEDATE).ToList()[0];



            Mapper.CreateMap <DC_DAYLIFECAREREC, DC_DayLifeCarerec>();

            Mapper.Map(regQuestion, DayLifeCarereclist);

            List <DC_DayLifeCaredtl> DayLifeCaredtlist = new List <DC_DayLifeCaredtl>();

            if (DayLifeCarereclist.ID > 0)
            {
                List <DC_DAYLIFECAREDTL> DayLifeCaredtl = unitOfWork.GetRepository <DC_DAYLIFECAREDTL>().dbSet.Where(m => m.ID == DayLifeCarereclist.ID).ToList();

                Mapper.CreateMap <DC_DAYLIFECAREDTL, DC_DayLifeCaredtl>();

                Mapper.Map(DayLifeCaredtl, DayLifeCaredtlist);
            }

            CheckReclist.DayLifeRec     = DayLifeCarereclist;
            CheckReclist.DayLifeCaredtl = DayLifeCaredtlist;

            response.Data = CheckReclist;

            return(response);
        }