public int Delete(string zaiLiuKaNo)
        {
            ZailiukaInfoEntity  zaiLiuKaInfoEntity  = new ZailiukaInfoEntity();
            QualificationEntity qualificationEntity = new QualificationEntity();
            MotivationEntity    motivationEntity    = new MotivationEntity();

            zaiLiuKaInfoEntity.IncludeAll();
            qualificationEntity.IncludeAll();
            motivationEntity.IncludeAll();

            zaiLiuKaInfoEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            zaiLiuKaInfoEntity = this.ZailiukaInfo.GetSingle(zaiLiuKaInfoEntity);

            //zaiLiuKaInfoEntity.IncludeFlg(true);
            zaiLiuKaInfoEntity.Flg = "0";
            zaiLiuKaInfoEntity.Include(a => new { a.ZaiLiuKaNo, a.UserName, a.Sex, a.Birthday, a.PermitDay, a.Adress, a.UpdateTime, a.Memo, a.Flg });
            zaiLiuKaInfoEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            this.ZailiukaInfo.Update(zaiLiuKaInfoEntity);


            qualificationEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            qualificationEntity = this.Qualification.GetSingle(qualificationEntity);
            //qualificationEntity.IncludeFlg(true);
            qualificationEntity.Flg = "0";
            qualificationEntity.Include(a => new { a.ZaiLiuKaNo, a.Type, a.Memo, a.Flg });
            qualificationEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            this.Qualification.Update(qualificationEntity);


            motivationEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            motivationEntity = this.Motivation.GetSingle(motivationEntity);
            //motivationEntity.IncludeFlg(true);
            motivationEntity.Flg = "0";
            motivationEntity.Include(a => new { a.ZaiLiuKaNo, a.Type, a.Memo, a.Flg });
            motivationEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            int line = this.Motivation.Update(motivationEntity);

            return(line);
        }
        public int Update(ZailiukaDto dto)
        {
            ZailiukaInfoEntity  zaiLiuKaInfoEntity  = new ZailiukaInfoEntity();
            QualificationEntity qualificationEntity = new QualificationEntity();
            MotivationEntity    motivationEntity    = new MotivationEntity();

            zaiLiuKaInfoEntity.IncludeAll();
            qualificationEntity.IncludeAll();
            motivationEntity.IncludeAll();


            zaiLiuKaInfoEntity.ZaiLiuKaNo  = dto.ZaiLiuKaNo;
            qualificationEntity.ZaiLiuKaNo = dto.ZaiLiuKaNo;
            motivationEntity.ZaiLiuKaNo    = dto.ZaiLiuKaNo;

            zaiLiuKaInfoEntity.UserName = dto.UserName;

            zaiLiuKaInfoEntity.Sex        = dto.Sex;
            zaiLiuKaInfoEntity.Birthday   = Convert.ToDateTime(dto.Birthday);
            zaiLiuKaInfoEntity.PermitDay  = dto.PermitDay;
            zaiLiuKaInfoEntity.Adress     = dto.Adress;
            zaiLiuKaInfoEntity.UpdateTime = DateTime.Now;
            zaiLiuKaInfoEntity.Flg        = "1";



            qualificationEntity.Type       = dto.Qualification;
            qualificationEntity.UpdateTime = DateTime.Now;
            qualificationEntity.Memo       = "無し";
            qualificationEntity.Flg        = "1";


            motivationEntity.Type       = dto.Motivation;
            motivationEntity.UpdateTime = DateTime.Now;
            motivationEntity.Memo       = "無し";
            motivationEntity.Flg        = "1";
            zaiLiuKaInfoEntity.Include(a => new { a.ZaiLiuKaNo, a.UserName, a.Sex, a.Birthday, a.PermitDay, a.Adress, a.UpdateTime, a.Memo, a.Flg });
            zaiLiuKaInfoEntity.Where(a => a.ZaiLiuKaNo == dto.ZaiLiuKaNo);
            this.ZailiukaInfo.Update(zaiLiuKaInfoEntity);

            qualificationEntity.Include(a => new { a.ZaiLiuKaNo, a.Type, a.Memo, a.Flg });
            qualificationEntity.Where(a => a.ZaiLiuKaNo == dto.ZaiLiuKaNo);
            this.Qualification.Update(qualificationEntity);

            motivationEntity.Include(a => new { a.ZaiLiuKaNo, a.Type, a.Memo, a.Flg });
            motivationEntity.Where(a => a.ZaiLiuKaNo == dto.ZaiLiuKaNo);
            int line = this.Motivation.Update(motivationEntity);

            return(line);
        }
        public ZailiukaDto SelectByNo(string zaiLiuKaNo)
        {
            ZailiukaInfoEntity  zaiLiuKaInfoEntity  = new ZailiukaInfoEntity();
            QualificationEntity qualificationEntity = new QualificationEntity();
            MotivationEntity    motivationEntity    = new MotivationEntity();

            zaiLiuKaInfoEntity.IncludeAll();
            qualificationEntity.IncludeAll();
            motivationEntity.IncludeAll();

            zaiLiuKaInfoEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
            zaiLiuKaInfoEntity = this.ZailiukaInfo.GetSingle(zaiLiuKaInfoEntity);

            if (zaiLiuKaInfoEntity.Flg == "1")
            {
                qualificationEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
                qualificationEntity = this.Qualification.GetSingle(qualificationEntity);

                motivationEntity.Where(a => a.ZaiLiuKaNo == zaiLiuKaNo);
                motivationEntity = this.Motivation.GetSingle(motivationEntity);

                ZailiukaDto dto = new ZailiukaDto();
                dto.ZaiLiuKaNo    = zaiLiuKaInfoEntity.ZaiLiuKaNo;
                dto.UserName      = zaiLiuKaInfoEntity.UserName;
                dto.Birthday      = zaiLiuKaInfoEntity.Birthday.ToString();
                dto.Sex           = zaiLiuKaInfoEntity.Sex;
                dto.Qualification = qualificationEntity.Type;
                dto.Adress        = zaiLiuKaInfoEntity.Adress;
                dto.Motivation    = motivationEntity.Type;
                dto.PermitDay     = zaiLiuKaInfoEntity.PermitDay;

                return(dto);
            }

            else
            {
                return(null);
            }
        }