public override int GetHashCode() { int hash = 1; if (DataVersion.Length != 0) { hash ^= DataVersion.GetHashCode(); } if (DataBuild != 0) { hash ^= DataBuild.GetHashCode(); } hash ^= abilities_.GetHashCode(); hash ^= buffs_.GetHashCode(); hash ^= unitTypes_.GetHashCode(); hash ^= upgrades_.GetHashCode(); hash ^= unitProducers_.GetHashCode(); hash ^= unitRequiredBuildings_.GetHashCode(); hash ^= researchProducer_.GetHashCode(); hash ^= researchRequiredBuildings_.GetHashCode(); hash ^= researchRequiredResearch_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public List <DataVersion> GetDataVersions() { List <DataVersion> list = new List <DataVersion>(); MySqlCommand cmd = new MySqlCommand("select * from sbsdb.data_version", con); con.Open(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DataVersion obj = new DataVersion(); obj.version = Convert.ToInt32(reader["version"]); obj.tbl_name = Convert.ToString(reader["tbl_name"]); list.Add(obj); } if (con != null) { con.Close(); } if (reader != null) { reader.Close(); } return(list); }
public IHttpActionResult Post([FromBody] string data) { if (data == null) { return(Json <int>(0)); } DataVersion converted = JsonConvert.DeserializeObject <DataVersion>(data); Console.WriteLine("received this on server for checking database version:\n" + converted.ToString()); Console.WriteLine("Trying to find the version..."); string fromDB = GetVersionOfThatType(converted.TypeName); if (fromDB == converted.Version) { // version is ok and nothing to be changed Console.WriteLine("Version was ok. returning it so its true."); return(Json <string>(converted.Version)); } else if (fromDB == "404") { // version is error Console.WriteLine("Some error occured"); return(Json <int>(404)); } else { // version is just another. so we will return it anyway Console.WriteLine("Version is not the same. Returning it and getting false but its ok."); return(Json <string>(fromDB)); } }
/// <summary> /// Getting data version. If table doesn't exists will be created. /// </summary> private DataVersion GetDataVersionCreateIfNeeded() { DataVersion dataVersion = null; using (DbTransaction tra = DataAccess.Instance.Connection.BeginTransaction()) { using (DbCommand cmd = DataAccess.Instance.Connection.CreateCommand()) { cmd.CommandText = "create table if not exists DATA_VERSION (MAJOR int, MINOR int)"; cmd.ExecuteNonQuery(); cmd.CommandText = "select MAJOR, MINOR from DATA_VERSION"; using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { dataVersion = new DataVersion(); dataVersion.Major = reader.GetInt32(reader.GetOrdinal("MAJOR")); dataVersion.Minor = reader.GetInt32(reader.GetOrdinal("MINOR")); } reader.Close(); } if (dataVersion == null) { cmd.CommandText = "insert into DATA_VERSION (MAJOR, MINOR) values (1, 0)"; cmd.ExecuteNonQuery(); dataVersion = new DataVersion(); dataVersion.Major = 1; dataVersion.Minor = 0; } } tra.Commit(); } return(dataVersion); }
public ActionResult <DataVersion> Get(int id) // GET: api/DataVersion/Elements/1 { try { Dictionary <int, DataVersion> dataVersionElements = DataLoader.GetDataOfDataVersionDirectory(); DataVersion dataVersionElement = new DataVersion(); if (dataVersionElements.TryGetValue(id, out dataVersionElement)) { return(dataVersionElement); } else { // Кидаем 404-ю, так как запрашиваемый объект не найден return(this.StatusCode(404)); // TODO: Запись в логи } } catch (Exception ex) { // Кидаем 500-ю ошибку, так как поймали исключение во время чтения данных return(this.StatusCode(500)); // TODO: Запись в логи } }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(DataVersions dataversions, System.Data.DataSet data) { // Do nothing if we have nothing if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0) { return; } // Create a local variable for the new instance. DataVersion newobj = null; // Create a local variable for the data row instance. System.Data.DataRow dr = null; // Iterate through the table rows for (int i = 0; i < data.Tables[0].Rows.Count; i++) { // Get a reference to the data row dr = data.Tables[0].Rows[i]; // Create a new object instance newobj = System.Activator.CreateInstance(dataversions.ContainsType[0]) as DataVersion; // Let the instance set its own members newobj.SetMembers(ref dr); // Add the new object to the collection instance dataversions.Add(newobj); } }
private void butSaveChanges_Click(object sender, EventArgs e) { // Check if we need to transform mesh var transform = panelRendering.GizmoTransform; if (transform != Matrix4x4.Identity) { for (int i = 0; i < _workingStatic.Mesh.VerticesPositions.Count; i++) { var position = MathC.HomogenousTransform(_workingStatic.Mesh.VerticesPositions[i], transform); _workingStatic.Mesh.VerticesPositions[i] = new Vector3(position.X, position.Y, position.Z); } for (int i = 0; i < _workingStatic.Mesh.VerticesNormals.Count; i++) { var normal = MathC.HomogenousTransform(_workingStatic.Mesh.VerticesNormals[i], transform); _workingStatic.Mesh.VerticesNormals[i] = new Vector3(normal.X, normal.Y, normal.Z); } } // Assign the edited mesh to original static mesh _wad.Statics.Remove(_workingStatic.Id); _wad.Statics.Add(_workingStatic.Id, _workingStatic); _workingStatic.Version = DataVersion.GetNext(); _tool.ToggleUnsavedChanges(); DialogResult = DialogResult.OK; Close(); }
/// <summary> /// 获取用户可访问的菜单 /// </summary> /// <returns></returns> static async Task <List <long> > GetAllUserMenus() { int cnt = AtState.GetScalar <int>("select count(*) from DataVersion where id='menu'"); if (cnt == 0) { // 查询服务端 Dict dt = await AtCm.GetMenus(Kit.UserID); // 记录版本号 var ver = new DataVersion(ID: "menu", Ver: dt.Str("ver")); await AtState.Save(ver, false); // 清空旧数据 AtState.Exec("delete from UserMenu"); // 插入新数据 var ls = (List <long>)dt["result"]; if (ls != null && ls.Count > 0) { List <Dict> dts = new List <Dict>(); foreach (var id in ls) { dts.Add(new Dict { { "id", id } }); } AtState.BatchExec("insert into UserMenu (id) values (:id)", dts); } return(ls); } return(AtState.FirstCol <long>("select id from UserMenu")); }
/// <summary> /// in case we need to change mobiledatabase /// </summary> void InitVersionDB() { Item returnedItem = App.ItemDatabase.GetItem(1); int returned = App.VersionDatabase.SaveVersion(new DataVersion("Rolls", "1", 1)); data = App.VersionDatabase.GetVersionByID(1); }
/// <summary> /// Fill method for populating an entire collection of DataVersions /// </summary> public virtual void Fill(DataVersions dataVersions) { // create the connection to use SqlConnection cnn = new SqlConnection(DataVersion.GetConnectionString()); try { using (cnn) { // open the connection cnn.Open(); // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectDataVersions"); // Send the collection and data to the object factory CreateObjectsFromData(dataVersions, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
private static void KKChaFileLoadFileHook(KoikatsuCharaFile.ChaFile file, BlockHeader header, BinaryReader reader) { var info = header.SearchInfo(Marker); if (info != null && info.version == DataVersion.ToString()) { var originalPosition = reader.BaseStream.Position; var basePosition = originalPosition - header.lstInfo.Sum(x => x.size); reader.BaseStream.Position = basePosition + info.pos; var data = reader.ReadBytes((int)info.size); reader.BaseStream.Position = originalPosition; try { var dictionary = MessagePackDeserialize <Dictionary <string, PluginData> >(data); _internalCharaImportDictionary.Set(file, dictionary); } catch (Exception e) { Logger.Log(LogLevel.Warning, $"Invalid or corrupted extended data in card \"{file.charaFileName}\" - {e.Message}"); reader.BaseStream.Position = originalPosition; } } }
private void FormStaticEditor_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { _workingStatic.Version = DataVersion.GetNext(); } }
private static void ChaFileSaveFileHook(ChaFile file, BlockHeader header, ref long[] array3) { Dictionary <string, PluginData> extendedData = GetAllExtendedData(file); if (extendedData == null) { currentlySavingData = null; return; } currentlySavingData = MessagePackSerializer.Serialize(extendedData); //get offset long offset = array3.Sum(); long length = currentlySavingData.LongLength; //insert our custom data length at the end Array.Resize(ref array3, array3.Length + 1); array3[array3.Length - 1] = length; //add info about our data to the block header BlockHeader.Info info = new BlockHeader.Info { name = Marker, version = DataVersion.ToString(), pos = offset, size = length }; header.lstInfo.Add(info); }
/// <summary> /// Convert the data of this class (all fields) into byte data. /// </summary> /// <returns>Byte data.</returns> public override byte[] GetBytes() { byte[] headbytes = new byte[HeadSize]; // !!!!Caution: keep the order of the following code lines!!!! var data = GetBytes(Signature, DataVersion.Bytes(), DataByteCount.Bytes(), StartClassId.Bytes(), ClassIdsCount.Bytes(), ClassIdsDataOffset.Bytes(), SchemaTypeCount.Bytes(), SchemaTypeDataOffset.Bytes(), ParticleCount.Bytes(), ParticleDataOffset.Bytes(), ParticleChildrenIndexCount.Bytes(), ParticleChildrenIndexDataOffset.Bytes(), AttributeCount.Bytes(), AttributeDataOffset.Bytes(), SimpleTypeCount.Bytes(), SimpleTypeDataOffset.Bytes()); data.CopyTo(headbytes, 0); return(headbytes); }
private static void ChaFileLoadFileHook(ChaFile file, BlockHeader header, BinaryReader reader) { var info = header.SearchInfo(Marker); if (info != null && info.version == DataVersion.ToString()) { long originalPosition = reader.BaseStream.Position; long basePosition = originalPosition - header.lstInfo.Sum(x => x.size); reader.BaseStream.Position = basePosition + info.pos; byte[] data = reader.ReadBytes((int)info.size); reader.BaseStream.Position = originalPosition; cardReadEventCalled = true; try { var dictionary = MessagePackSerializer.Deserialize <Dictionary <string, PluginData> >(data); internalCharaDictionary.Set(file, dictionary); } catch (Exception e) { internalCharaDictionary.Set(file, new Dictionary <string, PluginData>()); Logger.LogWarning($"Invalid or corrupted extended data in card \"{file.charaFileName}\" - {e.Message}"); } CardReadEvent(file); } else { internalCharaDictionary.Set(file, new Dictionary <string, PluginData>()); } }
/// <summary> /// Метод содержит конструкции, по созданию всех возможных вариаций запросов к сервису справочников (DirectoryService) /// </summary> public static async Task TestDirectoryServiceApiAsync(UrlSettings urlSettings) { using (var client = new HttpClient()) { HttpResponseMessage response; // Запросим и десериализуем метаданные по справочникам: // Для справочника "Объекты Строительства" response = await client.GetAsync($"{urlSettings.ConstructionObjectUrl}GetMetadata"); DirectoryMetadata MetadataDirectoryOfConstructionObjects = await response.Content.ReadAsAsync <DirectoryMetadata>(); // Для справочника "Версии Данных" response = await client.GetAsync($"{urlSettings.DataVersionUrl}GetMetadata"); DirectoryMetadata MetadataDirectoryOfDataVersions = await response.Content.ReadAsAsync <DirectoryMetadata>(); // TODO: Полученные метаданные можно сравнивать с метаданными объектов этого сервиса // и в случае несовпадения, как-то уведомлять разработчиков о необх. поправки структуры классов. // Запрашиваем весь справочник "Объекты Строительства" response = await client.GetAsync($"{urlSettings.ConstructionObjectUrl}GetAllDirectory"); IEnumerable <ConstructionObject> сonstructionObjects = await response.Content.ReadAsAsync <IEnumerable <ConstructionObject> >(); // Запрашиваем весь справочник "Версии Данных" response = await client.GetAsync($"{urlSettings.DataVersionUrl}GetAllDirectory"); IEnumerable <DataVersion> dataVersions = await response.Content.ReadAsAsync <IEnumerable <DataVersion> >(); // Запросим Объект Строительства с идом = 2: int indexOfConstructionObject = 2; response = await client.GetAsync($"{urlSettings.ConstructionObjectUrl}Elements/{indexOfConstructionObject}"); ConstructionObject сonstructionObject = await response.Content.ReadAsAsync <ConstructionObject>(); // Запросим Версию Данных с идом = 3: int indexOfDataVersion = 3; response = await client.GetAsync($"{urlSettings.DataVersionUrl}Elements/{indexOfConstructionObject}"); DataVersion dataVersion = await response.Content.ReadAsAsync <DataVersion>(); // Попробуем запросить Версию Данных с идом = 88: indexOfDataVersion = 88; response = await client.GetAsync($"{urlSettings.DataVersionUrl}Elements/{indexOfDataVersion}"); // dataVersionEmpty будет = null. DataVersion dataVersionEmpty = await response.Content.ReadAsAsync <DataVersion>(); } }
private void Tool_EditorEventRaised(IEditorEvent obj) { if (obj is WadToolClass.StaticSelectedLightChangedEvent) { UpdateLightUI(); } else if (obj is WadToolClass.StaticLightsChangedEvent) { UpdateLightsList(); UpdateLightUI(); _workingStatic.Version = DataVersion.GetNext(); panelRendering.Invalidate(); } }
private void SaveChanges() { // First check if skeleton is valid int numPop = 0; int numPush = 0; foreach (var bone in _bones) { if (bone.Bone.OpCode == WadLinkOpcode.Pop) { numPop++; } if (bone.Bone.OpCode == WadLinkOpcode.Push) { numPush++; } } // We can have more PUSH than POP, but the opposite case (POP more than PUSH) will result in a leak // inside the previous moveables in the list if (numPop > numPush) { DarkMessageBox.Show(this, "Your mesh tree is unbalanced, you have added more POP than PUSH.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (treeSkeleton.Nodes.Count > 1) { DarkMessageBox.Show(this, "Your mesh tree is unbalanced, you must have a single bone as root.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Insert new bones in moveable _moveable.Bones.Clear(); foreach (var bone in _bones) { _moveable.Bones.Add(bone.Bone); } // Replace the moveable _wad.Moveables[_moveable.Id] = _moveable; // Now cause the moveable to reload _moveable.Version = DataVersion.GetNext(); _tool.ToggleUnsavedChanges(); }
public async Task GrabbElitTournament() { IEnumerable <League> tables = await _grabberProvider.GetLeagues(); IEnumerable <Schedule> schedule = await _grabberProvider.GetSchedule(); // TODO: implement score //List<League> scores = await _grabberProvider.GetScores(); DataVersion dataVersion = new DataVersion { Leagues = tables, Schedules = schedule }; await _dataVersionRepository.CreateAsync(dataVersion); }
/// <summary> /// Deletes the object. /// </summary> public virtual void Delete(DataVersion deleteObject) { // create a new instance of the connection SqlConnection cnn = new SqlConnection(DataVersion.GetConnectionString()); // create local variable array for the sql parameters SqlParameterHash sqlparams = null; try { // discover the parameters sqlparams = SqlHelperParameterCache.GetSpParameterSet(DataVersion.GetConnectionString(), "gsp_DeleteDataVersion"); // Store the parameter for the Id attribute. sqlparams["@id"].Value = deleteObject.Id; using (cnn) { // open the connection cnn.Open(); // Execute the stored proc to perform the delete on the instance. SqlHelper.ExecuteNonQuery(cnn, CommandType.StoredProcedure, "gsp_DeleteDataVersion", sqlparams); // close the connection after usage cnn.Close(); } // nullify the connection var cnn = null; } catch (SqlException sqlex) { throw sqlex; } // nullify the reference deleteObject = null; }
/// <summary> /// Fill method for populating a collection by DATA_INFORMATION /// </summary> public void FillByDataInformation(DataVersions dataVersions, System.Int64 loanApplicationId) { // create the connection to use SqlConnection cnn = new SqlConnection(DataVersion.GetConnectionString()); try { // discover the sql parameters SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(DataVersion.GetConnectionString(), "gsp_SelectDataVersionsByDataInformation"); using (cnn) { // open the connection cnn.Open(); // set the parameters sqlparams["@loanApplicationId"].Value = loanApplicationId; // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectDataVersionsByDataInformation", sqlparams); // Send the collection and data to the object factory. CreateObjectsFromData(dataVersions, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
/// <summary> /// Fills a single instance with data based on its primary key values. /// </summary> public virtual void Fill(DataVersion dataversion, System.Int32 id) { // create the connection to use SqlConnection cnn = new SqlConnection(DataVersion.GetConnectionString()); try { // discover the sql parameters SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(DataVersion.GetConnectionString(), "gsp_SelectDataVersion"); using (cnn) { // open the connection cnn.Open(); // set the parameters sqlparams["@id"].Value = id; // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectDataVersion", sqlparams); if (datareader.Read()) { dataversion.SetMembers(ref datareader); } cnn.Close(); // close the connection } // nullify the connection var cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
private void butImportMeshFromFile_Click(object sender, EventArgs e) { using (FileDialog dialog = new OpenFileDialog()) { dialog.InitialDirectory = PathC.GetDirectoryNameTry(_tool.DestinationWad.FileName); dialog.FileName = PathC.GetFileNameTry(_tool.DestinationWad.FileName); dialog.Filter = BaseGeometryImporter.FileExtensions.GetFilter(); dialog.Title = "Select a 3D file that you want to see imported."; if (dialog.ShowDialog(this) != DialogResult.OK) { return; } using (var form = new GeometryIOSettingsDialog(new IOGeometrySettings())) { form.AddPreset(IOSettingsPresets.GeometryImportSettingsPresets); if (form.ShowDialog(this) != DialogResult.OK) { return; } var mesh = WadMesh.ImportFromExternalModel(dialog.FileName, form.Settings); if (mesh == null) { DarkMessageBox.Show(this, "Error while loading 3D model. Check that the file format \n" + "is supported, meshes are textured and texture file is present.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _workingStatic.Mesh = mesh; _workingStatic.VisibilityBox = _workingStatic.Mesh.CalculateBoundingBox(panelRendering.GizmoTransform); _workingStatic.CollisionBox = _workingStatic.Mesh.CalculateBoundingBox(panelRendering.GizmoTransform); _workingStatic.Version = DataVersion.GetNext(); _workingStatic.Mesh.CalculateNormals(); panelRendering.Invalidate(); UpdatePositionUI(); UpdateCollisionBoxUI(); UpdateVisibilityBoxUI(); UpdateLightUI(); } } }
/// <summary> /// 更新数据 /// </summary> /// <param name="keyPrefix"></param> /// <param name="typeId"></param> /// <returns></returns> public async Task <bool> SetAsync(string keyPrefix, int typeId) { var key = $"{keyPrefix}:{typeId}"; var dataVersion = await _redisDatabase.HashGetAsync <DataVersion>(RedisHashKey, key); if (dataVersion == null) { dataVersion = new DataVersion { TypeId = typeId, Version = 0, }; } dataVersion.Version++; dataVersion.UpdateTime = DateTime.Now; _redisDatabase.HashSetAsync <DataVersion>(RedisHashKey, key, dataVersion).ContinueWithOnFaultedHandleLog(_logger); return(true); }
public bool SaveChanges(IWin32Window owner = null) // No owner - no confirmation! { if (owner != null && DarkMessageBox.Show(owner, "Do you really want to save changes to animations?", "Save changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return(false); } // Clear the old animations Moveable.Animations.Clear(); // Combine WadAnimation and Animation classes foreach (var animation in Animations) { Moveable.Animations.Add(GetSavedAnimation(animation)); } Moveable.Version = DataVersion.GetNext(); Tool.ToggleUnsavedChanges(); return(true); }
//更新数据格式版本 private void UpdateDataVersion() { if (File.Exists(Application.persistentDataPath + dataVersionFile) == true) { BinaryFormatter bfOpen = new BinaryFormatter(); FileStream fileOpen = File.Open(Application.persistentDataPath + dataVersionFile, FileMode.Open); DataVersion version = (DataVersion)bfOpen.Deserialize(fileOpen); fileOpen.Close(); switch (version.major) { case 1: break; } } BinaryFormatter bfCreate = new BinaryFormatter(); FileStream fileCreate = File.Create(Application.persistentDataPath + dataVersionFile); bfCreate.Serialize(fileCreate, dataVersion); fileCreate.Close(); }
public override int GetHashCode() { int hash = 1; if (DataVersion.Length != 0) { hash ^= DataVersion.GetHashCode(); } if (androidVersion_ != null) { hash ^= AndroidVersion.GetHashCode(); } if (iOSVersion_ != null) { hash ^= IOSVersion.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(DataVersions dataversions, System.Data.SqlClient.SqlDataReader data) { // Do nothing if we have nothing if (data == null) { return; } // Create a local variable for the new instance. DataVersion newobj = null; // Iterate through the data reader while (data.Read()) { // Create a new object instance newobj = System.Activator.CreateInstance(dataversions.ContainsType[0]) as DataVersion; // Let the instance set its own members newobj.SetMembers(ref data); // Add the new object to the collection instance dataversions.Add(newobj); } }
/// <summary> /// Updates the version of data format. /// </summary> private void UpdateDataVersion() { if (File.Exists(Application.persistentDataPath + dataVersionFile) == true) { BinaryFormatter bfOpen = new BinaryFormatter(); FileStream fileToOpen = File.Open(Application.persistentDataPath + dataVersionFile, FileMode.Open); DataVersion version = (DataVersion)bfOpen.Deserialize(fileToOpen); fileToOpen.Close(); switch (version.major) { case 1: // Stored data has version 1.x // Some handler to convert data if it is needed ... break; } } BinaryFormatter bfCreate = new BinaryFormatter(); FileStream fileToCreate = File.Create(Application.persistentDataPath + dataVersionFile); bfCreate.Serialize(fileToCreate, dataVersion); fileToCreate.Close(); }
/// <summary> /// 判断当前登录用户是否具有指定权限 /// </summary> /// <param name="p_id">权限ID</param> /// <returns>true 表示有权限</returns> public static async Task <bool> HasPrv(string p_id) { int cnt = AtState.GetScalar <int>("select count(*) from DataVersion where id='privilege'"); if (cnt == 0) { // 查询服务端 Dict dt = await new UnaryRpc( "cm", "UserRelated.GetPrivileges", UserID ).Call <Dict>(); // 记录版本号 var ver = new DataVersion(ID: "privilege", Ver: dt.Str("ver")); await AtState.Save(ver, false); // 清空旧数据 AtState.Exec("delete from UserPrivilege"); // 插入新数据 var ls = (List <string>)dt["result"]; if (ls != null && ls.Count > 0) { List <Dict> dts = new List <Dict>(); foreach (var prv in ls) { dts.Add(new Dict { { "prv", prv } }); } AtState.BatchExec("insert into UserPrivilege (prv) values (:prv)", dts); } } return(AtState.GetScalar <int>($"select count(*) from UserPrivilege where Prv='{p_id}'") > 0); }
/// <summary> /// Loads the loan object with information from a Fannie Mae set of data. /// </summary> /// <param name="fileBytes">The fannie data bytes.</param> protected virtual void LoadDU(byte[] fileBytes) { DUHelper du = new DUHelper(fileBytes); Exception invalidfiledata = new Exception("The file data is not a recognized Fannie Mae DU format."); #region DATA_INFORMATION // capture the versioning information int vercount = du.BeginCapture("000"); if (vercount < 1) throw invalidfiledata; else { this._datainformation = new DataInformation(); for(int i = 0; i<vercount; i++) { MISMO.BusinessObjects.DataVersion dv = new DataVersion(); dv.Name = du.ExtractCaptureData(i, 4, 3); if (dv.Name == "1") dv.Name = "1003"; dv.Number = du.ExtractCaptureData(i, 7, 5); this._datainformation.DataVersions.Add(dv); } } du.EndCapture(); if (vercount > 0 && !(this.DataInformation.DataVersions[0].Number == "3.20" || this.DataInformation.DataVersions[0].Number == "3.2") ) throw new NotImplementedException("Fannie Mae loader only supports 3.20 DU file formats."); #endregion DATA_INFORMATION #region MORTGAGE_TERMS string tempval = null; // extract information for the mortgage terms tempval = du.ExtractData("01A", 86, 30); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.AgencyCaseIdentifier = tempval; } tempval = du.ExtractData("01A", 238, 80); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.ARMTypeDescription = tempval; } tempval = du.ExtractData("01A", 131, 15); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.BaseLoanAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("01A", 131, 15); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.BorrowerRequestedLoanAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("01A", 116, 15); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.LenderCaseIdentifier = tempval; } tempval = du.ExtractData("01A", 153, 3); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.LoanAmortizationTermMonths = Convert.ToDecimal(tempval); } tempval = du.ExtractData("01A", 156, 2); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); switch(tempval) { case "01": { this.MortgageTerms.LoanAmortizationType = (short) MISMO.Enums.LoanAmortizationType.AdjustableRate; break; } case "04": { this.MortgageTerms.LoanAmortizationType = (short) MISMO.Enums.LoanAmortizationType.GrowingEquityMortgage; break; } case "05": { this.MortgageTerms.LoanAmortizationType = (short) MISMO.Enums.LoanAmortizationType.Fixed; break; } case "06": { this.MortgageTerms.LoanAmortizationType = (short) MISMO.Enums.LoanAmortizationType.GraduatedPaymentMortgage; break; } case "13": { this.MortgageTerms.LoanAmortizationType = (short) MISMO.Enums.LoanAmortizationType.OtherAmortizationType; break; } } } tempval = du.ExtractData("01A", 4, 2); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); switch(tempval) { case "01": { this.MortgageTerms.MortgageType = (short) MISMO.Enums.MortgageType.Conventional; break; } case "02": { this.MortgageTerms.MortgageType = (short) MISMO.Enums.MortgageType.VA; break; } case "03": { this.MortgageTerms.MortgageType = (short) MISMO.Enums.MortgageType.FHA; break; } case "04": { this.MortgageTerms.MortgageType = (short) MISMO.Enums.MortgageType.FarmersHomeAdministration; break; } case "07": { this.MortgageTerms.MortgageType = (short) MISMO.Enums.MortgageType.Other; break; } } } tempval = du.ExtractData("01A", 6, 80); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.OtherMortgageTypeDescription= tempval; } tempval = du.ExtractData("01A", 158, 80); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.OtherAmortizationTypeDescription = tempval; } tempval = du.ExtractData("01A", 146, 7); if (tempval != string.Empty) { if (_mortgageterms == null) _mortgageterms = new MISMO.BusinessObjects.MortgageTerms(); this.MortgageTerms.RequestedInterestRatePercent = Convert.ToDecimal(tempval); } #endregion MORTGAGE_TERMS #region PROPERTY // now let us get PROPERTY information tempval = du.ExtractData("02A", 4, 50); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.StreetAddress = tempval; } tempval = du.ExtractData("02A", 54, 35); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.City = tempval; } tempval = du.ExtractData("02A", 89, 2); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.State = tempval; } tempval = du.ExtractData("GOA", 102, 35); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.County = tempval; } tempval = du.ExtractData("02A", 91, 5); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.PostalCode = tempval; } tempval = du.ExtractData("02A", 96, 4); if (tempval != string.Empty && _prop != null && !this.Property.PostalCodeIsNull) this.Property.PostalCode += string.Format("-{0}", tempval); tempval = du.ExtractData("02A", 100, 3); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.FinancedNumberOfUnits = Convert.ToInt32(tempval); } tempval = du.ExtractData("02A", 185, 4); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); this.Property.StructureBuiltYear = DateTime.Parse(string.Format("12/31/{0}", tempval)); } MISMO.BusinessObjects.LegalDescription legdesc = null; tempval = du.ExtractData("02A", 105, 80); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); if (legdesc == null) { legdesc = new MISMO.BusinessObjects.LegalDescription(); this.Property.LegalDescriptions.Add(legdesc); } legdesc.TextDescription = tempval; } tempval = du.ExtractData("02A", 103, 2); if (tempval != string.Empty) { if (_prop == null) _prop = new AUS.Property(); if (legdesc == null) { legdesc = new MISMO.BusinessObjects.LegalDescription(); this.Property.LegalDescriptions.Add(legdesc); } switch(tempval) { case "F1": { legdesc.Type = (short) MISMO.Enums.LegalDescriptionType.Other; break; } case "02": { legdesc.Type = (short) MISMO.Enums.LegalDescriptionType.MetesAndBounds; break; } } } #endregion PROPERTY #region BORROWER // get the borrower information System.Collections.Specialized.StringCollection brwssncol = new System.Collections.Specialized.StringCollection(); int borrowercount = du.BeginCapture("03A"); Borrower brw = null; if (borrowercount > 0) { for(int i = 0; i<borrowercount; i++) { brw = new Borrower(); tempval = du.ExtractCaptureData(i, 15, 35); if (tempval != string.Empty) brw.FirstName = tempval; tempval = du.ExtractCaptureData(i, 50, 35); if (tempval != string.Empty) brw.MiddleName = tempval; tempval = du.ExtractCaptureData(i, 85, 35); if (tempval != string.Empty) brw.LastName = tempval; tempval = du.ExtractCaptureData(i, 120, 4); if (tempval != string.Empty) brw.NameSuffix = tempval; tempval = du.ExtractCaptureData(i, 134, 3); if (tempval != string.Empty) brw.AgeAtApplicationYears = Convert.ToDecimal(tempval); // TODO: revisit extracting borrower data in different captures zones // tempval = du.ExtractCaptureData(i, 13, 8); // if (tempval != string.Empty) brw.ApplicationSignedDate = DateTime.Parse(string.Format("{0}/{1}/{2}", tempval.Substring(4, 2), tempval.Substring(6, 2), tempval.Substring(0, 4))); tempval = du.ExtractCaptureData(i, 124, 10); if (tempval != string.Empty) { MISMO.BusinessObjects.ContactPoint cp = new ContactPoint(); cp.Type = (short) MISMO.Enums.ContactPointType.Phone; cp.Value = tempval; brw.ContactPoints.Add(cp); } tempval = du.ExtractCaptureData(i, 4, 2); switch(tempval) { case "BW": { brw.PrintPositionType = (short) MISMO.Enums.PrintPositionType.Borrower; break; } case "QZ": { brw.PrintPositionType = (short) MISMO.Enums.PrintPositionType.CoBorrower; break; } } tempval = du.ExtractCaptureData(i, 6, 9); if (tempval != string.Empty) brw.SSN = tempval; tempval = du.ExtractCaptureData(i, 140, 2); if (tempval != string.Empty) brw.DependentCount = Convert.ToByte(tempval); tempval = du.ExtractCaptureData(i, 142, 1); switch(tempval) { case "Y": { brw.JointAssetLiabilityReportingType = (short) MISMO.Enums.JointAssetLiabilityReportingType.Jointly; break; } case "N": { brw.JointAssetLiabilityReportingType = (short) MISMO.Enums.JointAssetLiabilityReportingType.NotJointly; break; } } tempval = du.ExtractCaptureData(i, 139, 1); switch(tempval) { case "M": { brw.MaritalStatusType = (short) MISMO.Enums.MaritalStatusType.Married; break; } case "S": { brw.MaritalStatusType = (short) MISMO.Enums.MaritalStatusType.Separated; break; } case "U": { brw.MaritalStatusType = (short) MISMO.Enums.MaritalStatusType.Unmarried; break; } } tempval = du.ExtractCaptureData(i, 137, 2); if (tempval != string.Empty) brw.SchoolingYears = Convert.ToDecimal(tempval); this.Borrowers.Add(brw); } } // end of borrowers section #endregion BORROWER #region DOWN_PAYMENTS // extract the down payments int downpaymentcount = du.BeginCapture("02E"); if (downpaymentcount > 0) { MISMO.BusinessObjects.DownPayment dp = null; for(int i = 0; i<downpaymentcount; i++) { dp = new MISMO.BusinessObjects.DownPayment(); tempval = du.ExtractCaptureData(i, 6, 15); if (tempval != string.Empty) dp.Amount = Convert.ToDecimal(tempval); tempval = du.ExtractCaptureData(i, 21, 80); if (tempval != string.Empty) dp.SourceDescription = tempval; tempval = du.ExtractCaptureData(i, 4, 2); switch(tempval) { case "F1": { dp.Type = (short) MISMO.Enums.DownPaymentType.CheckingSavings; break; } case "F2": { dp.Type = (short) MISMO.Enums.DownPaymentType.DepositOnSalesContract; break; } case "F3": { dp.Type = (short) MISMO.Enums.DownPaymentType.EquityOnSoldProperty; break; } case "03": { dp.Type = (short) MISMO.Enums.DownPaymentType.EquityOnPendingSale; break; } case "04": { dp.Type = (short) MISMO.Enums.DownPaymentType.GiftFunds; break; } case "F5": { dp.Type = (short) MISMO.Enums.DownPaymentType.StocksAndBonds; break; } case "10": { dp.Type = (short) MISMO.Enums.DownPaymentType.LotEquity; break; } case "09": { dp.Type = (short) MISMO.Enums.DownPaymentType.BridgeLoan; break; } case "01": { dp.Type = (short) MISMO.Enums.DownPaymentType.UnsecuredBorrowedFunds; break; } case "F6": { dp.Type = (short) MISMO.Enums.DownPaymentType.TrustFunds; break; } case "F7": { dp.Type = (short) MISMO.Enums.DownPaymentType.RetirementFunds; break; } case "11": { dp.Type = (short) MISMO.Enums.DownPaymentType.RentWithOptionToPurchase; break; } case "F8": { dp.Type = (short) MISMO.Enums.DownPaymentType.LifeInsuranceCashValue; break; } case "14": { dp.Type = (short) MISMO.Enums.DownPaymentType.SaleOfChattel; break; } case "07": { dp.Type = (short) MISMO.Enums.DownPaymentType.TradeEquity; break; } case "06": { dp.Type = (short) MISMO.Enums.DownPaymentType.SweatEquity; break; } case "02": { dp.Type = (short) MISMO.Enums.DownPaymentType.CashOnHand; break; } case "13": { dp.Type = (short) MISMO.Enums.DownPaymentType.OtherTypeOfDownPayment; break; } case "28": { dp.Type = (short) MISMO.Enums.DownPaymentType.SecuredBorrowedFunds; break; } } this.DownPayments.Add(dp); } } // end of downpaymentcount #endregion DOWN_PAYMENTS #region ADDITIONAL_CASE_DATA.MORTGAGE_SCORE int mortgagescores = du.BeginCapture("SCA"); if (mortgagescores > 0) { if (_additionalcasedata == null) _additionalcasedata = new AdditionalCaseData(); MISMO.BusinessObjects.MortgageScore mtgscore = null; for(int i = 0; i<mortgagescores; i++) { mtgscore = new MISMO.BusinessObjects.MortgageScore(); tempval = du.ExtractCaptureData(i, 10, 8); if (tempval != string.Empty) mtgscore.Date = du.ToDate(tempval); tempval = du.ExtractCaptureData(i, 4, 3); switch(tempval) { case "001": { mtgscore.Type = (short) MISMO.Enums.MortgageScoreType.PMIAuraAQIScore; break; } case "002": { mtgscore.Type = (short) MISMO.Enums.MortgageScoreType.GE_IQScore; break; } case "003": { mtgscore.Type = (short) MISMO.Enums.MortgageScoreType.UGIAccuscore; break; } } tempval = du.ExtractCaptureData(i, 7, 3); if (tempval != string.Empty) mtgscore.Value = tempval; _additionalcasedata.MortgageScores.Add(mtgscore); } } // end of mortgagescores #endregion ADDITIONAL_CASE_DATA.MORTGAGE_SCORE #region ADDITIONAL_CASE_DATA.TRANSMITTAL_DATA tempval = du.ExtractData("99B", 22, 7); if (tempval != string.Empty) { if (_additionalcasedata == null) _additionalcasedata = new AUS.AdditionalCaseData(); if (_additionalcasedata._transmitdata == null) _additionalcasedata._transmitdata = new BusinessObjects.TransmittalData(); this.AdditionalCaseData.TransmittalData.BuydownRatePercent = Convert.ToDecimal(tempval); } tempval = du.ExtractData("99B", 5, 2); if (tempval != string.Empty) { if (_additionalcasedata == null) _additionalcasedata = new AUS.AdditionalCaseData(); if (_additionalcasedata._transmitdata == null) _additionalcasedata._transmitdata = new BusinessObjects.TransmittalData(); switch(tempval) { case "01": { this.AdditionalCaseData.TransmittalData.CurrentFirstMortgageHolderType = (short) MISMO.Enums.MortgageHolderType.FNM; break; } case "02": { this.AdditionalCaseData.TransmittalData.CurrentFirstMortgageHolderType = (short) MISMO.Enums.MortgageHolderType.FRE; break; } case "03": { this.AdditionalCaseData.TransmittalData.CurrentFirstMortgageHolderType = (short) MISMO.Enums.MortgageHolderType.Other; break; } case "F1": { this.AdditionalCaseData.TransmittalData.CurrentFirstMortgageHolderType = (short) MISMO.Enums.MortgageHolderType.Unknown; break; } } } tempval = du.ExtractData("99B", 7, 15); if (tempval != string.Empty) { if (_additionalcasedata == null) _additionalcasedata = new AUS.AdditionalCaseData(); if (_additionalcasedata._transmitdata == null) _additionalcasedata._transmitdata = new BusinessObjects.TransmittalData(); this.AdditionalCaseData.TransmittalData.PropertyAppraisedValueAmount = Convert.ToDecimal(tempval); } #endregion ADDITIONAL_CASE_DATA.TRANSMITTAL_DATA #region LOAN_PURPOSE tempval = du.ExtractData("02B", 89, 60); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); this.Purpose.GSETitleMannerHeldDescription = tempval; } tempval = du.ExtractData("02B", 6, 2); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); switch(tempval) { case "04": { this.Purpose.Type = (short) MISMO.Enums.LoanPurposeType.ConstructionOnly; break; } case "05": { this.Purpose.Type = (short) MISMO.Enums.LoanPurposeType.Refinance; break; } case "13": { this.Purpose.Type = (short) MISMO.Enums.LoanPurposeType.ConstructionToPermanent; break; } case "15": { this.Purpose.Type = (short) MISMO.Enums.LoanPurposeType.Other; break; } case "16": { this.Purpose.Type = (short) MISMO.Enums.LoanPurposeType.Purchase; break; } } } tempval = du.ExtractData("02B", 8, 80); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); this.Purpose.OtherLoanPurposeDescription = tempval; } tempval = du.ExtractData("02B", 150, 8); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); this.Purpose.PropertyLeaseholdExpirationDate = du.ToDate(tempval); } tempval = du.ExtractData("02B", 149, 1); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); switch(tempval) { case "1": { this.Purpose.PropertyRightsType = (short) MISMO.Enums.PropertyRightsType.FeeSimple; break; } case "2": { this.Purpose.PropertyRightsType = (short) MISMO.Enums.PropertyRightsType.Leasehold; break; } } } tempval = du.ExtractData("02B", 88, 1); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); switch(tempval) { case "1": { this.Purpose.PropertyUsageType = (short) MISMO.Enums.PropertyUsageType.PrimaryResidence; break; } case "2": { this.Purpose.PropertyUsageType = (short) MISMO.Enums.PropertyUsageType.SecondHome; break; } case "D": { this.Purpose.PropertyUsageType = (short) MISMO.Enums.PropertyUsageType.Investor; break; } } } #endregion LOAN_PURPOSE #region LOAN_PURPOSE.CONSTRUCTION_REFINANCE_DATA // load up the construction refi data tempval = du.ExtractData("02D", 53, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.ConstructionImprovementCostsAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("02D", 68, 2); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); switch(tempval) { case "F1": { this.Purpose.ConstructionRefinanceData.GSERefinancePurposeType = (short) MISMO.Enums.GSERefinancePurposeType.NoCashOutOther; break; } case "01": { this.Purpose.ConstructionRefinanceData.GSERefinancePurposeType = (short) MISMO.Enums.GSERefinancePurposeType.CashOutOther; break; } case "04": { this.Purpose.ConstructionRefinanceData.GSERefinancePurposeType = (short) MISMO.Enums.GSERefinancePurposeType.CashOutHomeImprovement; break; } case "11": { this.Purpose.ConstructionRefinanceData.GSERefinancePurposeType = (short) MISMO.Enums.GSERefinancePurposeType.CashOutDebtConsolidation; break; } case "13": { this.Purpose.ConstructionRefinanceData.GSERefinancePurposeType = (short) MISMO.Enums.GSERefinancePurposeType.CashOutLimited; break; } } } tempval = du.ExtractData("02D", 38, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.LandEstimatedValueAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("02D", 8, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.LandOriginalCostAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("02D", 4, 4); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.PropertyAcquiredYear = du.ToDate(tempval); } tempval = du.ExtractData("02D", 23, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.PropertyExistingLienAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("02D", 8, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.PropertyOriginalCostAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("02D", 151, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.RefinanceImprovementCostsAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("02D", 151, 15); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); switch(tempval) { case "Y": { this.Purpose.ConstructionRefinanceData.RefinanceImprovementsType = (short) MISMO.Enums.RefinanceImprovementsType.Made; break; } case "N": { this.Purpose.ConstructionRefinanceData.RefinanceImprovementsType = (short) MISMO.Enums.RefinanceImprovementsType.ToBeMade; break; } case "U": { this.Purpose.ConstructionRefinanceData.RefinanceImprovementsType = (short) MISMO.Enums.RefinanceImprovementsType.Unknown; break; } } } tempval = du.ExtractData("02D", 70, 80); if (tempval != string.Empty) { if (_purpose == null) _purpose = new AUS.LoanPurpose(); if (_purpose._consrefidata == null) _purpose._consrefidata = new BusinessObjects.ConstructionRefinanceData(); this.Purpose.ConstructionRefinanceData.RefinanceProposedImprovementsDescription = tempval; } #endregion LOAN_PURPOSE.CONSTRUCTION_REFINANCE_DATA #region LOAN_PRODUCT_DATA.LOAN_FEATURES // load the product data tempval = du.ExtractData("PCH", 7, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.AssumabilityIndicator = (tempval == "Y"); } tempval = du.ExtractData("LNC", 25, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.BalloonIndicator = (tempval == "Y"); } tempval = du.ExtractData("PCH", 4, 3); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.BalloonLoanMaturityTermMonths = Convert.ToDecimal(tempval); } tempval = du.ExtractData("LNC", 28, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.CounselingConfirmationIndicator = (tempval == "Y"); } // TODO: DownPaymentOptionType?? // tempval = du.ExtractData("LNC", 28, 1); // if (tempval != string.Empty) // { // if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); // if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeature(); // switch(tempval) // { // case "": // { // this.ProductData.LoanFeatures.d = (tempval == "Y"); // break; // } // } // } tempval = du.ExtractData("LNC", 58, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.EscrowWaiverIndicator = (tempval == "Y"); } tempval = du.ExtractData("LNC", 6, 2); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); switch(tempval) { case "01": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.Detached; break; } case "02": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.Attached; break; } case "03": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.Condominium; break; } case "04": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.PUD; break; } case "05": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.Cooperative; break; } case "07": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.HighRiseCondominium; break; } case "08": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.ManufacturedHousing; break; } case "09": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.DetachedCondominium; break; } case "10": { this.ProductData.LoanFeatures.GSEPropertyType = (short) MISMO.Enums.GSEPropertyType.ManufacturedHomeCondominiumOrPUDOrCooperative; break; } } } tempval = du.ExtractData("LNC", 4, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); switch(tempval) { case "1": { this.ProductData.LoanFeatures.LienPriorityType = (short) MISMO.Enums.LienPriorityType.FirstLien; break; } case "2": { this.ProductData.LoanFeatures.LienPriorityType = (short) MISMO.Enums.LienPriorityType.SecondLien; break; } case "F": { this.ProductData.LoanFeatures.LienPriorityType = (short) MISMO.Enums.LienPriorityType.Other; break; } } } tempval = du.ExtractData("LNC", 5, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); switch(tempval) { case "A": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.Alternative; break; } case "F": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.FullDocumentation; break; } case "R": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.Reduced; break; } case "B": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.StreamlineRefinance; break; } case "C": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoDocumentation; break; } case "D": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoRatio; break; } // TODO try to verify mapping??? // case "E": // { // this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.; // break; // } case "U": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoIncomeNoEmploymentNoAssetsOn1003; break; } // case "G": // { // this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.no; // break; // } case "J": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoIncomeOn1003; break; } case "K": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoVerificationOfStatedIncomeEmploymentOrAssets; break; } case "L": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoVerificationOfStatedIncomeOrAssests; break; } case "M": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoVerificationOfStatedAssets; break; } case "N": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoVerificationOfStatedIncomeOrEmployment; break; } case "O": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.NoVerificationOfStatedIncome; break; } case "P": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.VerbalVerificationOfEmployment; break; } case "Q": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.OnePaystub; break; } case "S": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.OnePaystubAndVerbalVerificationOfEmployment; break; } case "T": { this.ProductData.LoanFeatures.LoanDocumentationType = (short) MISMO.Enums.LoanDocumentationType.OnePaystubAndOneW2AndVerbalVerificationOfEmploymentOrOneYear1040; break; } } } // end of loan documentation type tempval = du.ExtractData("PCH", 12, 2); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); switch(tempval) { case "N": { this.ProductData.LoanFeatures.LoanRepaymentType = (short) MISMO.Enums.LoanRepaymentType.NoNegativeAmortization; break; } case "F1": { this.ProductData.LoanFeatures.LoanRepaymentType = (short) MISMO.Enums.LoanRepaymentType.ScheduledAmortization; break; } case "F2": { this.ProductData.LoanFeatures.LoanRepaymentType = (short) MISMO.Enums.LoanRepaymentType.InterestOnly; break; } case "P": { this.ProductData.LoanFeatures.LoanRepaymentType = (short) MISMO.Enums.LoanRepaymentType.PotentialNegativeAmortization; break; } case "S": { this.ProductData.LoanFeatures.LoanRepaymentType = (short) MISMO.Enums.LoanRepaymentType.ScheduledNegativeAmortization; break; } } } tempval = du.ExtractData("LNC", 59, 8); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.LoanScheduledClosingDate = du.ToDate(tempval); } tempval = du.ExtractData("LNC", 75, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.MICoveragePercent = Convert.ToDecimal(tempval); } tempval = du.ExtractData("LNC", 82, 3); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); switch(tempval) { case "001": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.GECapitalMICorporation; break; } case "006": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.MortgageGuarantyInsuranceCorporation; break; } case "011": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.PMI_MICorporation; break; } case "012": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.UnitedGuarantyCorporation; break; } case "013": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.RepublicMICompany; break; } case "017": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.RadianGuarantyIncorporated; break; } case "024": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.TriadGuarantyInsuranceCorporation; break; } case "038": { this.ProductData.LoanFeatures.MICompanyNameType = (short) MISMO.Enums.MICompanyNameType.CMG_MICompany; break; } } } tempval = du.ExtractData("LNC", 18, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.NegativeAmortizationLimitPercent = Convert.ToDecimal(tempval); } tempval = du.ExtractData("PCH", 8, 2); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); switch(tempval) { case "01": { this.ProductData.LoanFeatures.PaymentFrequencyType = (short) MISMO.Enums.PaymentFrequencyType.Monthly; break; } case "02": { this.ProductData.LoanFeatures.PaymentFrequencyType = (short) MISMO.Enums.PaymentFrequencyType.Biweekly; break; } } } tempval = du.ExtractData("PCH", 10, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.PrepaymentPenaltyIndicator = (tempval == "Y"); } tempval = du.ExtractData("PCH", 11, 1); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.PrepaymentRestrictionIndicator = (tempval == "Y"); } tempval = du.ExtractData("PID", 4, 30); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.ProductDescription = tempval; } tempval = du.ExtractData("PID", 34, 15); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.ProductName = tempval; } tempval = du.ExtractData("LNC", 67, 8); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._loanfeatures == null) _loanproductdata._loanfeatures = new BusinessObjects.LoanFeatures(); this.ProductData.LoanFeatures.ScheduledFirstPaymentDate = du.ToDate(tempval); } #endregion LOAN_PRODUCT_DATA.LOAN_FEATURES #region TRANSACTION_DETAIL tempval = du.ExtractData("07A", 19, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.AlterationsImprovementsAndRepairsAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 109, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.BorrowerPaidDiscountPointsTotalAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 79, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.EstimatedClosingCostsAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 154, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.MIAndFundingFeeFinancedAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 94, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.MIAndFundingFeeTotalAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 64, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.PrepaidItemsEstimatedAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 4, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.PurchasePriceAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 49, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.RefinanceIncludingDebtsToBePaidOffAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("GOA", 20, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.SalesConcessionAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 139, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.SellerPaidClosingCostsAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("07A", 124, 15); if (tempval != string.Empty) { if (_transdetail == null) _transdetail = new AUS.TransactionDetail(); this.TransactionDetail.SubordinateLienAmount = Convert.ToDecimal(tempval); } #endregion TRANSACTION_DETAIL #region LOAN_PRODUCT_DATA.ARM tempval = du.ExtractData("ARM", 4, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); this.ProductData.ARM.IndexCurrentValuePercent = Convert.ToDecimal(tempval) / 100; } tempval = du.ExtractData("ARM", 13, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); this.ProductData.ARM.IndexMarginPercent = Convert.ToDecimal(tempval) / 100; } tempval = du.ExtractData("ARM", 11, 2); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); switch(tempval) { case "0": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WeeklyAverageConstantMaturingTreasury; break; } case "1": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.MonthlyAverageConstantMaturingTreasury; break; } case "2": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WeeklyAverageTreasuryAuctionAverageInvestmentYield; break; } case "3": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WeeklyAverageTreasuryAuctionAverageBondDiscountYield; break; } case "4": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WeeklyAverageSecondaryMarketTreasuryBillInvestmentYield; break; } case "5": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.DailyCertificateOfDepositRate; break; } case "6": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WeeklyAverageCertificateOfDepositRate; break; } case "7": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WeeklyAveragePrimeRate; break; } case "8": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.TreasuryBillDailyValue; break; } case "9": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.EleventhDistrictCostOfFunds; break; } case "10": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.NationalMonthlyMedianCostOfFunds; break; } case "11": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.WallStreetJournalLIBOR; break; } case "12": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.FNM_LIBOR; break; } case "13": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.FRE_LIBOR; break; } case "14": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.NationalAverageContractRateFHLBB; break; } case "15": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.FederalCostOfFunds; break; } case "16": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.FNM60DayRequiredNetYield; break; } case "17": { _loanproductdata._arm.IndexType = (short) MISMO.Enums.ARMIndexType.FRE60DayRequiredNetYield; break; } } } tempval = du.ExtractData("ARM", 20, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); this.ProductData.ARM.QualifyingRatePercent = Convert.ToDecimal(tempval) / 100; } tempval = du.ExtractData("LNC", 43, 15); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); this.ProductData.ARM.PaymentAdjustmentLifetimeCapAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractData("LNC", 36, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); this.ProductData.ARM.PaymentAdjustmentLifetimeCapPercent = Convert.ToDecimal(tempval) / 100; } tempval = du.ExtractData("LNC", 29, 7); if (tempval != string.Empty) { if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); if (_loanproductdata._arm == null) _loanproductdata._arm = new BusinessObjects.ARM(); this.ProductData.ARM.RateAdjustmentLifetimeCapPercent = Convert.ToDecimal(tempval) / 100; } #endregion LOAN_PRODUCT_DATA.ARM #region LOAN_PRODUCT_DATA.RATE_ADJUSTMENT int rateadjustmentcount = du.BeginCapture("RAJ"); if (rateadjustmentcount > 0) { MISMO.BusinessObjects.RateAdjustment raj = null; if (_loanproductdata == null) _loanproductdata = new AUS.LoanProductData(); for(int i = 0; i<rateadjustmentcount; i++) { raj = new BusinessObjects.RateAdjustment(); tempval = du.ExtractCaptureData(i, 29, 3); if (tempval != string.Empty) raj.FirstRateAdjustmentMonths = Convert.ToDecimal(tempval); tempval = du.ExtractCaptureData(i, 14, 1); switch(tempval) { case "0": { raj.CalculationType = (short) MISMO.Enums.RateAdjustmentCalculationType.AddPercentToCurrentRate; break; } case "1": { raj.CalculationType = (short) MISMO.Enums.RateAdjustmentCalculationType.AddPercentToOriginalRate; break; } case "2": { raj.CalculationType = (short) MISMO.Enums.RateAdjustmentCalculationType.IndexPlusMargin; break; } } tempval = du.ExtractCaptureData(i, 8, 3); if (tempval != string.Empty) raj.DurationMonths = Convert.ToDecimal(tempval); tempval = du.ExtractCaptureData(i, 15, 7); if (tempval != string.Empty) raj.Percent = Convert.ToDecimal(tempval) / 100; tempval = du.ExtractCaptureData(i, 4, 4); if (tempval != string.Empty) raj.PeriodNumber = Convert.ToDecimal(tempval); tempval = du.ExtractCaptureData(i, 22, 7); if (tempval != string.Empty) raj.SubsequentCapPercent = Convert.ToDecimal(tempval) / 100; tempval = du.ExtractCaptureData(i, 11, 3); if (tempval != string.Empty) raj.SubsequentRateAdjustmentMonths = Convert.ToDecimal(tempval); if (raj.CalculationType != (short) Enums.RateAdjustmentCalculationType.Undefined) _loanproductdata._rateadjustments.Add(raj); } } du.EndCapture(); #endregion LOAN_PRODUCT_DATA.RATE_ADJUSTMENT #region PROPOSED_HOUSING_EXPENSE int propsedexpcount = du.BeginCapture("05H"); if (propsedexpcount > 0) { MISMO.BusinessObjects.ProposedHousingExpense propexp = null; for(int i = 0; i<propsedexpcount; i++) { propexp = new BusinessObjects.ProposedHousingExpense(); tempval = du.ExtractCaptureData(i, 14, 2); switch(tempval) { case "25": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.GroundRent; break; } case "26": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.FirstMortgagePrincipalAndInterest; break; } case "22": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.OtherMortgageLoanPrincipalAndInterest; break; } case "01": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.HazardInsurance; break; } case "14": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.RealEstateTax; break; } case "02": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.MI; break; } case "06": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.HomeownersAssociationDuesAndCondominiumFees; break; } case "23": { propexp.HousingExpenseType = (short) MISMO.Enums.HousingExpenseType.OtherHousingExpense; break; } } tempval = du.ExtractCaptureData(i, 16, 15); if (tempval != string.Empty) propexp.PaymentAmount = Convert.ToDecimal(tempval); this.ProposedHousingExpenses.Add(propexp); } } #endregion PROPOSED_HOUSING_EXPENSE #region BORROWER (nested elements) // iterate through all the borrowers and extract their respective data for(int i = 0, j= _borrowers.Count; i<j; i++) { MISMO.BusinessObjects.AUS.Borrower cborrower = _borrowers[i] as AUS.Borrower; #region BORROWER.CURRENT_INCOME int cincomecount = du.BeginCapture("05I", 4, 9, cborrower.SSN); MISMO.BusinessObjects.CurrentIncome cincome = null; if (cincomecount > 0) { for(int k = 0; k<cincomecount; k++) { cincome = new BusinessObjects.CurrentIncome(); tempval = du.ExtractCaptureData(k, 13, 2); switch(tempval) { case "F1": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryBasePay; break; } case "07": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryRationsAllowance; break; } case "F2": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryFlightPay; break; } case "F3": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryHazardPay; break; } case "02": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryClothesAllowance; break; } case "04": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryQuartersAllowance; break; } case "03": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryPropPay; break; } case "F4": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryOverseasPay; break; } case "F5": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryCombatPay; break; } case "F6": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MilitaryVariableHousingAllowance; break; } case "F7": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.AlimonyChildSupport; break; } case "F8": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.NotesReceivableInstallment; break; } case "41": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Pension; break; } case "42": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.SocialSecurity; break; } case "30": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.MortgageDifferential; break; } case "F9": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Trust; break; } case "M1": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Unemployment; break; } case "M2": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.AutomobileExpenseAccount; break; } case "M3": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.FosterCare; break; } case "M4": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.VABenefitsNonEducational; break; } case "45": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.OtherTypesOfIncome; break; } case "20": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Base; break; } case "09": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Overtime; break; } case "08": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Bonus; break; } case "10": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.Commissions; break; } case "17": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.DividendsInterest; break; } case "SI": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.SubjectPropertyNetCashFlow; break; } case "33": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.NetRentalIncome; break; } case "BI": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.OtherTypesOfIncome; break; } case "MC": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.OtherTypesOfIncome; break; } case "TC": { cincome.IncomeType = (short) MISMO.Enums.IncomeType.OtherTypesOfIncome; break; } } tempval = du.ExtractCaptureData(k, 15, 15); if (tempval != string.Empty) cincome.MonthlyTotalAmount = Convert.ToDecimal(tempval); cborrower.CurrentIncomes.Add(cincome); } } #endregion BORROWER.CURRENT_INCOME #region BORROWER.DECLARATION int brwdeclcount = du.BeginCapture("08A", 4, 9, cborrower.SSN); if (brwdeclcount > 0) { // first create an instance of the declaration. if (cborrower.Declaration == null) cborrower.Declaration = new AUS.Declaration(); tempval = du.ExtractCaptureData(0, 19, 1); if (tempval != string.Empty) cborrower.Declaration.AlimonyChildSupportObligationIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 14, 1); if (tempval != string.Empty) cborrower.Declaration.BankruptcyIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 20, 1); if (tempval != string.Empty) cborrower.Declaration.BorrowedDownPaymentIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 22, 2); switch(tempval) { case "01": { cborrower.Declaration.CitizenshipResidencyType = (short) MISMO.Enums.CitizenshipResidencyType.USCitizen; break; } case "03": { cborrower.Declaration.CitizenshipResidencyType = (short) MISMO.Enums.CitizenshipResidencyType.PermanentResidentAlien; break; } case "05": { cborrower.Declaration.CitizenshipResidencyType = (short) MISMO.Enums.CitizenshipResidencyType.NonPermanentResidentAlien; break; } } tempval = du.ExtractCaptureData(0, 21, 1); if (tempval != string.Empty) cborrower.Declaration.CoMakerEndorserOfNoteIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 25, 1); if (tempval != string.Empty && (tempval == "Y" || tempval == "N")) cborrower.Declaration.HomeownerPastThreeYearsType = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 24, 1); if (tempval != string.Empty && (tempval == "Y" || tempval == "N")) cborrower.Declaration.IntentToOccupyType = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 17, 1); if (tempval != string.Empty) cborrower.Declaration.LoanForeclosureOrJudgementIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 13, 1); if (tempval != string.Empty) cborrower.Declaration.OutstandingJudgementsIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 16, 1); if (tempval != string.Empty) cborrower.Declaration.PartyToLawsuitIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 18, 1); if (tempval != string.Empty) cborrower.Declaration.PresentlyDelinquentIndicator = (tempval == "Y"); tempval = du.ExtractCaptureData(0, 27, 2); switch(tempval) { case "01": { cborrower.Declaration.PriorPropertyTitleType = (short) MISMO.Enums.PriorPropertyTitleType.Sole; break; } case "25": { cborrower.Declaration.PriorPropertyTitleType = (short) MISMO.Enums.PriorPropertyTitleType.JointWithSpouse; break; } case "26": { cborrower.Declaration.PriorPropertyTitleType = (short) MISMO.Enums.PriorPropertyTitleType.JointWithOtherThanSpouse; break; } } tempval = du.ExtractCaptureData(0, 26, 1); switch(tempval) { case "1": { cborrower.Declaration.PriorPropertyUsageType = (short) MISMO.Enums.PriorPropertyUsageType.PrimaryResidence; break; } case "2": { cborrower.Declaration.PriorPropertyUsageType = (short) MISMO.Enums.PriorPropertyUsageType.SecondaryResidence; break; } case "D": { cborrower.Declaration.PriorPropertyUsageType = (short) MISMO.Enums.PriorPropertyUsageType.Investment; break; } } tempval = du.ExtractCaptureData(0, 15, 1); if (tempval != string.Empty) cborrower.Declaration.PropertyForeclosedPastSevenYearsIndicator = (tempval == "Y"); du.EndCapture(); #region BORROWER.DECLARATION._EXPLANATION int explanationcount = du.BeginCapture("08B", 4, 9, cborrower.SSN); if (explanationcount > 0) { MISMO.BusinessObjects.Explanation expl = null; for(int l = 0; l<explanationcount; l++) { expl = new MISMO.BusinessObjects.Explanation(); tempval = du.ExtractCaptureData(l, 15, 255); if (tempval != string.Empty) { expl.Description = tempval; } tempval = du.ExtractCaptureData(l, 13, 2); switch(tempval) { case "91": { expl.Type = (short) MISMO.Enums.ExplanationType.OutstandingJudgments; break; } case "92": { expl.Type = (short) MISMO.Enums.ExplanationType.DeclaredBankruptcyPastSevenYears; break; } case "93": { expl.Type = (short) MISMO.Enums.ExplanationType.DirectIndirectForeclosedPropertyPastSevenYears; break; } case "94": { expl.Type = (short) MISMO.Enums.ExplanationType.PartyToLawsuit; break; } case "95": { expl.Type = (short) MISMO.Enums.ExplanationType.ObligatedOnLoanForeclosedOrDeedInLieuOfJudgement; break; } case "96": { expl.Type = (short) MISMO.Enums.ExplanationType.DelinquencyOrDefault; break; } case "97": { expl.Type = (short) MISMO.Enums.ExplanationType.AlimonyChildSupport; break; } case "98": { expl.Type = (short) MISMO.Enums.ExplanationType.BorrowedDownPayment; break; } case "99": { expl.Type = (short) MISMO.Enums.ExplanationType.CoMakerEndorserOnNote; break; } } cborrower.Declaration.Explanations.Add(expl); } } #endregion BORROWER.DECLARATION._EXPLANATION } #endregion BORROWER.DECLARATION #region ASSETS AUS.Asset assobj = null; // load standard assets int asscount = du.BeginCapture("06C", 4, 9, cborrower.SSN); if (asscount > 0) { for(int n = 0; n<asscount; n++) { assobj = new AUS.Asset(); // first extract or try to determine the asset type tempval = du.ExtractCaptureData(n, 13, 3); switch(tempval) { case "03": { assobj.Type = (short) MISMO.Enums.AssetType.CheckingAccount; break; } case "F1": { assobj.Type = (short) MISMO.Enums.AssetType.SaleOtherAssets; break; } case "SG": { assobj.Type = (short) MISMO.Enums.AssetType.SavingsAccount; break; } case "F2": { assobj.Type = (short) MISMO.Enums.AssetType.GiftsTotal; break; } case "01": { assobj.Type = (short) MISMO.Enums.AssetType.CertificateOfDepositTimeDeposit; break; } case "F3": { assobj.Type = (short) MISMO.Enums.AssetType.MoneyMarketFund; break; } case "F4": { assobj.Type = (short) MISMO.Enums.AssetType.MutualFund; break; } case "05": { assobj.Type = (short) MISMO.Enums.AssetType.Stock; break; } case "06": { assobj.Type = (short) MISMO.Enums.AssetType.Bond; break; } case "F5": { assobj.Type = (short) MISMO.Enums.AssetType.SecuredBorrowedFundsNotDeposited; break; } case "F7": { assobj.Type = (short) MISMO.Enums.AssetType.BridgeLoanNotDeposited; break; } case "08": { assobj.Type = (short) MISMO.Enums.AssetType.RetirementFund; break; } case "F8": { assobj.Type = (short) MISMO.Enums.AssetType.NetWorthOfBusinessOwned; break; } case "11": { assobj.Type = (short) MISMO.Enums.AssetType.TrustAccount; break; } case "M1": { assobj.Type = (short) MISMO.Enums.AssetType.OtherNonLiquidAssets; break; } case "OL": { assobj.Type = (short) MISMO.Enums.AssetType.OtherLiquidAssets; break; } case "NE": { assobj.Type = (short) MISMO.Enums.AssetType.PendingNetSaleProceedsFromRealEstateAssets; break; } case "COH": { assobj.Type = (short) MISMO.Enums.AssetType.CashOnHand; break; } case "GE": { assobj.Type = (short) MISMO.Enums.AssetType.GiftsNotDeposited; break; } } tempval = du.ExtractCaptureData(n, 132, 30); if (tempval != string.Empty) { assobj.AccountIdentifier = tempval; } tempval = du.ExtractCaptureData(n, 162, 15); if (tempval != string.Empty) { assobj.CashOrMarketValueAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractCaptureData(n, 16, 35); if (tempval != string.Empty) { assobj.HolderName = tempval; } tempval = du.ExtractCaptureData(n, 51, 35); if (tempval != string.Empty) { assobj.HolderStreetAddress = tempval; } tempval = du.ExtractCaptureData(n, 86, 35); if (tempval != string.Empty) { assobj.HolderCity = tempval; } tempval = du.ExtractCaptureData(n, 121, 2); if (tempval != string.Empty) { assobj.HolderState = tempval; } tempval = du.ExtractCaptureData(n, 123, 5); if (tempval != string.Empty) { assobj.HolderPostalCode = tempval; } tempval = du.ExtractCaptureData(n, 128, 4); if (tempval != string.Empty) { assobj.HolderPostalCode += "-" + tempval; } tempval = du.ExtractCaptureData(n, 184, 80); if (tempval != string.Empty) { assobj.OtherAssetTypeDescription = tempval; } tempval = du.ExtractCaptureData(n, 177, 7); if (tempval != string.Empty) { assobj.StockBondMutualFundShareCount = Convert.ToDecimal(tempval); } // add the asset to the borrower cborrower.Assets.Add(assobj); } } // load life insurance assets asscount = du.BeginCapture("06B", 4, 9, cborrower.SSN); if (asscount > 0) { for(int n = 0; n<asscount; n++) { assobj = new AUS.Asset(); assobj.Type = (short) MISMO.Enums.AssetType.LifeInsurance; tempval = du.ExtractCaptureData(n, 13, 30); if (tempval != string.Empty) { assobj.AccountIdentifier = tempval; } tempval = du.ExtractCaptureData(n, 43, 15); if (tempval != string.Empty) { assobj.CashOrMarketValueAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractCaptureData(n, 58, 15); if (tempval != string.Empty) { assobj.LifeInsuranceFaceValueAmount = Convert.ToDecimal(tempval); } } } // load cash deposits assets asscount = du.BeginCapture("06A", 4, 9, cborrower.SSN); if (asscount > 0) { for(int n = 0; n<asscount; n++) { assobj = new AUS.Asset(); assobj.Type = (short) MISMO.Enums.AssetType.EarnestMoneyCashDepositTowardPurchase; tempval = du.ExtractCaptureData(n, 48, 15); if (tempval != string.Empty) { assobj.CashOrMarketValueAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractCaptureData(n, 13, 35); if (tempval != string.Empty) { assobj.HolderName = tempval; } } } // load automobile assets asscount = du.BeginCapture("06D", 4, 9, cborrower.SSN); if (asscount > 0) { for(int n = 0; n<asscount; n++) { assobj = new AUS.Asset(); assobj.Type = (short) MISMO.Enums.AssetType.Automobile; tempval = du.ExtractCaptureData(n, 47, 15); if (tempval != string.Empty) { assobj.CashOrMarketValueAmount = Convert.ToDecimal(tempval); } tempval = du.ExtractCaptureData(n, 13, 30); if (tempval != string.Empty) { assobj.AutomobileMakeDescription = tempval; } tempval = du.ExtractCaptureData(n, 43, 4); if (tempval != string.Empty) { assobj.AutomobileModelYear = du.ToDate(tempval); } } } #endregion ASSETS } #endregion BORROWER (nested elements) }