public static CBE.CustomerAccountCBE GetCustomerByResidentId(CBE.CustomerAccountCBE customer) { try { CBE.CustomerAccountCollection customers = new CBE.CustomerAccountCollection(); string spName = Constants.oraclePackagePrefix + "ACCOUNT_GETBY_RESIDENTID"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_TMS_ID", DbType.Int32, customer.TmsId, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_RESIDENT_ID", DbType.String, customer.ResidentId, ParameterDirection.Input)); DataTable dt = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName).Tables[tableName]; customers = ConvertDataTableToCollection(dt); return(customers[0]); } catch (Exception ex) { throw ex; } }
public static List <CBE.CustomerAccountCBE> ValidateCustomerAccount(CBE.CustomerAccountCBE customer) { try { List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE> accounts = new List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAccountCBE>(); string spName = Constants.oraclePackagePrefix + "CUSTOMER_ACCOUNT_VALIDATE"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_MOB_NUMBER", DbType.String, customer.MobileNo, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_RESIDENT_ID", DbType.String, customer.ResidentId, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_EMAIL_ID", DbType.String, customer.EmailId, ParameterDirection.Input)); DataTable dt = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName).Tables[tableName]; accounts = ConvertDataTableToList(dt); return(accounts); } catch (Exception ex) { throw ex; } }
private static CBE.CustomerAccountCBE ConvertDataTableToCBE(DataRow row) { CBE.CustomerAccountCBE account = new CBE.CustomerAccountCBE(); if (row["TMS_ID"] != DBNull.Value) { account.TmsId = Convert.ToInt32(row["TMS_ID"]); } if (row["ACCOUNT_ID"] != DBNull.Value) { account.AccountId = Convert.ToInt32(row["ACCOUNT_ID"]); } if (row["FIRST_NAME"] != DBNull.Value) { account.FirstName = Convert.ToString(row["FIRST_NAME"]); } if (row["LAST_NAME"] != DBNull.Value) { account.LastName = Convert.ToString(row["LAST_NAME"]); } if (row["MOB_NUMBER"] != DBNull.Value) { account.MobileNo = Convert.ToString(row["MOB_NUMBER"]); } if (row["EMAIL_ID"] != DBNull.Value) { account.EmailId = Convert.ToString(row["EMAIL_ID"]); } if (row["DESCRIPTION"] != DBNull.Value) { account.Description = Convert.ToString(row["DESCRIPTION"]); } if (row["ADDRESS"] != DBNull.Value) { account.Address = Convert.ToString(row["ADDRESS"]); account.FullAddress = Convert.ToString(row["ADDRESS"]); } if (row["ACCOUNT_BALANCE"] != DBNull.Value) { account.AccountBalance = Convert.ToDecimal(row["ACCOUNT_BALANCE"]); } if (row["MODIFIER_ID"] != DBNull.Value) { account.ModifierId = Convert.ToInt32(row["MODIFIER_ID"]); } if (row["CREATION_DATE"] != DBNull.Value) { account.CreationDate = Convert.ToDateTime(row["CREATION_DATE"]); } if (row["MODIFICATION_DATE"] != DBNull.Value) { account.ModificationDate = Convert.ToDateTime(row["MODIFICATION_DATE"]); } if (row["CUSTOMER_IMAGE_PATH"] != DBNull.Value) { account.CustomerImagePath = Convert.ToString(row["CUSTOMER_IMAGE_PATH"]); } if (row["IS_DOC_VERIFIED"] != DBNull.Value) { account.IsDocVerified = Convert.ToInt32(row["IS_DOC_VERIFIED"]); } if (row["ACCOUNT_STATUS"] != DBNull.Value) { account.AccountStatus = Convert.ToInt32(row["ACCOUNT_STATUS"]); } if (row["TRANSFER_STATUS"] != DBNull.Value) { account.TransferStatus = Convert.ToInt32(row["TRANSFER_STATUS"]); } if (row["RESIDENT_ID"] != DBNull.Value) { account.ResidentId = Convert.ToString(row["RESIDENT_ID"]); } if (row["BIRTH_PLACE"] != DBNull.Value) { account.BirthPlace = Convert.ToString(row["BIRTH_PLACE"]); } if (row["BIRTH_DATE"] != DBNull.Value) { account.BirthDate = Convert.ToDateTime(row["BIRTH_DATE"]); } if (row["RT_RW"] != DBNull.Value) { account.RT_RW = Convert.ToString(row["RT_RW"]); } if (row["RT_RW"] != DBNull.Value) { string RT_RW = Convert.ToString(row["RT_RW"]); if (RT_RW.Contains("/")) { string[] RTRW = RT_RW.Split('/'); account.RT = RTRW[0].ToString(); if (RTRW.Length > 1) { account.RW = RTRW[1].ToString(); } } } if (row["PROVINCE_ID"] != DBNull.Value) { account.ProvinceId = Convert.ToInt32(row["PROVINCE_ID"]); } if (row["PROVINCE_NAME"] != DBNull.Value) { account.ProvinceName = Convert.ToString(row["PROVINCE_NAME"]); account.FullAddress = account.FullAddress + " " + Convert.ToString(row["PROVINCE_NAME"]); } if (row["CITY_ID"] != DBNull.Value) { account.CityId = Convert.ToInt32(row["CITY_ID"]); } if (row["CITY_NAME"] != DBNull.Value) { account.CityName = Convert.ToString(row["CITY_NAME"]); account.FullAddress = account.FullAddress + " " + Convert.ToString(row["CITY_NAME"]); } if (row["DISTRICT_ID"] != DBNull.Value) { account.DistrictId = Convert.ToInt32(row["DISTRICT_ID"]); } if (row["DISTRICT_NAME"] != DBNull.Value) { account.DistrictName = Convert.ToString(row["DISTRICT_NAME"]); account.FullAddress = account.FullAddress + " " + Convert.ToString(row["DISTRICT_NAME"]); } if (row["SUB_DISTRICT_ID"] != DBNull.Value) { account.SubDistrictId = Convert.ToInt32(row["SUB_DISTRICT_ID"]); } if (row["SUB_DISTRICT_NAME"] != DBNull.Value) { account.SubDistrictName = Convert.ToString(row["SUB_DISTRICT_NAME"]); account.FullAddress = account.FullAddress + " " + Convert.ToString(row["SUB_DISTRICT_NAME"]); } if (row["POSTAL_CODE"] != DBNull.Value) { account.PostalCode = Convert.ToInt32(row["POSTAL_CODE"]); account.FullAddress = account.FullAddress + " " + Convert.ToString(row["POSTAL_CODE"]); } if (row["NATIONALITY"] != DBNull.Value) { account.Nationality = Convert.ToInt32(row["NATIONALITY"]); if (Convert.ToInt32(row["NATIONALITY"]) > 0) { account.NationalityName = VaaaN.MLFF.Libraries.CommonLibrary.Constants.NationalityName[Convert.ToInt32(row["NATIONALITY"]) - 1]; } } if (row["GENDER"] != DBNull.Value) { account.Gender = Convert.ToInt32(row["GENDER"]); if (Convert.ToInt32(row["GENDER"]) > 0) { account.GenderName = VaaaN.MLFF.Libraries.CommonLibrary.Constants.GenderName[Convert.ToInt32(row["GENDER"]) - 1]; } } if (row["MARITAL_STATUS"] != DBNull.Value) { account.MaritalStatus = Convert.ToInt32(row["MARITAL_STATUS"]); if (Convert.ToInt32(row["MARITAL_STATUS"]) > 0) { account.MaritalStatusName = VaaaN.MLFF.Libraries.CommonLibrary.Constants.MaritalStatusName[Convert.ToInt32(row["MARITAL_STATUS"]) - 1]; } } if (row["OCCUPATION"] != DBNull.Value) { account.Occupation = Convert.ToString(row["OCCUPATION"]); } if (row["RESIDENTIDCARDIMAGE"] != DBNull.Value) { account.ResidentidcardImagePath = Convert.ToString(row["RESIDENTIDCARDIMAGE"]); } if (row["VALID_UNTIL"] != DBNull.Value) { account.ValidUntil = Convert.ToDateTime(row["VALID_UNTIL"]); } if (row["REGISTRATION_THROUGH"] != DBNull.Value) { account.RegistartionThrough = Convert.ToInt32(row["REGISTRATION_THROUGH"]); } return(account); }