public List <KarvyUploadsVo> GetKarvyProfNewCustomers(int processId) { List <KarvyUploadsVo> uploadsCustomerList = new List <KarvyUploadsVo>(); KarvyUploadsVo KarvyUploadsVo; Database db; DbCommand getNewCustomersCmd; DataSet getNewCustomersDs; //DataRow dr; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getNewCustomersCmd = db.GetStoredProcCommand("SP_UploadGetNewCustomersKarvyProf"); db.AddInParameter(getNewCustomersCmd, "@processId", DbType.Int32, processId); getNewCustomersDs = db.ExecuteDataSet(getNewCustomersCmd); //dr = getNewCustomersDs.Tables[0].Rows[0]; foreach (DataRow dr in getNewCustomersDs.Tables[0].Rows) { KarvyUploadsVo = new KarvyUploadsVo(); KarvyUploadsVo.InvestorName = dr["CMFKXPS_InvestorName"].ToString(); KarvyUploadsVo.Address1 = dr["CMFKXPS_Address#1"].ToString(); KarvyUploadsVo.Address2 = dr["CMFKXPS_Address#2"].ToString(); KarvyUploadsVo.Address3 = dr["CMFKXPS_Address#3"].ToString(); KarvyUploadsVo.City = dr["CMFKXPS_City"].ToString(); KarvyUploadsVo.Pincode = dr["CMFKXPS_Pincode"].ToString(); KarvyUploadsVo.State = dr["CMFKXPS_State"].ToString(); KarvyUploadsVo.Country = dr["CMFKXPS_Country"].ToString(); KarvyUploadsVo.DateofBirth = dr["CMFKXPS_DateofBirth"].ToString(); KarvyUploadsVo.PhoneResidence = dr["CMFKXPS_PhoneResidence"].ToString(); KarvyUploadsVo.Mobile = dr["CMFKXPS_Mobile"].ToString(); KarvyUploadsVo.PhoneOffice = dr["CMFKXPS_PhoneOffice"].ToString(); KarvyUploadsVo.FaxResidence = dr["CMFKXPS_FaxResidence"].ToString(); KarvyUploadsVo.FaxOffice = dr["CMFKXPS_FaxOffice"].ToString(); KarvyUploadsVo.Email = dr["CMFKXPS_Email"].ToString(); KarvyUploadsVo.PANNumber = dr["CMFKXPS_PANNumber"].ToString(); KarvyUploadsVo.OccCode = dr["OccupationCode"].ToString(); KarvyUploadsVo.TypeCode = dr["CustomerTypeCode"].ToString(); KarvyUploadsVo.SubTypeCode = dr["CustomerSubTypeCode"].ToString(); KarvyUploadsVo.AccountType = dr["BankAccountTypeCode"].ToString(); KarvyUploadsVo.ModeOfHolding = dr["ModeOfHoldingCode"].ToString(); uploadsCustomerList.Add(KarvyUploadsVo); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "KarvyUploadsDao.cs:GetKarvyProfNewCustomers()"); object[] objects = new object[0]; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(uploadsCustomerList); }
public List <KarvyUploadsVo> GetKarvyNewCustomers(int processId) { List <KarvyUploadsVo> uploadsCustomerList = new List <KarvyUploadsVo>(); KarvyUploadsVo KarvyUploadsVo; Database db; DbCommand getNewCustomersCmd; DataSet getNewCustomersDs; //DataRow dr; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getNewCustomersCmd = db.GetStoredProcCommand("SP_UploadGetNewCustomersKarvyCombo"); getNewCustomersDs = db.ExecuteDataSet(getNewCustomersCmd); //dr = getNewCustomersDs.Tables[0].Rows[0]; foreach (DataRow dr in getNewCustomersDs.Tables[0].Rows) { KarvyUploadsVo = new KarvyUploadsVo(); //KarvyUploadsVo.ProductCode = dr["CMFKXCS_ProductCode"].ToString(); //KarvyUploadsVo.Fund = dr["CMFKXCS_Fund"].ToString(); //KarvyUploadsVo.FolioNumber = dr["CMFKXCS_FolioNumber"].ToString(); //KarvyUploadsVo.SchemeCode = dr["CMFKXCS_SchemeCode"].ToString(); //KarvyUploadsVo.DividendOption = dr["CMFKXCS_DividendOption"].ToString(); //KarvyUploadsVo.FundDescription = dr["CMFKXCS_FundDescription"].ToString(); //KarvyUploadsVo.TransactionHead = dr["CMFKXCS_TransactionHead"].ToString(); //KarvyUploadsVo.TransactionNumber = dr["CMFKXCS_TransactionNumber"].ToString(); //KarvyUploadsVo.Switch_RefNo = dr["[CMFKXCS_Switch_RefNo ]"].ToString(); //KarvyUploadsVo.InstrumentNumber = dr["CMFKXCS_InstrumentNumber"].ToString(); KarvyUploadsVo.InvestorName = dr["CMFKXCS_InvestorName"].ToString(); //KarvyUploadsVo.JointName1 = dr["CMFKXCS_JointName1"].ToString(); //KarvyUploadsVo.JointName2 = dr["CMFKXCS_JointName2"].ToString(); KarvyUploadsVo.Address1 = dr["CMFKXCS_Address#1"].ToString(); KarvyUploadsVo.Address2 = dr["CMFKXCS_Address#2"].ToString(); KarvyUploadsVo.Address3 = dr["CMFKXCS_Address#3"].ToString(); KarvyUploadsVo.City = dr["CMFKXCS_City"].ToString(); KarvyUploadsVo.Pincode = dr["CMFKXCS_Pincode"].ToString(); KarvyUploadsVo.State = dr["CMFKXCS_State"].ToString(); KarvyUploadsVo.Country = dr["CMFKXCS_Country"].ToString(); KarvyUploadsVo.DateofBirth = dr["CMFKXCS_DateofBirth"].ToString(); KarvyUploadsVo.PhoneResidence = dr["CMFKXCS_PhoneResidence"].ToString(); //KarvyUploadsVo.PhoneRes1 = dr["CMFKXCS_PhoneRes#1"].ToString(); //KarvyUploadsVo.PhoneRes2 = dr["CMFKXCS_PhoneRes#2"].ToString(); KarvyUploadsVo.Mobile = dr["CMFKXCS_Mobile"].ToString(); KarvyUploadsVo.PhoneOffice = dr["CMFKXCS_PhoneOffice"].ToString(); //KarvyUploadsVo.PhoneOff1 = dr["CMFKXCS_PhoneOff#1"].ToString(); //KarvyUploadsVo.PhoneOff2 = dr["CMFKXCS_PhoneOff#2"].ToString(); KarvyUploadsVo.FaxResidence = dr["CMFKXCS_FaxResidence"].ToString(); KarvyUploadsVo.FaxOffice = dr["CMFKXCS_FaxOffice"].ToString(); //KarvyUploadsVo.TaxStatus = dr["CMFKXCS_TaxStatus"].ToString(); //KarvyUploadsVo.OccCode = dr["CMFKXCS_OccCode"].ToString(); KarvyUploadsVo.Email = dr["CMFKXCS_Email"].ToString(); //KarvyUploadsVo.BankAccno = dr["CMFKXCS_BankAccno"].ToString(); //KarvyUploadsVo.BankName = dr["CMFKXCS_BankName"].ToString(); //KarvyUploadsVo.AccountType = dr["CMFKXCS_AccountType"].ToString(); //KarvyUploadsVo.Branch = dr["CMFKXCS_Branch"].ToString(); //KarvyUploadsVo.BankAddress1 = dr["CMFKXCS_BankAddress#1"].ToString(); //KarvyUploadsVo.BankAddress2 = dr["CMFKXCS_BankAddress#2"].ToString(); //KarvyUploadsVo.BankAddress3 = dr["CMFKXCS_BankAddress#3"].ToString(); //KarvyUploadsVo.BankCity = dr["CMFKXCS_BankCity"].ToString(); //KarvyUploadsVo.BankPhone = dr["CMFKXCS_BankPhone"].ToString(); KarvyUploadsVo.PANNumber = dr["CMFKXCS_PANNumber"].ToString(); //KarvyUploadsVo.TransactionMode = dr["CMFKXCS_TransactionMode"].ToString(); //KarvyUploadsVo.TransactionStatus = dr["CMFKXCS_TransactionStatus"].ToString(); //KarvyUploadsVo.BranchName = dr["CMFKXCS_BranchName"].ToString(); //KarvyUploadsVo.BranchTransactionNo = dr["CMFKXCS_BranchTransactionNo"].ToString(); //KarvyUploadsVo.TransactionDate = dr["CMFKXCS_TransactionDate"].ToString(); //KarvyUploadsVo.ProcessDate = dr["CMFKXCS_ProcessDate"].ToString(); //KarvyUploadsVo.Price = dr["CMFKXCS_Price"].ToString(); //KarvyUploadsVo.LoadPercentage = dr["CMFKXCS_LoadPercentage"].ToString(); //KarvyUploadsVo.Units = dr["CMFKXCS_Units"].ToString(); //KarvyUploadsVo.Amount = dr["CMFKXCS_Amount"].ToString(); //KarvyUploadsVo.LoadAmount = dr["CMFKXCS_LoadAmount"].ToString(); //KarvyUploadsVo.AgentCode = dr["CMFKXCS_AgentCode"].ToString(); //KarvyUploadsVo.SubBrokerCode = dr["CMFKXCS_Sub-BrokerCode"].ToString(); //KarvyUploadsVo.BrokeragePercentage = dr["CMFKXCS_BrokeragePercentage"].ToString(); //KarvyUploadsVo.Commission = dr["CMFKXCS_Commission"].ToString(); //KarvyUploadsVo.InvestorID = dr["CMFKXCS_InvestorID"].ToString(); //KarvyUploadsVo.ReportDate = dr["CMFKXCS_ReportDate"].ToString(); //KarvyUploadsVo.ReportTime = dr["CMFKXCS_ReportTime"].ToString(); //KarvyUploadsVo.TransactionSub = dr["CMFKXCS_TransactionSub"].ToString(); //KarvyUploadsVo.ApplicationNumber = dr["CMFKXCS_ApplicationNumber"].ToString(); //KarvyUploadsVo.TransactionID = dr["CMFKXCS_TransactionID"].ToString(); //KarvyUploadsVo.TransactionDescription = dr["CMFKXCS_TransactionDescription"].ToString(); //KarvyUploadsVo.TransactionType = dr["CMFKXCS_TransactionType"].ToString(); //KarvyUploadsVo.OrgPurchaseDate = dr["CMFKXCS_OrgPurchaseDate"].ToString(); //KarvyUploadsVo.OrgPurchaseAmount = dr["CMFKXCS_OrgPurchaseAmount"].ToString(); //KarvyUploadsVo.OrgPurchaseUnits = dr["CMFKXCS_OrgPurchaseUnits"].ToString(); //KarvyUploadsVo.TrTypeFlag = dr["CMFKXCS_TrTypeFlag"].ToString(); //KarvyUploadsVo.SwitchFundDate = dr["CMFKXCS_SwitchFundDate"].ToString(); //KarvyUploadsVo.InstrumentDate = dr["CMFKXCS_InstrumentDate"].ToString(); //KarvyUploadsVo.InstrumentBank = dr["CMFKXCS_InstrumentBank"].ToString(); //KarvyUploadsVo.Remarks = dr["CMFKXCS_Remarks"].ToString(); //KarvyUploadsVo.Scheme = dr["CMFKXCS_Scheme"].ToString(); //KarvyUploadsVo.Plan = dr["CMFKXCS_Plan"].ToString(); //KarvyUploadsVo.NAV = dr["CMFKXCS_NAV"].ToString(); //KarvyUploadsVo.AnnualizedPercentage = dr["CMFKXCS_Annualized%"].ToString(); //KarvyUploadsVo.AnnualizedCommision = dr["CMFKXCS_AnnualizedCommision"].ToString(); //KarvyUploadsVo.OrginalPurchaseTrnxNo = dr["CMFKXCS_OrginalPurchaseTrnxNo"].ToString(); //KarvyUploadsVo.OrginalPurchaseBranch = dr["CMFKXCS_OrginalPurchaseBranch"].ToString(); //KarvyUploadsVo.OldAcno = dr["CMFKXCS_OldAcno"].ToString(); //KarvyUploadsVo.IHNo = dr["CMFKXCS_IHNo "].ToString(); //KarvyUploadsVo.IsRejected = dr["CMFKXCS_IsRejected"].ToString(); //KarvyUploadsVo.IsFolioNew = dr["CMFKXCS_IsFolioNew"].ToString(); //KarvyUploadsVo.IsCustomerNew = dr["CMFKXCS_IsCustomerNew"].ToString(); //KarvyUploadsVo.RejectedRemark = dr["CMFKXCS_RejectedRemark"].ToString(); //KarvyUploadsVo.AdviserId = dr["CMFKXCS_AdviserId"].ToString(); //KarvyUploadsVo.CustomerId = dr["CMFKXCS_CustomerId"].ToString(); uploadsCustomerList.Add(KarvyUploadsVo); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "KarvyUploadsDao.cs:GetKarvyNewCustomers()"); object[] objects = new object[0]; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(uploadsCustomerList); }
//Fifth Phase: Move KARVY customer details to customer table public bool KARVYInsertCustomerDetails(int adviserId, int processId, int rmId, out int countCustCreated, out int countFolioCreated) { bool IsProcessComplete = false; List <KarvyUploadsVo> karvyNewCustomerList = new List <KarvyUploadsVo>(); Nullable <DateTime> dt = new DateTime(); KarvyUploadsVo karvyUploadsVo = new KarvyUploadsVo(); string resIsdCode = "", resStdCode = "", resPhoneNum = ""; string offIsdCode = "", offStdCode = "", offPhoneNum = ""; string resFaxIsdCode = "", resFaxStdCode = "", resFaxNum = ""; string offFaxIsdCode = "", offFaxStdCode = "", offFaxNum = ""; int lenPhoneNum, lenFaxNum; countCustCreated = 0; countFolioCreated = 0; DataSet getNewFoliosDs = new DataSet(); DataTable getNewFoliosDt = new DataTable(); userId = advisorStaffBo.GetUserId(rmId); try { karvyNewCustomerList = GetKarvyProfNewCustomers(processId); for (int i = 0; i < karvyNewCustomerList.Count; i++) { customerVo = new CustomerVo(); userVo = new UserVo(); karvyUploadsVo = new KarvyUploadsVo(); karvyUploadsVo = karvyNewCustomerList[i]; userVo.FirstName = ""; userVo.MiddleName = ""; userVo.LastName = karvyUploadsVo.InvestorName; //userVo.Password = id.Next(10000, 99999).ToString(); userVo.Email = karvyUploadsVo.Email; //userVo.LoginId = karvyUploadsVo.Email; userVo.UserType = "Customer"; //userId = userBo.CreateUser(userVo); customerVo.ProcessId = processId; customerVo.UserId = userId; customerVo.RmId = rmId; customerVo.Adr1City = karvyUploadsVo.City; customerVo.Adr1Country = karvyUploadsVo.Country; customerVo.Adr1Line1 = karvyUploadsVo.Address1; customerVo.Adr1Line2 = karvyUploadsVo.Address2; customerVo.Adr1Line3 = karvyUploadsVo.Address3; customerVo.Adr1PinCode = Int32.Parse(karvyUploadsVo.Pincode); customerVo.Adr2PinCode = 0; customerVo.OfcAdrPinCode = 0; customerVo.Adr1State = karvyUploadsVo.State; customerVo.CommencementDate = DateTime.Parse(dt.ToString()); if (karvyUploadsVo.DateofBirth == "") { customerVo.Dob = DateTime.Parse(dt.ToString()); } else { customerVo.Dob = DateTime.Parse(karvyUploadsVo.DateofBirth); } customerVo.Email = karvyUploadsVo.Email; customerVo.FirstName = karvyUploadsVo.FirstName; customerVo.MiddleName = karvyUploadsVo.MiddleName; customerVo.LastName = karvyUploadsVo.InvestorName; customerVo.LoginId = karvyUploadsVo.Email; if (karvyUploadsVo.Mobile == "") { customerVo.Mobile1 = 0; } else { customerVo.Mobile1 = Int64.Parse(karvyUploadsVo.Mobile); } lenFaxNum = karvyUploadsVo.FaxResidence.Length; if (lenFaxNum >= 8) { resFaxNum = karvyUploadsVo.FaxResidence.Substring(lenFaxNum - 8, 8); if (lenFaxNum >= 11) { resFaxStdCode = karvyUploadsVo.FaxResidence.Substring(lenFaxNum - 11, 3); if (lenFaxNum >= 12) { resFaxIsdCode = karvyUploadsVo.FaxResidence.Substring(0, lenFaxNum - 11); } } else { resFaxStdCode = karvyUploadsVo.FaxResidence.Substring(0, lenFaxNum - 8); } } else { resFaxNum = karvyUploadsVo.FaxResidence; } if (resFaxIsdCode != "") { customerVo.ISDFax = Int32.Parse(resFaxIsdCode); } else { customerVo.ISDFax = 0; } if (resFaxStdCode != "") { customerVo.STDFax = Int32.Parse(resFaxStdCode); } else { customerVo.STDFax = 0; } if (resFaxNum != "") { customerVo.Fax = Int32.Parse(resFaxNum); } else { customerVo.Fax = 0; } lenFaxNum = karvyUploadsVo.FaxOffice.Length; if (lenFaxNum >= 8) { offFaxNum = karvyUploadsVo.FaxOffice.Substring(lenFaxNum - 8, 8); if (lenFaxNum >= 11) { offFaxStdCode = karvyUploadsVo.FaxOffice.Substring(lenFaxNum - 11, 3); if (lenFaxNum >= 12) { offFaxIsdCode = karvyUploadsVo.FaxOffice.Substring(0, lenFaxNum - 11); } } else { offFaxStdCode = karvyUploadsVo.FaxOffice.Substring(0, lenFaxNum - 8); } } else { offFaxNum = karvyUploadsVo.FaxOffice; } if (offFaxIsdCode != "") { customerVo.OfcISDFax = Int32.Parse(offFaxIsdCode); } else { customerVo.OfcISDFax = 0; } if (offFaxStdCode != "") { customerVo.OfcSTDFax = Int32.Parse(offFaxStdCode); } else { customerVo.OfcSTDFax = 0; } if (offFaxNum != "") { customerVo.OfcFax = Int32.Parse(offFaxNum); } else { customerVo.OfcFax = 0; } lenPhoneNum = karvyUploadsVo.PhoneOffice.Length; if (lenPhoneNum >= 8) { offPhoneNum = karvyUploadsVo.PhoneOffice.Substring(lenPhoneNum - 8, 8); if (lenPhoneNum >= 11) { offStdCode = karvyUploadsVo.PhoneOffice.Substring(lenPhoneNum - 11, 3); if (lenPhoneNum >= 12) { offIsdCode = karvyUploadsVo.PhoneOffice.Substring(0, lenPhoneNum - 11); } } else { offStdCode = karvyUploadsVo.PhoneOffice.Substring(0, lenPhoneNum - 8); } } else { offPhoneNum = karvyUploadsVo.PhoneOffice; } 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; } lenPhoneNum = karvyUploadsVo.PhoneResidence.Length; if (lenPhoneNum >= 8) { resPhoneNum = karvyUploadsVo.PhoneResidence.Substring(lenPhoneNum - 8, 8); if (lenPhoneNum >= 11) { resStdCode = karvyUploadsVo.PhoneResidence.Substring(lenPhoneNum - 11, 3); if (lenPhoneNum >= 12) { resIsdCode = karvyUploadsVo.PhoneResidence.Substring(0, lenPhoneNum - 11); } } else { resStdCode = karvyUploadsVo.PhoneResidence.Substring(0, lenPhoneNum - 8); } } else { resPhoneNum = karvyUploadsVo.PhoneResidence; } 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; } customerVo.Type = karvyUploadsVo.TypeCode; customerVo.SubType = karvyUploadsVo.SubTypeCode; customerVo.Occupation = karvyUploadsVo.OccCode; customerVo.PANNum = karvyUploadsVo.PANNumber; customerVo.Password = id.Next(10000, 99999).ToString(); customerVo.ProfilingDate = DateTime.Today; customerVo.RBIApprovalDate = DateTime.Parse(dt.ToString()); customerVo.RegistrationDate = DateTime.Parse(dt.ToString()); customerVo.CommencementDate = DateTime.Parse(dt.ToString()); //customerId2 = customerBo.CreateCustomer(customerVo, rmId, userId); //customerPortfolioVo.CustomerId = customerId2; customerPortfolioVo.IsMainPortfolio = 1; customerPortfolioVo.PortfolioTypeCode = "RGL"; //PortfolioBo.CreateCustomerPortfolio(customerPortfolioVo, userId); customerBo.CreateCompleteCustomer(customerVo, userVo, customerPortfolioVo, userId); countCustCreated++; } UpdateKarvyProfileStagingIsCustomerNew(adviserId, processId); //*****New Folios Upload from CAMS***** getNewFoliosDs = GetKarvyProfileNewFolios(processId); getNewFoliosDt = getNewFoliosDs.Tables[0]; foreach (DataRow dr in getNewFoliosDt.Rows) { customerAccountsVo.AccountNum = dr["CMFKXPS_Folio"].ToString(); customerAccountsVo.PortfolioId = Int32.Parse(dr["CP_PortfolioId"].ToString()); customerAccountsVo.AssetClass = "MF"; customerAccountsVo.AMCCode = Int32.Parse(dr["PA_AMCCode"].ToString()); customerAccountBo.CreateCustomerMFAccount(customerAccountsVo, userId); countFolioCreated++; } UpdateKarvyProfileStagingIsFolioNew(processId); IsProcessComplete = true; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "KarvyUploadsBo.cs:KARVYInsertCustomerDetails()"); 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); }