public List <StandardProfileUploadVo> GetNewCustomers(int processId) { List <StandardProfileUploadVo> uploadsCustomerList = new List <StandardProfileUploadVo>(); StandardProfileUploadVo StandardProfileUploadVo; Database db; DbCommand getNewCustomersCmd; DataSet getNewCustomersDs; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getNewCustomersCmd = db.GetStoredProcCommand("SP_GetNewCustomers"); db.AddInParameter(getNewCustomersCmd, "@processId", DbType.Int32, processId); getNewCustomersDs = db.ExecuteDataSet(getNewCustomersCmd); foreach (DataRow dr in getNewCustomersDs.Tables[0].Rows) { StandardProfileUploadVo = new StandardProfileUploadVo(); StandardProfileUploadVo.PANNum = dr["CPS_PANNum"].ToString(); StandardProfileUploadVo.FirstName = dr["CPS_FirstName"].ToString(); StandardProfileUploadVo.MiddleName = dr["CPS_MiddleName"].ToString(); StandardProfileUploadVo.LastName = dr["CPS_LastName"].ToString(); if (dr["AR_RMId"] == null || dr["AR_RMId"].ToString() == "") { StandardProfileUploadVo.RMId = 0; } else { StandardProfileUploadVo.RMId = int.Parse(dr["AR_RMId"].ToString()); } StandardProfileUploadVo.Adr1Line1 = dr["CPS_Adr1Line1"].ToString(); StandardProfileUploadVo.Adr1Line2 = dr["CPS_Adr1Line2"].ToString(); StandardProfileUploadVo.Adr1Line3 = dr["CPS_Adr1Line3"].ToString(); StandardProfileUploadVo.Adr1PinCode = dr["CPS_Adr1PinCode"].ToString(); StandardProfileUploadVo.Type = dr["CPS_Type"].ToString(); StandardProfileUploadVo.SubType = dr["CPS_SubType"].ToString(); StandardProfileUploadVo.Adr1City = dr["CPS_Adr1City"].ToString(); StandardProfileUploadVo.Adr1State = dr["CPS_Adr1State"].ToString(); StandardProfileUploadVo.Adr2Country = dr["CPS_Adr1Country"].ToString(); StandardProfileUploadVo.Adr2Line1 = dr["CPS_Adr2Line1"].ToString(); StandardProfileUploadVo.Adr2Line2 = dr["CPS_Adr2Line2"].ToString(); StandardProfileUploadVo.Adr2Line3 = dr["CPS_Adr2Line3"].ToString(); StandardProfileUploadVo.Adr2PinCode = dr["CPS_Adr2PinCode"].ToString(); StandardProfileUploadVo.Adr2City = dr["CPS_Adr2City"].ToString(); StandardProfileUploadVo.Adr2State = dr["CPS_Adr2State"].ToString(); StandardProfileUploadVo.Adr2Country = dr["CPS_Adr2Country"].ToString(); StandardProfileUploadVo.ResISDCode = dr["CPS_ResISDCode"].ToString(); StandardProfileUploadVo.ResSTDCode = dr["CPS_ResSTDCode"].ToString(); StandardProfileUploadVo.ResPhoneNum = dr["CPS_ResPhoneNum"].ToString(); StandardProfileUploadVo.OfcISDCode = dr["CPS_OfcISDCode"].ToString(); StandardProfileUploadVo.OfcSTDCode = dr["CPS_OfcSTDCode"].ToString(); StandardProfileUploadVo.OfcPhoneNum = dr["CPS_OfcPhoneNum"].ToString(); StandardProfileUploadVo.Email = dr["CPS_Email"].ToString(); StandardProfileUploadVo.AltEmail = dr["CPS_AltEmail"].ToString(); StandardProfileUploadVo.Mobile1 = dr["CPS_Mobile1"].ToString(); StandardProfileUploadVo.Mobile2 = dr["CPS_Mobile2"].ToString(); StandardProfileUploadVo.ISDFax = dr["CPS_ISDFax"].ToString(); StandardProfileUploadVo.STDFax = dr["CPS_STDFax"].ToString(); StandardProfileUploadVo.Fax = dr["CPS_Fax"].ToString(); StandardProfileUploadVo.OfcFax = dr["CPS_OfcFax"].ToString(); StandardProfileUploadVo.OfcFaxISD = dr["CPS_OfcFaxISD"].ToString(); StandardProfileUploadVo.OfcFaxSTD = dr["CPS_OfcFaxSTD"].ToString(); StandardProfileUploadVo.Occupation = dr["CPS_Occupation"].ToString(); StandardProfileUploadVo.Qualification = dr["CPS_Qualification"].ToString(); StandardProfileUploadVo.MarriageDate = dr["CPS_MarriageDate"].ToString(); StandardProfileUploadVo.MaritalStatus = dr["CPS_MaritalStatus"].ToString(); StandardProfileUploadVo.Nationality = dr["CPS_Nationality"].ToString(); StandardProfileUploadVo.RBIRefNum = dr["CPS_RBIRefNum"].ToString(); StandardProfileUploadVo.RBIApprovalDate = dr["CPS_RBIApprovalDate"].ToString(); StandardProfileUploadVo.CompanyName = dr["CPS_CompanyName"].ToString(); StandardProfileUploadVo.DOB = dr["CPS_DOB"].ToString(); StandardProfileUploadVo.OfcAdrLine1 = dr["CPS_OfcAdrLine1"].ToString(); StandardProfileUploadVo.OfcAdrLine2 = dr["CPS_OfcAdrLine2"].ToString(); StandardProfileUploadVo.OfcAdrLine3 = dr["CPS_OfcAdrLine3"].ToString(); StandardProfileUploadVo.OfcAdrPinCode = dr["CPS_OfcAdrPinCode"].ToString(); StandardProfileUploadVo.OfcAdrCity = dr["CPS_OfcAdrCity"].ToString(); StandardProfileUploadVo.OfcAdrState = dr["CPS_OfcAdrState"].ToString(); StandardProfileUploadVo.OfcAdrCountry = dr["CPS_OfcAdrCountry"].ToString(); StandardProfileUploadVo.RegistrationDate = dr["CPS_RegistrationDate"].ToString(); StandardProfileUploadVo.CommencementDate = dr["CPS_CommencementDate"].ToString(); StandardProfileUploadVo.RegistrationNum = dr["CPS_RegistrationNum"].ToString(); StandardProfileUploadVo.CompanyWebsite = dr["CPS_CompanyWebsite"].ToString(); StandardProfileUploadVo.BankName = dr["CPS_BankName"].ToString(); StandardProfileUploadVo.BankAccountType = dr["CPS_BankAccountType"].ToString(); StandardProfileUploadVo.BankAccountNum = dr["CPS_BankAccountNum"].ToString(); StandardProfileUploadVo.BankModeOfOperation = dr["CPS_BankModeOfOperation"].ToString(); StandardProfileUploadVo.BranchName = dr["CPS_BranchName"].ToString(); StandardProfileUploadVo.BranchAdrLine1 = dr["CPS_BranchAdrLine1"].ToString(); StandardProfileUploadVo.BranchAdrLine2 = dr["CPS_BranchAdrLine2"].ToString(); StandardProfileUploadVo.BranchAdrLine3 = dr["CPS_BranchAdrLine3"].ToString(); StandardProfileUploadVo.BranchAdrPinCode = dr["CPS_BranchAdrPinCode"].ToString(); StandardProfileUploadVo.BranchAdrCity = dr["CPS_BranchAdrCity"].ToString(); StandardProfileUploadVo.BranchAdrState = dr["CPS_BranchAdrState"].ToString(); StandardProfileUploadVo.BranchAdrCountry = dr["CPS_BranchAdrCountry"].ToString(); StandardProfileUploadVo.MICR = dr["CPS_MICR"].ToString(); StandardProfileUploadVo.IFSC = dr["CPS_IFSC"].ToString(); StandardProfileUploadVo.ContactGuardianFirstName = dr["CPS_ContactGuardianFirstName"].ToString(); StandardProfileUploadVo.ContactGuardianMiddleName = dr["CPS_ContactGuardianMiddleName"].ToString(); StandardProfileUploadVo.ContactGuardianLastName = dr["CPS_ContactGuardianLastName"].ToString(); StandardProfileUploadVo.GuardPANNum = dr["CPS_GuardPan"].ToString(); if (dr["C_IsProspect"] == null || dr["C_IsProspect"].ToString() == "") { StandardProfileUploadVo.IsProspect = 0; } else { StandardProfileUploadVo.IsProspect = int.Parse(dr["C_IsProspect"].ToString()); } uploadsCustomerList.Add(StandardProfileUploadVo); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CamsUploadsDao.cs:GetCamsNewCustomers()"); object[] objects = new object[0]; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(uploadsCustomerList); }
//Seventh phase: Profile creation public bool StdInsertCustomerDetails(int adviserId, int processId, int rmId, int branchId, string xmlPath, out int countCustCreated) { bool IsProcessComplete = false; List <StandardProfileUploadVo> stdNewCustomerList = new List <StandardProfileUploadVo>(); Nullable <DateTime> dt = new DateTime(); StandardProfileUploadVo StandardProfileUploadVo = new StandardProfileUploadVo(); countCustCreated = 0; DataSet getNewFoliosDs = new DataSet(); DataTable getNewFoliosDt = new DataTable(); userId = advisorStaffBo.GetUserId(rmId); int lenPhoneNum = 0, lenFaxNum = 0; string resIsdCode = "", resStdCode = "", resPhoneNum = "", offIsdCode = "", offStdCode = "", offPhoneNum = ""; string resFaxIsdCode = "", resFaxStdCode = "", resFaxNum = "", offFaxIsdCode = "", offFaxStdCode = "", offFaxNum = ""; try { stdNewCustomerList = GetProfileNewCustomers(processId); for (int i = 0; i < stdNewCustomerList.Count; i++) { customerVo = new CustomerVo(); userVo = new UserVo(); StandardProfileUploadVo = new StandardProfileUploadVo(); StandardProfileUploadVo = stdNewCustomerList[i]; userVo.FirstName = StandardProfileUploadVo.FirstName; userVo.MiddleName = StandardProfileUploadVo.MiddleName; userVo.LastName = StandardProfileUploadVo.LastName; userVo.Email = StandardProfileUploadVo.Email; userVo.UserType = "Customer"; customerVo.UserId = userId; customerVo.RmId = StandardProfileUploadsDao.GetBranchHeadId(branchId); customerVo.BranchId = branchId; customerVo.ProcessId = processId; customerVo.Adr1City = StandardProfileUploadVo.Adr1City; customerVo.Adr1Line1 = StandardProfileUploadVo.Adr1Line1; customerVo.Adr1Line2 = StandardProfileUploadVo.Adr1Line2; customerVo.Adr1Line3 = StandardProfileUploadVo.Adr1Line3; if (StandardProfileUploadVo.Adr1PinCode != "") { customerVo.Adr1PinCode = Int32.Parse(StandardProfileUploadVo.Adr1PinCode); } customerVo.Email = StandardProfileUploadVo.Email; customerVo.FirstName = StandardProfileUploadVo.FirstName; customerVo.MiddleName = StandardProfileUploadVo.MiddleName; customerVo.LastName = StandardProfileUploadVo.LastName; customerVo.Gender = StandardProfileUploadVo.Gender; customerVo.Salutation = StandardProfileUploadVo.Salutation; customerVo.Adr1City = StandardProfileUploadVo.Adr1City; customerVo.Adr1Country = StandardProfileUploadVo.Adr1Country; customerVo.Adr1State = XMLBo.GetStateCode(xmlPath, StandardProfileUploadVo.Adr1State); customerVo.Adr2City = StandardProfileUploadVo.Adr2City; customerVo.Adr2Country = StandardProfileUploadVo.Adr2Country; customerVo.Adr2Line1 = StandardProfileUploadVo.Adr2Line1; customerVo.Adr2Line2 = StandardProfileUploadVo.Adr2Line2; customerVo.Adr2Line3 = StandardProfileUploadVo.Adr2Line3; if (StandardProfileUploadVo.Adr2PinCode != "") { customerVo.Adr2PinCode = Int32.Parse(StandardProfileUploadVo.Adr2PinCode); } customerVo.Adr2State = StandardProfileUploadVo.Adr2State; customerVo.AltEmail = StandardProfileUploadVo.AltEmail; customerVo.AssignedRM = (customerVo.RmId).ToString(); customerVo.CompanyName = StandardProfileUploadVo.CompanyName; customerVo.CompanyWebsite = StandardProfileUploadVo.CompanyWebsite; customerVo.ContactFirstName = StandardProfileUploadVo.ContactGuardianFirstName; customerVo.ContactMiddleName = StandardProfileUploadVo.ContactGuardianMiddleName; customerVo.ContactLastName = StandardProfileUploadVo.ContactGuardianLastName; if (StandardProfileUploadVo.Mobile1 != "") { customerVo.Mobile1 = Int64.Parse(StandardProfileUploadVo.Mobile1); } if (StandardProfileUploadVo.Mobile2 != "") { customerVo.Mobile2 = Int64.Parse(StandardProfileUploadVo.Mobile2); } if (StandardProfileUploadVo.Nationality != "") { customerVo.Nationality = StandardProfileUploadVo.Nationality; } if (StandardProfileUploadVo.Occupation != "") { customerVo.Occupation = StandardProfileUploadVo.Occupation; } if (StandardProfileUploadVo.MaritalStatus != "") { customerVo.MaritalStatus = StandardProfileUploadVo.MaritalStatus; } if (StandardProfileUploadVo.Qualification != "") { customerVo.Qualification = StandardProfileUploadVo.Qualification; } customerVo.IsProspect = StandardProfileUploadVo.IsProspect; customerVo.OfcAdrCity = StandardProfileUploadVo.OfcAdrCity; customerVo.OfcAdrCountry = StandardProfileUploadVo.OfcAdrCountry; customerVo.OfcAdrLine1 = StandardProfileUploadVo.OfcAdrLine1; customerVo.OfcAdrLine2 = StandardProfileUploadVo.OfcAdrLine2; customerVo.OfcAdrLine3 = StandardProfileUploadVo.OfcAdrLine3; if (StandardProfileUploadVo.OfcAdrPinCode != "") { customerVo.OfcAdrPinCode = Int32.Parse(StandardProfileUploadVo.OfcAdrPinCode); } customerVo.OfcAdrState = StandardProfileUploadVo.OfcAdrState; if (StandardProfileUploadVo.RBIApprovalDate != "") { customerVo.RBIApprovalDate = DateTime.Parse(StandardProfileUploadVo.RBIApprovalDate); } customerVo.RBIRefNum = StandardProfileUploadVo.RBIRefNum; customerVo.RegistrationNum = StandardProfileUploadVo.RegistrationNum; //customerVo.LoginId = StandardProfileUploadVo.Email; if (StandardProfileUploadVo.Type != "") { customerVo.Type = StandardProfileUploadVo.Type; } if (StandardProfileUploadVo.SubType != "") { customerVo.SubType = StandardProfileUploadVo.SubType; } lenPhoneNum = StandardProfileUploadVo.OfcPhoneNum.Length; if (lenPhoneNum > 9) { if (lenPhoneNum >= 8) { offPhoneNum = StandardProfileUploadVo.OfcPhoneNum.Substring(lenPhoneNum - 8, 8); if (lenPhoneNum >= 11) { offStdCode = StandardProfileUploadVo.OfcPhoneNum.Substring(lenPhoneNum - 11, 3); if (lenPhoneNum >= 12) { offIsdCode = StandardProfileUploadVo.OfcPhoneNum.Substring(0, lenPhoneNum - 11); } } else { offStdCode = StandardProfileUploadVo.OfcPhoneNum.Substring(0, lenPhoneNum - 8); } } else { offPhoneNum = StandardProfileUploadVo.OfcPhoneNum; } if (offIsdCode != "") { customerVo.OfcISDCode = Int32.Parse(offIsdCode); } else { customerVo.OfcISDCode = 0; } if (offStdCode != "") { customerVo.OfcSTDCode = Int32.Parse(offStdCode); } else { customerVo.OfcSTDCode = 0; } if (offPhoneNum != "") { customerVo.OfcPhoneNum = Int32.Parse(offPhoneNum); } else { customerVo.OfcPhoneNum = 0; } } else { if (StandardProfileUploadVo.OfcISDCode != "") { customerVo.OfcISDCode = Int32.Parse(StandardProfileUploadVo.OfcISDCode); } if (StandardProfileUploadVo.OfcSTDCode != "") { customerVo.OfcSTDCode = Int32.Parse(StandardProfileUploadVo.OfcSTDCode); } if (StandardProfileUploadVo.OfcPhoneNum != "") { customerVo.OfcPhoneNum = Int32.Parse(StandardProfileUploadVo.OfcPhoneNum); } } lenPhoneNum = StandardProfileUploadVo.ResPhoneNum.Length; if (lenPhoneNum > 9) { if (lenPhoneNum >= 8) { resPhoneNum = StandardProfileUploadVo.ResPhoneNum.Substring(lenPhoneNum - 8, 8); if (lenPhoneNum >= 11) { resStdCode = StandardProfileUploadVo.ResPhoneNum.Substring(lenPhoneNum - 11, 3); if (lenPhoneNum >= 12) { resIsdCode = StandardProfileUploadVo.ResPhoneNum.Substring(0, lenPhoneNum - 11); } } else { resStdCode = StandardProfileUploadVo.ResPhoneNum.Substring(0, lenPhoneNum - 8); } } else { resPhoneNum = StandardProfileUploadVo.ResPhoneNum; } if (resIsdCode != "") { customerVo.ResISDCode = Int32.Parse(resIsdCode); } else { customerVo.ResISDCode = 0; } if (resStdCode != "") { customerVo.ResSTDCode = Int32.Parse(resStdCode); } else { customerVo.ResSTDCode = 0; } if (resPhoneNum != "") { customerVo.ResPhoneNum = Int32.Parse(resPhoneNum); } else { customerVo.ResPhoneNum = 0; } } else { if (StandardProfileUploadVo.ResISDCode != "") { customerVo.ResISDCode = Int32.Parse(StandardProfileUploadVo.ResISDCode); } if (StandardProfileUploadVo.ResSTDCode != "") { customerVo.ResSTDCode = Int32.Parse(StandardProfileUploadVo.ResSTDCode); } if (StandardProfileUploadVo.ResPhoneNum != "") { customerVo.ResPhoneNum = Int32.Parse(StandardProfileUploadVo.ResPhoneNum); } } lenFaxNum = StandardProfileUploadVo.OfcFax.Length; if (lenFaxNum > 9) { if (lenFaxNum >= 8) { offFaxNum = StandardProfileUploadVo.OfcFax.Substring(lenFaxNum - 8, 8); if (lenFaxNum >= 11) { offFaxStdCode = StandardProfileUploadVo.OfcFax.Substring(lenFaxNum - 11, 3); if (lenFaxNum >= 12) { offFaxIsdCode = StandardProfileUploadVo.OfcFax.Substring(0, lenFaxNum - 11); } } else { offFaxStdCode = StandardProfileUploadVo.OfcFax.Substring(0, lenFaxNum - 8); } } else { offFaxNum = StandardProfileUploadVo.OfcFax; } if (offFaxIsdCode != "") { customerVo.ISDFax = Int32.Parse(offFaxIsdCode); } else { customerVo.ISDFax = 0; } if (offFaxStdCode != "") { customerVo.STDFax = Int32.Parse(offFaxStdCode); } else { customerVo.STDFax = 0; } if (offFaxNum != "") { customerVo.Fax = Int32.Parse(offFaxNum); } else { customerVo.Fax = 0; } } else { if (StandardProfileUploadVo.OfcFaxISD != "") { customerVo.OfcISDFax = Int32.Parse(StandardProfileUploadVo.OfcFaxISD); } if (StandardProfileUploadVo.OfcFaxSTD != "") { customerVo.OfcSTDFax = Int32.Parse(StandardProfileUploadVo.OfcFaxSTD); } if (StandardProfileUploadVo.OfcFax != "") { customerVo.OfcFax = Int32.Parse(StandardProfileUploadVo.OfcFax); } } lenFaxNum = StandardProfileUploadVo.Fax.Length; if (lenFaxNum > 9) { if (lenFaxNum >= 8) { resFaxNum = StandardProfileUploadVo.Fax.Substring(lenFaxNum - 8, 8); if (lenFaxNum >= 11) { resFaxStdCode = StandardProfileUploadVo.Fax.Substring(lenFaxNum - 11, 3); if (lenFaxNum >= 12) { resFaxIsdCode = StandardProfileUploadVo.Fax.Substring(0, lenFaxNum - 11); } } else { resFaxStdCode = StandardProfileUploadVo.Fax.Substring(0, lenFaxNum - 8); } } else { resFaxNum = StandardProfileUploadVo.Fax; } if (resFaxIsdCode != "") { customerVo.ISDFax = Int32.Parse(resFaxIsdCode); } else { customerVo.ISDFax = 0; } if (offFaxStdCode != "") { customerVo.STDFax = Int32.Parse(resFaxStdCode); } else { customerVo.STDFax = 0; } if (offFaxNum != "") { customerVo.Fax = Int32.Parse(resFaxNum); } else { customerVo.Fax = 0; } } else { if (StandardProfileUploadVo.ISDFax != "") { customerVo.OfcISDFax = Int32.Parse(StandardProfileUploadVo.ISDFax); } if (StandardProfileUploadVo.STDFax != "") { customerVo.OfcSTDFax = Int32.Parse(StandardProfileUploadVo.STDFax); } if (StandardProfileUploadVo.Fax != "") { customerVo.OfcFax = Int32.Parse(StandardProfileUploadVo.Fax); } } customerVo.PANNum = StandardProfileUploadVo.PANNum; customerVo.Password = id.Next(10000, 99999).ToString(); if (StandardProfileUploadVo.DOB != "") { customerVo.Dob = DateTime.Parse(StandardProfileUploadVo.DOB); } customerVo.ProfilingDate = DateTime.Today; if (StandardProfileUploadVo.RegistrationDate != "") { customerVo.RegistrationDate = DateTime.Parse(StandardProfileUploadVo.RegistrationDate); } if (StandardProfileUploadVo.CommencementDate != "") { customerVo.CommencementDate = DateTime.Parse(StandardProfileUploadVo.CommencementDate); } customerPortfolioVo.IsMainPortfolio = 1; customerPortfolioVo.PortfolioTypeCode = "RGL"; customerPortfolioVo.PortfolioName = "MyPortfolio"; customerIds = customerBo.CreateCompleteCustomer(customerVo, userVo, customerPortfolioVo, userId); //Creating Customer Association if (customerIds != null) { CustomerFamilyVo familyVo = new CustomerFamilyVo(); CustomerFamilyBo familyBo = new CustomerFamilyBo(); familyVo.AssociateCustomerId = customerIds[1]; familyVo.CustomerId = customerIds[1]; familyVo.Relationship = "SELF"; familyBo.CreateCustomerFamily(familyVo, customerIds[1], userVo.UserId); } countCustCreated++; } UpdateProfileStagingIsCustomerNew(adviserId, processId, branchId); IsProcessComplete = true; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "StandardProfileUploadBo.cs:StdInsertCustomerDetails()"); object[] objects = new object[3]; objects[0] = adviserId; objects[1] = processId; objects[2] = rmId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(IsProcessComplete); }