public void AddPPEUniform() { PTSProject.clsUniform cUniform = Container.Resolve <clsUniform>(); DbCommand oCmd = UpgradeHelpers.DB.AdoFactoryManager.GetFactory().CreateCommand(); ADORecordSetHelper oRec = null; string strSQL = ""; try { if (ViewModel.CurrRow == 0) { return; } ViewModel.sprPPEList.Row = ViewModel.CurrRow; oCmd.Connection = modGlobal.oConn; oCmd.CommandType = CommandType.Text; cUniform.UniformType = ViewModel.CurrRow; cUniform.UniformRetiredDate = ""; ViewModel.sprPPEList.Col = 4; cUniform.UniformTrackingNumber = modGlobal.Clean(ViewModel.sprPPEList.Text); cUniform.UniformColorType = 0; cUniform.UniformSizeType = 0; ViewModel.sprPPEList.Col = 3; //Size or Color if (modGlobal.Clean(ViewModel.sprPPEList.Text) != "") { if (ViewModel.CurrRow != 3) { //Size... Only Helmets have color strSQL = "Select size_type From UniformSizeCode Where description = '" + modGlobal.Clean(ViewModel.sprPPEList.Text) + "'"; oCmd.CommandText = strSQL; oRec = ADORecordSetHelper.Open(oCmd, ""); if (!oRec.EOF) { //UPGRADE_WARNING: (1068) GetVal() of type Variant is being forced to int. More Information: http://www.vbtonet.com/ewis/ewi1068.aspx cUniform.UniformSizeType = Convert.ToInt32(modGlobal.GetVal(oRec["size_type"])); } } else { //Color strSQL = "Select color_type From UniformColorCode Where description = '" + modGlobal.Clean(ViewModel.sprPPEList.Text) + "'"; oCmd.CommandText = strSQL; oRec = ADORecordSetHelper.Open(oCmd, ""); if (!oRec.EOF) { //UPGRADE_WARNING: (1068) GetVal() of type Variant is being forced to int. More Information: http://www.vbtonet.com/ewis/ewi1068.aspx cUniform.UniformColorType = Convert.ToInt32(modGlobal.GetVal(oRec["color_type"])); } } } cUniform.UniformManufacturerID = 0; ViewModel.sprPPEList.Col = 2; //Manufacturer if (modGlobal.Clean(ViewModel.sprPPEList.Text) != "") { strSQL = "Select manufacturer_id From UniformManufacturer Where manufacturer_name = '" + modGlobal.Clean(ViewModel.sprPPEList.Text) + "'"; oCmd.CommandText = strSQL; oRec = ADORecordSetHelper.Open(oCmd, ""); if (!oRec.EOF) { //UPGRADE_WARNING: (1068) GetVal() of type Variant is being forced to int. More Information: http://www.vbtonet.com/ewis/ewi1068.aspx cUniform.UniformManufacturerID = Convert.ToInt32(modGlobal.GetVal(oRec["manufacturer_id"])); } } ViewModel.sprPPEList.Col = 5; if (modGlobal.Clean(ViewModel.sprPPEList.Text) == "") { cUniform.UniformManufacturedDate = ""; } else if (((int)DateAndTime.DateDiff("d", DateTime.Now, DateTime.Parse(ViewModel.sprPPEList.Text), FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1)) > 0) { ViewManager.ShowMessage("Manufactured Date can not be in the future.", "Manufactured Date Error", UpgradeHelpers.Helpers.BoxButtons.OK); return; } else { cUniform.UniformManufacturedDate = DateTime.Parse(ViewModel.sprPPEList.Text).ToString("MM/dd/yyyy"); } if (cUniform.InsertUniform() != 0) { cUniform.PersUniformID = cUniform.UniformID; cUniform.PersUniformEmpID = ViewModel.EmployeeID; ViewModel.sprPPEList.Col = 1; if (modGlobal.Clean(ViewModel.sprPPEList.Text) != "") { if (((int)DateAndTime.DateDiff("d", DateTime.Now, DateTime.Parse(DateTime.Parse(ViewModel.sprPPEList.Text).ToString("M/d/yyyy")), FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1)) > 0) { ViewManager.ShowMessage("Issued Date can not be in the future.", "Issued Date Error", UpgradeHelpers.Helpers.BoxButtons.OK); return; } else { cUniform.PersUniformIssuedDate = DateTime.Parse(ViewModel.sprPPEList.Text).ToString("M/d/yyyy"); } } else { cUniform.PersUniformIssuedDate = DateTime.Now.ToString("M/d/yyyy"); } if (cUniform.InsertPersonnelUniform() != 0) { //continue } else { ViewModel.sprPPEList.Col = 0; ViewManager.ShowMessage("Ooops! The " + modGlobal.Clean(ViewModel. sprPPEList.Text) + " PersonnelUniform Record was not added. " + "Please call Debra Lewandowsky x5068. Thanks.", "Insert PersonnelUniform Error", UpgradeHelpers.Helpers.BoxButtons.OK); } } else { ViewModel.sprPPEList.Col = 0; ViewManager.ShowMessage("Ooops! The " + modGlobal.Clean(ViewModel. sprPPEList.Text) + " Uniform Record was not added. " + "Please call Debra Lewandowsky x5068. Thanks.", "Insert Uniform Error", UpgradeHelpers.Helpers.BoxButtons.OK); } } catch { if (modGlobal.ErrorControl() == modGlobal.eFATALERROR) { return; } } }