private void InsertFactory() { if (cboFactoryDivision.SelectedIndex != 0) { FactoryVO item = new FactoryVO { Factory_Name = txtFactoryName.Text, Factory_Division = Convert.ToInt32(cboFactoryDivision.SelectedValue), Factory_Number = maskedFactoryNumber.Text, Factory_Fax = maskedFactoryFaxNumber.Text, Factory_Address = addrFactory.Address1 + " " + addrFactory.Address2, Factory_AddrNumber = addrFactory.Zipcode }; if (item.Factory_Fax.Replace("-", "").Trim().Length < 10) { item.Factory_Fax = null; } try { StandardService service = new StandardService(); service.InsertFactory(item); } catch (Exception err) { Log.WriteError(err.Message, err); } } }