예제 #1
0
 public object ChangeStatus(string remarks, [FromBody] Reginfo reginfo)
 {
     try
     {
         if (reginfo.Status != "C")
         {
             var messege = kycService.ChangeStatus(remarks, reginfo);
             if (messege.ToString() == "OK")
             {
                 return(Ok(new
                 {
                     Status = HttpStatusCode.OK,
                     Messege = "Action Perform Successfull",
                     Erros = String.Empty
                 }));
             }
             else
             {
                 return(Ok(new
                 {
                     Status = HttpStatusCode.BadRequest,
                     Messege = "Action Perform Failed",
                     Erros = String.Empty
                 }));
             }
         }
         else
         {
             var messege = (Tuple <string, string>)kycService.ChangeStatus(remarks, reginfo);
             if (messege.Item1 == "0")
             {
                 return(Ok(new
                 {
                     Status = HttpStatusCode.BadRequest,
                     Messege = messege.Item2,
                     Erros = String.Empty
                 }));
             }
             else
             {
                 return(Ok(new
                 {
                     Status = HttpStatusCode.OK,
                     Messege = messege.Item2,
                     Erros = String.Empty
                 }));
             }
         }
     }
     catch (Exception ex)
     {
         errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
         return(Ok(new
         {
             Status = HttpStatusCode.BadRequest,
             Messege = "Internal Server Error",
             Erros = String.Empty
         }));
     }
 }
