private void BAceptar_Click(object sender, EventArgs e) { razon = BM.Text; mail = Textmail.Text; cuit = TextCuit.Text; Empresa empresa = new Empresa(); Decimal userid = RepositorioEmpresa.Instance.BuscarEmpresa(razon, mail, cuit); if (userid == -1) { // new MostrarEmpBajas(razon, mail, cuit).ShowDialog(this); new Muchos().ShowDialog(this); } else if (userid == -2) { new NoExisteUsuario().ShowDialog(this); } else { new BajaEmp(userid).ShowDialog(this); this.Close(); } }
private void Aceptar_Click(object sender, EventArgs e) { Decimal cerrar = 0; if(calle.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if(nombre.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (telefono.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (contacto.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (cuit.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (cod_pos.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (piso.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (altura.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (localidad.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (ciudad.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (mail.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (departamento.Text == "" && cerrar == 0) { cerrar = 1; new TodosLosCampos().ShowDialog(this); } if (cerrar == 0) { cerrar = this.buscarTel(telefono.Text); } if (cerrar == 0) { cerrar = this.buscarCuit(cuit.Text); } if (cerrar == 0) { call = calle.Text; razon_social = nombre.Text; telef = int.Parse(telefono.Text); contact = contacto.Text; nro_cuit = cuit.Text.ToString(); codpos = int.Parse(cod_pos.Text); pis = int.Parse(piso.Text); altu = int.Parse(altura.Text); loc = localidad.Text; ciud = ciudad.Text; meil = mail.Text; puert = departamento.Text; f_creacion = dateTimePicker1.Value; Empresa empresa = new Empresa(nro_cuit, razon_social, contact, f_creacion, meil, telef, ciud, loc, call, altu, pis, codpos, puert); RepositorioEmpresa.Instance.InsertarEmpresa(empresa); new UsuarioYPassEmpresa().ShowDialog(this); this.Close(); } }
public void InsertarEmpresa(Empresa empresa) { var query = String.Format(@"INSERT INTO NINIRODIE.EMPRESA " + "(EMP_RAZON_SOCIAL, EMP_CUIT, EMP_CONTACTO, " + "EMP_TELEFONO, EMP_MAIL, EMP_FECHA_CREACION, EMP_CIUDAD, " + "EMP_LOCALIDAD, EMP_CALLE, EMP_ALTURA, EMP_PISO, " + "EMP_DEPARTAMENTO, EMP_CODIGO_POSTAL)" + "VALUES ('{0}', '{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}', " + "'{9}','{10}','{11}','{12}')", empresa.razon_social, empresa.cuit, empresa.contacto, empresa.telefono, empresa.mail, DBTypeConverter.ToSQLDateTime(empresa.fecha_creacion), empresa.ciud, empresa.loc, empresa.call, empresa.altu, empresa.pis, empresa.puert,empresa.codpos); SQLUtils.EjecutarConsultaConEfectoDeLado(query); }
public void ModificarEmpresa(Empresa empresa) { var query = String.Format(@"UPDATE NINIRODIE.EMPRESA SET " + " EMP_CONTACTO = '{0}', EMP_RAZON_SOCIAL = '{1}', EMP_CUIT = '{2}', " + "EMP_TELEFONO = '{3}', EMP_MAIL = '{4}', " + "EMP_FECHA_CREACION = '{5}', EMP_CIUDAD = '{6}', EMP_LOCALIDAD = '{7}', " + "EMP_CALLE = '{8}', EMP_ALTURA = '{9}', EMP_PISO = '{10}', " + "EMP_DEPARTAMENTO = '{11}', EMP_CODIGO_POSTAL = '{12}' " + "WHERE EMP_USUARIO_ID = '{13}'", empresa.contacto, empresa.razon_social, empresa.cuit, empresa.telefono, empresa.mail, DBTypeConverter.ToSQLDateTime(empresa.fecha_creacion), empresa.ciud, empresa.loc, empresa.call, empresa.altu, empresa.pis, empresa.puert, empresa.codpos, empresa.usuario_id); SQLUtils.EjecutarConsultaConEfectoDeLado(query); }
public Empresa DataRowToEmpresa(DataRow row) { var codigo = Decimal.Parse(row["EMP_CODIGO"].ToString()); var razon = row["EMP_RAZON_SOCIAL"].ToString(); String contacto = ""; if (!row["EMP_CONTACTO"].Equals(DBNull.Value)) contacto = row["EMP_CONTACTO"].ToString(); var cuit = (row["EMP_CUIT"].ToString()); int telef = 0; if (!row["EMP_TELEFONO"].Equals(DBNull.Value)) telef = int.Parse(row["EMP_TELEFONO"].ToString()); var meil = row["EMP_MAIL"].ToString(); DateTime f_crea = new DateTime(); if (!row["EMP_FECHA_CREACION"].Equals(DBNull.Value)) f_crea = DateTime.Parse(row["EMP_FECHA_CREACION"].ToString()); String ciudad = ""; if(!row["EMP_CIUDAD"].Equals(DBNull.Value)) ciudad = row["EMP_CIUDAD"].ToString(); String loc = ""; if(!row["EMP_LOCALIDAD"].Equals(DBNull.Value)) loc = row["EMP_LOCALIDAD"].ToString(); var call = row["EMP_CALLE"].ToString(); var altu = int.Parse(row["EMP_ALTURA"].ToString()); var pis = int.Parse(row["EMP_PISO"].ToString()); var codpos = int.Parse(row["EMP_CODIGO_POSTAL"].ToString()); var puert = row["EMP_DEPARTAMENTO"].ToString(); var empresa = new Empresa(codigo, cuit, razon, contacto, f_crea, meil, telef, ciudad, loc, call, altu, pis, codpos, puert); return empresa; }