Ejemplo n.º 1
0
 public ANMCreation AddNewANM(AddANMRequest addUser, string password)
 {
     try
     {
         var stProc = AddANMUser;
         var pList  = new List <SqlParameter>()
         {
             new SqlParameter("@User_gov_code", addUser.userGovCode),
             new SqlParameter("@Password", password),
             new SqlParameter("@DistrictID", addUser.districtId),
             new SqlParameter("@BlockID", addUser.blockId),
             new SqlParameter("@CHCID", addUser.chcId),
             new SqlParameter("@PHCID", addUser.phcId),
             new SqlParameter("@SCID", addUser.scId),
             new SqlParameter("@RIID", addUser.riId ?? addUser.riId),
             new SqlParameter("@FirstName", addUser.firstName ?? addUser.firstName),
             new SqlParameter("@MiddleName", addUser.middleName.ToCheckNull()),
             new SqlParameter("@LastName", addUser.lastName.ToCheckNull()),
             new SqlParameter("@ContactNo1", addUser.contactNo1 ?? addUser.contactNo1),
             new SqlParameter("@ContactNo2", addUser.contactNo2.ToCheckNull()),
             new SqlParameter("@Email", addUser.email.ToCheckNull()),
             new SqlParameter("@GovIDType_ID", addUser.govIdTypeId),
             new SqlParameter("@GovIDDetails", addUser.govIdDetails.ToCheckNull()),
             new SqlParameter("@Address", addUser.address.ToCheckNull()),
             new SqlParameter("@Pincode", addUser.pincode.ToCheckNull()),
             new SqlParameter("@UserId", addUser.userId),
         };
         var allData = UtilityDL.FillEntity <ANMCreation>(stProc, pList);
         return(allData);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddANMUser(AddANMRequest aData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request- {JsonConvert.SerializeObject(aData)}");
            var data = await _supportService.AddNewANMUser(aData);

            _logger.LogInformation($"Add new ANM Data {data}");
            _logger.LogDebug($"Response Adding new ANM Data - {JsonConvert.SerializeObject(data)}");
            return(Ok(new AddANMResponse
            {
                Status = data.Status,
                Message = data.Message,
            }));
        }
Ejemplo n.º 3
0
        public string CheckValANM(AddANMRequest aData)
        {
            string msg = "";

            if (string.IsNullOrEmpty(aData.userGovCode))
            {
                msg = "ANM Code is missing";
            }
            else if (aData.districtId <= 0)
            {
                msg = "Invalid district id";
            }
            else if (aData.blockId <= 0)
            {
                msg = "Invalid block id";
            }
            else if (aData.chcId <= 0)
            {
                msg = "Invalid chc id";
            }
            else if (aData.phcId <= 0)
            {
                msg = "Invalid phc id";
            }
            else if (aData.scId <= 0)
            {
                msg = "Invalid SC id";
            }
            else if (string.IsNullOrEmpty(aData.riId))
            {
                msg = "RIID is missing";
            }
            else if (string.IsNullOrEmpty(aData.firstName))
            {
                msg = "First Name is missing";
            }
            else if (string.IsNullOrEmpty(aData.contactNo1))
            {
                msg = "Contact No is missing";
            }
            else if (aData.userId <= 0)
            {
                msg = "Invalid user id";
            }
            return(msg);
        }
Ejemplo n.º 4
0
        public async Task <AddANMResponse> AddNewANMUser(AddANMRequest aData)
        {
            var    sResponse = new AddANMResponse();
            string message   = CheckValANM(aData);

            try
            {
                if (message == "")
                {
                    var hashPassword = BCrypt.Net.BCrypt.HashPassword("odisha");
                    var result       = _supportData.AddNewANM(aData, hashPassword);
                    if (result.success == true)
                    {
                        sResponse.Status  = "true";
                        sResponse.Message = result.msg;
                        return(sResponse);
                    }
                    else
                    {
                        sResponse.Status  = "false";
                        sResponse.Message = result.msg;
                        return(sResponse);
                    }
                }
                else
                {
                    sResponse.Status  = "false";
                    sResponse.Message = message;
                    return(sResponse);
                }
            }
            catch (Exception e)
            {
                sResponse.Status  = "false";
                sResponse.Message = $"Unable to add the new ANM - {e.Message}";
                return(sResponse);
            }
        }