예제 #2
0
        public JsonResult updatePassword(Reginfo info)
        {
            string       status  = String.Empty;
            User_Backend backend = new User_Backend();

            if (backend.checkForOtp(info) == "OtpFound")
            {
                if (backend.updateDetails(info))
                {
                    status = "success";
                    return(Json(status, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    status = "failed";
                    return(Json(status, JsonRequestBehavior.AllowGet));
                }
            }
            else if (backend.checkForOtp(info) == "OtpExpired")
            {
                status = "OtpExpired";
                return(Json(status, JsonRequestBehavior.AllowGet));
            }
            else if (backend.checkForOtp(info) == "OtpNotMatch")
            {
                status = "OtpNotMatch";
                return(Json(status, JsonRequestBehavior.AllowGet));
            }
            else
            {
                status = "failed";
                return(Json(status, JsonRequestBehavior.AllowGet));
            }
        }
예제 #3
0
        private Reginfo GetConvertedReginfoModel(Reginfo aReginfo)
        {
            Base64Conversion base64Conversion = new Base64Conversion();

            if (!string.IsNullOrEmpty(aReginfo.FatherName) && !base64Conversion.IsLetterEnglish(aReginfo.FatherName))
            {
                aReginfo.FatherName = base64Conversion.EncodeBase64(aReginfo.FatherName);
            }
            if (!string.IsNullOrEmpty(aReginfo.MotherName) && !base64Conversion.IsLetterEnglish(aReginfo.MotherName))
            {
                aReginfo.MotherName = base64Conversion.EncodeBase64(aReginfo.MotherName);
            }
            if (!string.IsNullOrEmpty(aReginfo.SpouseName) && !base64Conversion.IsLetterEnglish(aReginfo.SpouseName))
            {
                aReginfo.SpouseName = base64Conversion.EncodeBase64(aReginfo.SpouseName);
            }
            if (!string.IsNullOrEmpty(aReginfo.PerAddr) && !base64Conversion.IsLetterEnglish(aReginfo.PerAddr))
            {
                aReginfo.PerAddr = base64Conversion.EncodeBase64(aReginfo.PerAddr);
            }
            if (!string.IsNullOrEmpty(aReginfo.PreAddr) && !base64Conversion.IsLetterEnglish(aReginfo.PreAddr))
            {
                aReginfo.PreAddr = base64Conversion.EncodeBase64(aReginfo.PreAddr);
            }
            return(aReginfo);
        }
예제 #4
0
 public object AddRemoveLien(string remarks, [FromBody] Reginfo reginfo)
 {
     try
     {
         return(kycService.AddRemoveLien(remarks, reginfo));
     }
     catch (Exception ex)
     {
         return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
     }
 }
예제 #5
0
 public object SaveChildMerchant(bool isEditMode, string evnt, [FromBody] Reginfo regInfo)
 {
     try
     {
         return(_MerchantService.SaveChildMerchant(isEditMode, evnt, regInfo));
     }
     catch (Exception ex)
     {
         return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
     }
 }
 public object SaveEnterPrise(bool isEdit, string evnt, [FromBody] Reginfo aReginfo)
 {
     try
     {
         return(enterpriseService.Save(aReginfo, isEdit, evnt));
     }
     catch (Exception ex)
     {
         return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
     }
 }
예제 #7
0
 public object BlackListClient(string remarks, [FromBody] Reginfo reginfo)
 {
     try
     {
         return(kycService.BlackListClient(remarks, reginfo));
     }
     catch (Exception ex)
     {
         errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
         return(HttpStatusCode.BadRequest);
     }
 }
예제 #8
0
 public object OnReleaseBindDevice([FromBody] Reginfo reginfo)
 {
     try
     {
         kycService.OnReleaseBindDevice(reginfo.Mphone, reginfo.UpdateBy);
         return(HttpStatusCode.OK);
     }
     catch (Exception ex)
     {
         errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
         return(HttpStatusCode.BadRequest);
     }
 }
예제 #9
0
        public JsonResult updateOTP(Reginfo info)
        {
            User_Backend backend = new User_Backend();

            if (backend.InsertOrUpdateOTP(info))
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
예제 #10
0
 public object UpdetKyc([FromBody] Reginfo reginfo)
 {
     try
     {
         var    prevModel      = kycService.GetRegInfoByMphone(reginfo.Mphone);
         object currentReginfo = null;
         reginfo.UpdateDate = System.DateTime.Now;
         if (prevModel != null)
         {
             currentReginfo = kycService.UpdetKyc(reginfo);
             kycService.InsertUpdatedModelToAuditTrailForUpdateKyc(reginfo, prevModel, reginfo.UpdateBy, 3, 4, "Distributor", reginfo.Mphone, "Update successfully");
         }
         return(currentReginfo);
     }
     catch (Exception ex)
     {
         errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
         throw ex;
     }
 }
예제 #11
0
 public object SaveCustomer(bool isEdit, string evnt, [FromBody] Reginfo aReginfo)
 {
     try
     {
         var result = _customerSevice.SaveCustomer(aReginfo, isEdit, evnt);
         if (result.ToString() == "Unauthorized")
         {
             return(StatusCode(StatusCodes.Status401Unauthorized));
         }
         else
         {
             return(result);
         }
     }
     catch (Exception ex)
     {
         errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
         return(HttpStatusCode.BadRequest);
     }
 }
예제 #12
0
        private object AuditTrailForAddRemoveDormant(DormantAcc dormantModel, Reginfo prevReginfo, string status)
        {
            Reginfo    currentReginfo = (Reginfo)_kycService.GetRegInfoByMphone(dormantModel.Mphone);
            var        diffList       = auditTrailService.GetAuditTrialFeildByDifferenceBetweenObject(currentReginfo, prevReginfo);
            AuditTrail auditTrail     = new AuditTrail();

            auditTrail.Who               = dormantModel._ActionBy;
            auditTrail.WhatActionId      = 4;
            auditTrail.WhichParentMenuId = 2;
            auditTrail.WhichMenu         = "Client Profile";
            auditTrail.WhichId           = dormantModel.Mphone;
            if (status == "D")
            {
                auditTrail.Response = "Revoked from Dormant Successfully";
            }
            else
            {
                auditTrail.Response = "Dormant Perform Successfully";
            }
            auditTrail.InputFeildAndValue = diffList;
            auditTrailService.InsertIntoAuditTrail(auditTrail);
            return(currentReginfo);
        }
예제 #13
0
        public object PinReset([FromBody] Reginfo model, bool isUnlockRequest = false)
        {
            try
            {
                int fourDigitRandomNo = new Random().Next(1000, 9999);
                model.UpdateDate = DateTime.Now;
                CustomerRequest customerRequest = new CustomerRequest
                {
                    Mphone    = model.Mphone,
                    ReqDate   = DateTime.Now,
                    HandledBy = model.UpdateBy,
                    Remarks   = model.Remarks,
                    Request   = "Pin Reset",
                    Status    = "Y"
                };
                Reginfo prevAReginfo = (Reginfo)_kycService.GetRegInfoByMphone(model.Mphone);
                _DsrService.UpdatePinNo(model.Mphone, fourDigitRandomNo.ToString());
                customerRequestService.Add(customerRequest);
                var convertedModel = GetConvertedReginfoModel(model);
                _distributorService.UpdateRegInfo(convertedModel);
                Reginfo currentReginfo = (Reginfo)_kycService.GetRegInfoByMphone(model.Mphone);
                var     diffList       = auditTrailService.GetAuditTrialFeildByDifferenceBetweenObject(currentReginfo, prevAReginfo);
                if (!isUnlockRequest)
                {
                    AuditTrail auditTrail = new AuditTrail();
                    auditTrail.Who                = model.UpdateBy;
                    auditTrail.WhatActionId       = 4;
                    auditTrail.WhichParentMenuId  = 2;
                    auditTrail.WhichMenu          = "KYC Profile";
                    auditTrail.InputFeildAndValue = diffList;
                    auditTrail.WhichId            = model.Mphone;
                    auditTrail.Response           = "Success! Pin Reset Successfully";
                    auditTrailService.InsertIntoAuditTrail(auditTrail);
                }
                else
                {
                    AuditTrail auditTrail = new AuditTrail();
                    auditTrail.Who                = model.UpdateBy;
                    auditTrail.WhatActionId       = 4;
                    auditTrail.WhichParentMenuId  = 2;
                    auditTrail.WhichMenu          = "KYC Profile";
                    auditTrail.InputFeildAndValue = diffList;
                    auditTrail.WhichId            = model.Mphone;
                    auditTrail.Response           = "Success! Account Unlocked Successfully";
                    auditTrailService.InsertIntoAuditTrail(auditTrail);
                }

                string messagePrefix = isUnlockRequest == true ? "Your Account Has been Unlocked. Your new Pin is " : "Your Pin has successfully been reset to ";

                MessageModel messageModel = new MessageModel()
                {
                    Mphone      = model.Mphone,
                    MessageId   = "999",
                    MessageBody = "Dear User, " + messagePrefix + fourDigitRandomNo.ToString() + ". Thank you for using OKWallet."
                };

                MessageService messageService = new MessageService();
                messageService.SendMessage(messageModel);

                return(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
                return(HttpStatusCode.BadRequest);
            }
        }
예제 #14
0
        public async Task <object> GetCbsAccInfo(string mphone, string bankAcNo)
        {
            try
            {
                if (!String.IsNullOrEmpty(mphone) && !String.IsNullOrEmpty(bankAcNo))
                {
                    var customerInfo = _customerSevice.GetCustomerByMphone(mphone);
                    if (customerInfo == null)
                    {
                        CbsApiInfo      apiInfo         = new CbsApiInfo();
                        CbsCustomerInfo cbsCustomerInfo = new CbsCustomerInfo();
                        Reginfo         reginfo         = new Reginfo();
                        dynamic         apiResponse     = null;
                        bool            isMphoneSame    = false;
                        bool            isNidValid      = false;
                        bool            isNidExist      = false;
                        using (var httpClient = new HttpClient())
                        {
                            using (var response = await httpClient.GetAsync(apiInfo.Ip + apiInfo.ApiUrl + bankAcNo))
                            {
                                apiResponse = await response.Content.ReadAsStringAsync();

                                cbsCustomerInfo = JsonConvert.DeserializeObject <CbsCustomerInfo>(apiResponse);
                            }
                        }

                        if (cbsCustomerInfo == null)
                        {
                            return(Ok(new
                            {
                                Status = HttpStatusCode.NotAcceptable,
                                Model = string.Empty,
                                Erros = "No Cbs Account Found"
                            }));
                        }

                        if (cbsCustomerInfo != null)
                        {
                            isMphoneSame = _customerSevice.IsMobilePhoneMatch(mphone, cbsCustomerInfo);
                            reginfo      = _customerSevice.ConvertCbsPullToregInfo(cbsCustomerInfo);
                        }
                        if (!string.IsNullOrEmpty(reginfo.PhotoId))
                        {
                            isNidValid = CheckIsNidIsValid(reginfo.PhotoId);
                            isNidExist = CheckIsNidIsExist(reginfo.PhotoId);
                        }
                        if (!isNidValid)
                        {
                            return(Ok(new
                            {
                                Status = HttpStatusCode.NotAcceptable,
                                Model = string.Empty,
                                Erros = "Invalid Photo Id"
                            }));
                        }
                        if (isNidExist)
                        {
                            return(Ok(new
                            {
                                Status = HttpStatusCode.NotAcceptable,
                                Model = string.Empty,
                                Erros = "Photo Id already exist"
                            }));
                        }
                        if (reginfo.Mphone.Length != 11)
                        {
                            return(Ok(new
                            {
                                Status = HttpStatusCode.NotAcceptable,
                                Model = string.Empty,
                                Erros = "Mobile No Should be 11 digit"
                            }));
                        }
                        if (isMphoneSame)
                        {
                            return(Ok(new
                            {
                                Status = HttpStatusCode.OK,
                                Model = reginfo,
                                Erros = String.Empty
                            }));
                        }
                        else
                        {
                            return(Ok(new
                            {
                                Status = HttpStatusCode.NotAcceptable,
                                Model = string.Empty,
                                Erros = "Mobile No Mismatched"
                            }));
                        }
                    }
                    else
                    {
                        return(Ok(new
                        {
                            Status = HttpStatusCode.NotAcceptable,
                            Model = string.Empty,
                            Erros = "Customer is already Exist"
                        }));
                    }
                }
                else
                {
                    return(Ok(new
                    {
                        Status = HttpStatusCode.NotAcceptable,
                        Model = string.Empty,
                        Erros = "Invalid Input"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Ok(new
                {
                    Status = HttpStatusCode.ExpectationFailed,
                    Model = string.Empty,
                    Erros = ex.Message.ToString()
                }));
            }
        }
        public string BulkUploadExcel(string bulkUploadType, string distributorAC, string distributorCode, string distributorName)
        {
            string message             = "";
            string duplicateMsg        = "";
            HttpResponseMessage result = null;
            var httpRequest            = HttpContext.Current.Request;

            if (httpRequest.Files.Count > 0)
            {
                HttpPostedFile file   = httpRequest.Files[0];
                Stream         stream = file.InputStream;

                IExcelDataReader reader = null;

                if (file.FileName.EndsWith(".xls"))
                {
                    reader = ExcelReaderFactory.CreateBinaryReader(stream);
                }
                else if (file.FileName.EndsWith(".xlsx"))
                {
                    reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                }
                else
                {
                    message = "This file format is not supported";
                }

                DataSet excelRecords = reader.AsDataSet();
                reader.Close();

                var finalRecords = excelRecords.Tables[0];


                string agentCode = null;
                if (bulkUploadType == "Agent")
                {
                    string firstClusterCode = _agentService.GetClusterCodeByTerritoryCode(distributorCode.Substring(0, 6));
                    agentCode = Convert.ToString(_agentService.GenerateAgentCodeAsString(firstClusterCode));
                }


                for (int i = 1; i < finalRecords.Rows.Count; i++)
                {
                    if (_distributorService.IsExistsByMpohne(finalRecords.Rows[i][0].ToString()) == false)
                    {
                        Reginfo objReginfo       = new Reginfo();
                        bool    isDuplicateFound = false;
                        objReginfo.Mphone   = finalRecords.Rows[i][0].ToString();
                        objReginfo.BankAcNo = finalRecords.Rows[i][1].ToString();
                        if (bulkUploadType == "Distributor")
                        {
                            objReginfo.CatId = "D";
                        }
                        else if (bulkUploadType == "Agent")
                        {
                            objReginfo.CatId    = "A";
                            objReginfo.DistCode = agentCode;
                        }
                        else
                        {
                            objReginfo.CatId = "C";
                        }

                        if (_distributorService.IsExistsByCatidPhotoId(objReginfo.CatId, finalRecords.Rows[i][13].ToString()) == true)
                        {
                            if (!string.IsNullOrEmpty(duplicateMsg))
                            {
                                duplicateMsg = duplicateMsg + " , Photo duplicate for " + finalRecords.Rows[i][0].ToString();
                            }
                            else
                            {
                                duplicateMsg = "Photo duplicate for " + finalRecords.Rows[i][0].ToString();
                            }

                            isDuplicateFound = true;
                        }


                        if (isDuplicateFound == false)
                        {
                            objReginfo.Pmphone         = finalRecords.Rows[i][3].ToString();
                            objReginfo.BranchCode      = finalRecords.Rows[i][4].ToString();
                            objReginfo.DateOfBirth     = Convert.ToDateTime(finalRecords.Rows[i][5]);
                            objReginfo.Name            = finalRecords.Rows[i][6].ToString();
                            objReginfo.FatherName      = finalRecords.Rows[i][7].ToString();
                            objReginfo.MotherName      = finalRecords.Rows[i][8].ToString();
                            objReginfo.SpouseName      = finalRecords.Rows[i][9].ToString();
                            objReginfo.Gender          = finalRecords.Rows[i][10].ToString();
                            objReginfo.PhotoIdTypeCode = Convert.ToInt32(finalRecords.Rows[i][12]);
                            objReginfo.PhotoId         = finalRecords.Rows[i][13].ToString();
                            objReginfo.TinNo           = finalRecords.Rows[i][14].ToString();
                            objReginfo.Religion        = finalRecords.Rows[i][15].ToString();
                            objReginfo.Occupation      = finalRecords.Rows[i][16].ToString();
                            objReginfo.OffMailAddr     = finalRecords.Rows[i][17].ToString();
                            objReginfo.LocationCode    = finalRecords.Rows[i][18].ToString();

                            //objReginfo.DistCode = agentCode;
                            objReginfo.PreAddr = finalRecords.Rows[i][22].ToString();
                            objReginfo.PerAddr = finalRecords.Rows[i][23].ToString();

                            _distributorService.Add(objReginfo);
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(duplicateMsg))
                        {
                            duplicateMsg = duplicateMsg + " , " + finalRecords.Rows[i][0].ToString();
                        }
                        else
                        {
                            duplicateMsg = finalRecords.Rows[i][0].ToString();
                        }
                    }
                }
                //isUploaded = true;
                if (!string.IsNullOrEmpty(duplicateMsg))
                {
                    //message = "Excel file has been successfully uploaded";
                    message = "Uploaded but following are duplicate : " + duplicateMsg;
                }
                else
                {
                    //message = "Excel file uploaded has fiald";
                    message = "Excel file has been successfully uploaded";
                }
            }

            else
            {
                result = Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            return(message);
        }
예제 #16
0
        public object SaveB2bDistributor(bool isEditMode, string evnt, [FromBody] Reginfo regInfo)
        {
            try
            {
                if (isEditMode != true)
                {
                    if (!string.IsNullOrEmpty(regInfo.DistCode) && !string.IsNullOrEmpty(regInfo.Pmphone) && !string.IsNullOrEmpty(regInfo.EntryBy))
                    {
                        regInfo.CatId      = "ABD";
                        regInfo.AcTypeCode = 1;
                        regInfo.PinStatus  = "N";
                        regInfo.RegSource  = "P";
                        regInfo.RegDate    = regInfo.RegDate + DateTime.Now.TimeOfDay;
                        regInfo.EntryDate  = System.DateTime.Now;
                        string distCode        = regInfo.DistCode.Substring(0, 10);
                        var    isDistCodeExist = _kycService.CheckIsDistCodeExistForB2b(regInfo.DistCode);
                        if (Convert.ToInt32(isDistCodeExist) == 1)
                        {
                            var newDistCode = _locationService.GenerateB2bDistributorCode(distCode);
                            regInfo.DistCode = newDistCode.ToString().Substring(0, 16);
                        }

                        try
                        {
                            _distributorService.Add(regInfo);
                            _kycService.InsertModelToAuditTrail(regInfo, regInfo.EntryBy, 3, 3, "B2B Distributor", regInfo.Mphone, "Save successfully");
                            return(HttpStatusCode.OK);
                        }
                        catch (Exception ex)
                        {
                            return(HttpStatusCode.BadRequest);
                        }
                    }
                    else
                    {
                        return(HttpStatusCode.BadRequest);
                    }
                }
                else
                {
                    if (evnt == "edit")
                    {
                        regInfo.UpdateDate = System.DateTime.Now;
                        var prevModel = _kycService.GetRegInfoByMphone(regInfo.Mphone);
                        _distributorService.UpdateRegInfo(regInfo);
                        var currentModel = _kycService.GetRegInfoByMphone(regInfo.Mphone);
                        _kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, regInfo.UpdateBy, 3, 4, "B2B Distributor", regInfo.Mphone, "Update successfully");
                        return(HttpStatusCode.OK);
                    }
                    else
                    {
                        var checkStatus = _kycService.CheckPinStatus(regInfo.Mphone);
                        if (checkStatus.ToString() != "P")
                        {
                            regInfo.RegStatus = "P";
                            int fourDigitRandomNo = new Random().Next(1000, 9999);

                            regInfo.AuthoDate = System.DateTime.Now;
                            //regInfo.RegDate = _kycService.GetRegDataByMphoneCatID(regInfo.Mphone, "D");
                            var prevModel = _kycService.GetRegInfoByMphone(regInfo.Mphone);
                            _distributorService.UpdateRegInfo(regInfo);
                            _DsrService.UpdatePinNo(regInfo.Mphone, fourDigitRandomNo.ToString());
                            var currentModel = _kycService.GetRegInfoByMphone(regInfo.Mphone);
                            _kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, regInfo.AuthoBy, 3, 4, "B2B Distributor", regInfo.Mphone, "Register successfully");
                            //_DsrService.UpdatePinNo(regInfo.Mphone, fourDigitRandomNo.ToString());
                            MessageService service = new MessageService();
                            service.SendMessage(new MessageModel()
                            {
                                Mphone      = regInfo.Mphone,
                                MessageId   = "999",
                                MessageBody = "Congratulations! Your OK wallet has been opened successfully." + " Your Pin is "
                                              + fourDigitRandomNo.ToString() + ", please change PIN to activate your account, "
                            });

                            return(HttpStatusCode.OK);
                        }
                        else
                        {
                            return(HttpStatusCode.OK);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
                return(HttpStatusCode.BadRequest);
            }
        }
예제 #17
0
        public object SaveAgent(bool isEditMode, string evnt, [FromBody] Reginfo regInfo)
        {
            try
            {
                if (isEditMode != true)
                {
                    int fourDigitRandomNo = new Random().Next(1000, 9999);
                    try
                    {
                        if (string.IsNullOrEmpty(regInfo.Pmphone))
                        {
                            return(HttpStatusCode.BadRequest);
                        }
                        regInfo.CatId      = "A";
                        regInfo.PinStatus  = "N";
                        regInfo.AcTypeCode = 1;
                        regInfo.RegSource  = "P";
                        //regInfo.RegDate = regInfo.RegDate + DateTime.Now.TimeOfDay;
                        regInfo.RegDate   = System.DateTime.Now;
                        regInfo.EntryDate = System.DateTime.Now;
                        _service.Add(regInfo);
                        _kycService.InsertModelToAuditTrail(regInfo, regInfo.EntryBy, 3, 3, "Agent", regInfo.Mphone, "Save successfully");
                        return(HttpStatusCode.OK);
                    }
                    catch (Exception ex)
                    {
                        return(HttpStatusCode.BadRequest);
                    }
                }
                else
                {
                    if (evnt == "edit")
                    {
                        regInfo.UpdateDate = System.DateTime.Now;
                        Reginfo aReginfo  = _kycService.NullifyReginfoForKycUpdate(regInfo);
                        var     prevModel = _kycService.GetRegInfoByMphone(aReginfo.Mphone);
                        _service.UpdateRegInfo(aReginfo);
                        var currentModel = _kycService.GetRegInfoByMphone(aReginfo.Mphone);
                        _kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, regInfo.UpdateBy, 3, 4, "Agent", regInfo.Mphone, "Update successfully");
                        return(HttpStatusCode.OK);
                    }

                    else
                    {
                        var checkStatus = _kycService.CheckPinStatus(regInfo.Mphone);
                        if (checkStatus.ToString() != "P")
                        {
                            if (string.IsNullOrEmpty(regInfo.AuthoBy))
                            {
                                return(HttpStatusCode.Unauthorized);
                            }
                            int fourDigitRandomNo = new Random().Next(1000, 9999);
                            regInfo.RegStatus = "P";
                            regInfo.AuthoDate = System.DateTime.Now;
                            var prevModel = _kycService.GetRegInfoByMphone(regInfo.Mphone);
                            _service.UpdateRegInfo(regInfo);
                            _dsrService.UpdatePinNo(regInfo.Mphone, fourDigitRandomNo.ToString());
                            var currentModel = _kycService.GetRegInfoByMphone(regInfo.Mphone);
                            _kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, regInfo.AuthoBy, 3, 4, "Agent", regInfo.Mphone, "Register successfully");
                            MessageService service = new MessageService();
                            service.SendMessage(new MessageModel()
                            {
                                Mphone      = regInfo.Mphone,
                                MessageId   = "999",
                                MessageBody = "Congratulations! Your OK wallet has been opened successfully." + " Your Pin is "
                                              + fourDigitRandomNo.ToString() + ", please change PIN to activate your account, "
                            });

                            return(HttpStatusCode.OK);
                        }
                        else
                        {
                            return(HttpStatusCode.OK);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString());
                return(HttpStatusCode.BadRequest);
            }
        }
예제 #18
0
        public object GenerateQrForBackOff(ReportModel model)
        {
            StringBuilderService builder = new StringBuilderService();
            string  mphone  = builder.ExtractText(Convert.ToString(model.ReportOption), "mphone", ",");
            string  qrType  = builder.ExtractText(Convert.ToString(model.ReportOption), "qrType", ",");
            string  catId   = builder.ExtractText(Convert.ToString(model.ReportOption), "catId", "}");
            Reginfo reginfo = (Reginfo)service.GetClientInfoByMphone(mphone);

            if (qrType == "okqr")
            {
                try
                {
                    //QrCode qrCode = service.GenerateQrCodeForBackOff(mphone);
                    //List<QrCode> qrCodes = new List<QrCode>();
                    //qrCodes.Add(qrCode);
                    //ReportViewer reportViewer = new ReportViewer();
                    //reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/QrCodeSlip.rdlc");  //Request.RequestUri("");
                    //reportViewer.LocalReport.SetParameters(GetGenerateQrReceiptParameter(mphone));
                    //ReportDataSource A = new ReportDataSource("QrCode", qrCodes);
                    //reportViewer.LocalReport.DataSources.Add(A);
                    //ReportUtility reportUtility = new ReportUtility();
                    //MFSFileManager fileManager = new MFSFileManager();
                    //return reportUtility.GenerateReport(reportViewer, model.FileType);
                    string        banglaQr = service.GetBanglaQrStream(reginfo.Mphone, reginfo.CatId);
                    QrCode        qrCode   = service.GenerateQrCodeForBackOff(banglaQr);
                    List <QrCode> qrCodes  = new List <QrCode>();
                    qrCodes.Add(qrCode);
                    ReportViewer reportViewer = new ReportViewer();
                    reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/QrCodeSlip.rdlc");                      //Request.RequestUri("");
                    reportViewer.LocalReport.SetParameters(GetGenerateQrReceiptParameter(mphone));
                    ReportDataSource A = new ReportDataSource("QrCode", qrCodes);
                    reportViewer.LocalReport.DataSources.Add(A);
                    ReportUtility  reportUtility = new ReportUtility();
                    MFSFileManager fileManager   = new MFSFileManager();
                    return(reportUtility.GenerateReport(reportViewer, model.FileType));
                }
                catch (Exception ex)
                {
                    return(ex.ToString());
                }
            }
            else if (qrType == "bnqr" && (reginfo.CatId == "M" || reginfo.CatId == "CM" || reginfo.CatId == "A") && !string.IsNullOrEmpty(mphone))
            {
                try
                {
                    string        banglaQr = service.GetBanglaQrStream(reginfo.Mphone, reginfo.CatId);
                    QrCode        qrCode   = service.GenerateQrCodeForBackOff(banglaQr);
                    List <QrCode> qrCodes  = new List <QrCode>();
                    qrCodes.Add(qrCode);
                    ReportViewer reportViewer = new ReportViewer();
                    reportViewer.LocalReport.ReportPath = HostingEnvironment.MapPath("~/Reports/RDLC/BanglaQrCodeSlip.rdlc");                      //Request.RequestUri("");
                    reportViewer.LocalReport.SetParameters(GetGenerateQrReceiptParameter(mphone));
                    ReportDataSource A = new ReportDataSource("QrCode", qrCodes);
                    reportViewer.LocalReport.DataSources.Add(A);
                    ReportUtility  reportUtility = new ReportUtility();
                    MFSFileManager fileManager   = new MFSFileManager();
                    return(reportUtility.GenerateReport(reportViewer, model.FileType));
                }
                catch (Exception ex)
                {
                    return(ex.ToString());
                }
            }
            else
            {
                return(null);
            }
        }