Esempio n. 1
0
        public async Task <AddMotherResponse> AddMotherDetail(AddMotherRequest mrData)
        {
            var motherResponse = new AddMotherResponse();

            try
            {
                var msg = CheckErrorMessage(mrData);
                if (msg == "")
                {
                    var motherDetail = _motherData.AddMotherDetail(mrData);

                    motherResponse.Status          = "true";
                    motherResponse.Message         = motherDetail.responseMsg;
                    motherResponse.MotherSubjectId = motherDetail.subjectId;
                }
                else
                {
                    motherResponse.Status  = "false";
                    motherResponse.Message = msg;
                }
            }
            catch (Exception e)
            {
                motherResponse.Status  = "false";
                motherResponse.Message = e.Message;
            }
            return(motherResponse);
        }
Esempio n. 2
0
        public string CheckErrorMessage(AddMotherRequest mrData)
        {
            var message = "";

            if (mrData.districtId <= 0)
            {
                message = "Invalid District Id";
            }
            else if (mrData.hospitalId <= 0)
            {
                message = "Invalid Hospital Id";
            }
            else if (mrData.hospitalNo == "")
            {
                message = "Invalid Hospital No";
            }
            else if (mrData.dateofRegistration == "")
            {
                message = "Invalid date of registration";
            }
            else if (mrData.motherFirstName == "")
            {
                message = "Invalid Mother name";
            }
            else if (mrData.stateId <= 0)
            {
                message = "Invalid state";
            }
            return(message);
        }
Esempio n. 3
0
        public async Task <IActionResult> AddMotherDetail(AddMotherRequest mrData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Adding mother detail - {JsonConvert.SerializeObject(mrData)}");
            var motherResponse = await _motherService.AddMotherDetail(mrData);

            return(Ok(new AddMotherResponse
            {
                Status = motherResponse.Status,
                Message = motherResponse.Message,
                MotherSubjectId = motherResponse.MotherSubjectId,
            }));
        }
Esempio n. 4
0
 public MotherRegistration AddMotherDetail(AddMotherRequest mrData)
 {
     try
     {
         string stProc = AddMothersDetail;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@MotherSubjectId", mrData.motherSubjectId.ToCheckNull()),
             new SqlParameter("@DateofRegistration", mrData.dateofRegistration),
             new SqlParameter("@DistrictID", mrData.districtId),
             new SqlParameter("@HospitalId", mrData.hospitalId),
             new SqlParameter("@HospitalNo", mrData.hospitalNo ?? mrData.hospitalNo),
             new SqlParameter("@CollectionSiteId", mrData.collectionSiteId),
             new SqlParameter("@MotherFirstName", mrData.motherFirstName),
             new SqlParameter("@MotherLastName", mrData.motherLastName.ToCheckNull()),
             new SqlParameter("@DOB", mrData.dob.ToCheckNull()),
             new SqlParameter("@Age", mrData.age),
             new SqlParameter("@RCHID", mrData.rchId),
             new SqlParameter("@MotherGovIdTypeId", mrData.motherGovIdTypeId),
             new SqlParameter("@MotherGovIdDetail", mrData.motherGovIdDetail.ToCheckNull()),
             new SqlParameter("@MotherContactNo", mrData.motherContactNo.ToCheckNull()),
             new SqlParameter("@G", mrData.g),
             new SqlParameter("@P", mrData.p),
             new SqlParameter("@L", mrData.l),
             new SqlParameter("@A", mrData.a),
             new SqlParameter("@ECNumber", mrData.ecNumber.ToCheckNull()),
             new SqlParameter("@Address1", mrData.address1.ToCheckNull()),
             new SqlParameter("@Address2", mrData.address2.ToCheckNull()),
             new SqlParameter("@Address3", mrData.address3.ToCheckNull()),
             new SqlParameter("@StateId", mrData.stateId),
             new SqlParameter("@Pincode", mrData.pincode.ToCheckNull()),
             new SqlParameter("@ReligionId", mrData.religionId),
             new SqlParameter("@CasteId", mrData.casteId),
             new SqlParameter("@CommunityId", mrData.communityId),
             new SqlParameter("@FatherFirstName", mrData.fatherFirstName.ToCheckNull()),
             new SqlParameter("@FatherLastName", mrData.fatherLastName.ToCheckNull()),
             new SqlParameter("@FatherContactNo", mrData.fatherContactNo.ToCheckNull()),
             new SqlParameter("@GuardianFirstName", mrData.guardianFirstName.ToCheckNull()),
             new SqlParameter("@GuardianLastName", mrData.guardianLastName.ToCheckNull()),
             new SqlParameter("@GuardianContactNo", mrData.guardianContactNo.ToCheckNull()),
             new SqlParameter("@UserId", mrData.userId),
         };
         var motherDet = UtilityDL.FillEntity <MotherRegistration>(stProc, pList);
         return(motherDet);
     }
     catch (Exception e)
     {
         throw e;
     }
 }