private void CargarComboPresupuesto() { if (strNumeroRuc != "") { DataSet DSDevuelve = new DataSet(); DataTable DTTipo = new DataTable(); WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; DSDevuelve = WSPres.DevuelvePresupuestosProyectoCliente(mdlGenerales.Conexion, RucClienteNew[Convert.ToInt32(cmbCliente.SelectedIndex.ToString())].ToString(), IDProyectoNew[Convert.ToInt32(cmbProyecto.SelectedIndex.ToString())].ToString(), strNumeroRuc, strIDProyecto, strIDTipoPresupuesto); DTTipo = DSDevuelve.Tables[0]; Int32 I = 0; IDTipoPresupuesto.Clear(); cmbTipoPresupuesto.Items.Clear(); cmbTipoPresupuesto.ResetText(); foreach (DataRow Row in DTTipo.Rows) { IDTipoPresupuesto.Insert(I, Row[0].ToString()); cmbTipoPresupuesto.Items.Add(Row[1].ToString()); I = I + 1; } if (cmbTipoPresupuesto.Items.Count > 0) { cmbTipoPresupuesto.SelectedIndex = 0; } I = 0; } }
private void cmdModificarPresupuesto_Click(object sender, EventArgs e) { ArrayList idtipopresupuesto = new ArrayList(); ArrayList idProyecto = new ArrayList(); ArrayList NumeroRuc = new ArrayList(); ArrayList ItemNivel1 = new ArrayList(); ArrayList ItemNivel2 = new ArrayList(); ArrayList ItemNivel3 = new ArrayList(); ArrayList ItemNivel4 = new ArrayList(); ArrayList ItemNivel5 = new ArrayList(); ArrayList Nivel = new ArrayList(); ArrayList Tipo = new ArrayList(); ArrayList Descripcion = new ArrayList(); ArrayList Metrado = new ArrayList(); ArrayList Unidad = new ArrayList(); ArrayList Precio = new ArrayList(); WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; for (Int32 Index = 0; Index <= GGCDetalle.Table.Records.Count - 1; Index++) { if (Convert.ToInt16(GGCDetalle.Table.Records[Index].GetValue("Sel").ToString()) == 1) { idtipopresupuesto.Add(strIDTipoPresupuesto); idProyecto.Add(strIDProyecto); NumeroRuc.Add(strNumeroRuc); ItemNivel1.Add(GGCDetalle.Table.Records[Index].GetValue("itemnivel1").ToString()); ItemNivel2.Add(GGCDetalle.Table.Records[Index].GetValue("itemnivel2").ToString()); ItemNivel3.Add(GGCDetalle.Table.Records[Index].GetValue("itemnivel3").ToString()); ItemNivel4.Add(GGCDetalle.Table.Records[Index].GetValue("itemnivel4").ToString()); ItemNivel5.Add(GGCDetalle.Table.Records[Index].GetValue("itemnivel5").ToString()); Nivel.Add(GGCDetalle.Table.Records[Index].GetValue("Nivel").ToString()); Descripcion.Add(GGCDetalle.Table.Records[Index].GetValue("Descripcion").ToString()); Metrado.Add(GGCDetalle.Table.Records[Index].GetValue("Metrado").ToString()); Unidad.Add(GGCDetalle.Table.Records[Index].GetValue("Unidad").ToString()); Precio.Add(GGCDetalle.Table.Records[Index].GetValue("Precio").ToString()); } } WSPres.UpdateItemPresupuesto(mdlGenerales.Conexion, idtipopresupuesto.ToArray(), idProyecto.ToArray(), NumeroRuc.ToArray(), ItemNivel1.ToArray(), ItemNivel2.ToArray(), ItemNivel3.ToArray(), ItemNivel4.ToArray(), ItemNivel5.ToArray(), Nivel.ToArray(), Descripcion.ToArray(), Metrado.ToArray(), Unidad.ToArray(), Precio.ToArray()); MessageBoxAdv.Show("Presupuesto actualizado", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); CargaGridPresupuesto(strIDTipoPresupuesto, strIDProyecto, strNumeroRuc); }
private void miEliminar_Click(object sender, EventArgs e) { WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; string ItemNivel1 = ""; string ItemNivel2 = ""; string ItemNivel3 = ""; string ItemNivel4 = ""; string ItemNivel5 = ""; string Nivel = ""; Element el = GGCDetalle.TableControl.Table.CurrentElement; if (el != null) { if (el is GridRecord) { DataRowView drv = (el as Record).GetData() as DataRowView; ItemNivel1 = drv[1].ToString(); //show column 2 ItemNivel2 = drv[2].ToString(); //show column 2 ItemNivel3 = drv[3].ToString(); //show column 2 ItemNivel4 = drv[4].ToString(); //show column 2 ItemNivel5 = drv[5].ToString(); //show column 2 Nivel = drv[8].ToString(); //show column 2 } } if (Nivel == "0") { MessageBoxAdv.Show("Este nivel no se puede eliminar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MessageBoxAdv.Show("Se eliminaran el nodo y los hijos. Esta seguro?", "Esta Seguro?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { WSPres.DelItemPresupuesto(mdlGenerales.Conexion, strIDTipoPresupuesto, strIDProyecto, strNumeroRuc, ItemNivel1, ItemNivel2, ItemNivel3, ItemNivel4, ItemNivel5, Nivel); MessageBoxAdv.Show("Registro(s) eliminado(s)", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); CargaGridPresupuesto(strIDTipoPresupuesto, strIDProyecto, strNumeroRuc); return; } else { MessageBoxAdv.Show("Eliminación cancelada", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
private void CargaAutocomplete() { DataSet DSDevuelveCargo = new DataSet(); DataTable DTMainCargo = new DataTable(); Int32 I = 0; WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; DSDevuelveCargo = WSPres.DevuelveAutoCompletaPresupuesto(mdlGenerales.Conexion); DTMainCargo = DSDevuelveCargo.Tables[0]; AuDetalle.Clear(); foreach (DataRow Row in DTMainCargo.Rows) { AuDetalle.Insert(I, Row[0].ToString()); I = I + 1; } acDescripcion.DataSource = AuDetalle; }
public void CargaGrid() { DataSet DSDevuelve = new DataSet(); DataTable DTMain = new DataTable(); DataView DVMain = new DataView(); WSPresupuestos.WSPresupuestos WSPresup = new WSPresupuestos.WSPresupuestos(); WSPresup.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; DSDevuelve = WSPresup.DevuelvePrecargaS10(mdlGenerales.Conexion); DTMain = DSDevuelve.Tables[0]; DVMain = DTMain.DefaultView; GGCPersLiq.DataSource = null; GGCPersLiq.TableDescriptor.Reset(); GGCPersLiq.TableDescriptor.AllowNew = false; GGCPersLiq.Refresh(); GGCPersLiq.DataSource = DVMain; FormatColumnas(); AplicarFilterBar(); }
public void CargaGridPresupuesto(string IDTipoPresupuesto, string IDProyecto, string NumeroRuc) { DataSet DSDevuelvePresupuesto = new DataSet(); DataTable DTMainPresupuesto = new DataTable(); DataView DVMainPresupuesto = new DataView(); WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; GGCDetalle.DataSource = null; GGCDetalle.TableDescriptor.Reset(); GGCDetalle.Refresh(); DSDevuelvePresupuesto = WSPres.DevuelveDetallePresupuesto(mdlGenerales.Conexion, IDTipoPresupuesto, IDProyecto); DTMainPresupuesto = DSDevuelvePresupuesto.Tables[0]; DVMainPresupuesto = DTMainPresupuesto.DefaultView; GGCDetalle.TableDescriptor.AllowNew = false; GGCDetalle.DataSource = DVMainPresupuesto; FormatColumnasPresupuesto(); AplicarFilterBarPresupuesto(); }
private void cmdCopiar_Click(object sender, EventArgs e) { WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; if (MessageBoxAdv.Show("Esta seguro que desea sobreescribir este presupuesto, todos los datos previos se perderan", "información", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { WSPres.CopiaPresupuesto(mdlGenerales.Conexion, strIDTipoPresupuesto, strIDProyecto, strNumeroRuc, IDTipoPresupuesto[Convert.ToInt32(cmbTipoPresupuesto.SelectedIndex.ToString())].ToString(), IDProyectoNew[Convert.ToInt32(cmbProyecto.SelectedIndex.ToString())].ToString(), RucClienteNew[Convert.ToInt32(cmbCliente.SelectedIndex.ToString())].ToString()); MessageBoxAdv.Show("Registro(s) eliminado(s)", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); CargaGridPresupuesto(strIDTipoPresupuesto, strIDProyecto, strNumeroRuc); return; } else { MessageBoxAdv.Show("Copia cancelada", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
private void cmdModificar_Click(object sender, EventArgs e) { DataSet DSDevuelveID = new DataSet(); DataTable DTDevuelveID = new DataTable(); WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; if (txtDescripcion.Text == "") { MessageBoxAdv.Show("Debe de registrar la descripción del presupuesto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDescripcion.Focus(); return; } DSDevuelveID = WSPres.ActualizaPresupuesto(mdlGenerales.Conexion, IDTipoPresupuesto[Convert.ToInt32(cmbTipoPresupuesto.SelectedIndex.ToString())].ToString(), txtDescripcion.Text.ToString(), strIDProyecto, mdlGenerales.STRUsuario); DTDevuelveID = DSDevuelveID.Tables[0]; String strResultado = ""; Int32 intResultado = 0; foreach (DataRow Row in DTDevuelveID.Rows) { intResultado = Convert.ToInt32(Row[0].ToString()); strResultado = Row[1].ToString(); } if (intResultado != 0) { MessageBoxAdv.Show(strResultado, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); CargaGrid(strIDProyecto); } CargaGrid(strIDProyecto); }
private void cmdCargaPresupuesto_Click(object sender, EventArgs e) { Scripting.FileSystemObject FSO; Scripting.TextStream TS; ArrayList SItem = new ArrayList(); ArrayList SDescripcion = new ArrayList(); ArrayList SUnidad = new ArrayList(); ArrayList SMetrado = new ArrayList(); ArrayList SPrecio = new ArrayList(); ArrayList STotal = new ArrayList(); WSPresupuestos.WSPresupuestos wsCarga = new WSPresupuestos.WSPresupuestos(); wsCarga.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; //clsCarga.LimpiaCargaAvSpeedy(mdlGenerales.strCon); if (lblCarga.Text != "Seleccionar Archivo") { FSO = new Scripting.FileSystemObject(); TS = FSO.OpenTextFile(lblCarga.Text, Scripting.IOMode.ForReading, false, 0); while (!TS.AtEndOfStream) { string Linea = ""; Linea = TS.ReadLine(); string[] sfont = Linea.Split('\t'); if (Linea != "") { if (IsNumeric(sfont[0].Replace(".", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()) == true) { try { SItem.Add(sfont[0].Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()); } catch { SItem.Add(""); } try { SDescripcion.Add(sfont[1].Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()); } catch { SDescripcion.Add(""); } try { SUnidad.Add(sfont[2].Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()); } catch { SUnidad.Add("0"); } try { if (IsNumeric(sfont[3].Replace(",", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()) == true) { SMetrado.Add(sfont[3].Replace(",", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()); } else { SMetrado.Add("0"); } } catch { SMetrado.Add("0"); } try { if (IsNumeric(sfont[5].Replace(",", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()) == true) { SPrecio.Add(sfont[5].Replace(",", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()); } else { SPrecio.Add("0"); } } catch { SPrecio.Add("0"); } try { if (IsNumeric(sfont[7].Replace(",", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()) == true) { STotal.Add(sfont[7].Replace(",", "").Replace("\"", "").Replace(@"""", "").Replace("'", "").Trim().ToString()); } else { STotal.Add("0"); } } catch { STotal.Add("0"); } } } } wsCarga.LImpiaPrecargaS10(mdlGenerales.Conexion); wsCarga.PreCargaS10(mdlGenerales.Conexion, SItem.ToArray(), SDescripcion.ToArray(), SUnidad.ToArray(), SMetrado.ToArray(), SPrecio.ToArray(), STotal.ToArray()); MessageBox.Show("Carga Realizada con exito", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); CargaGrid(); } }
private void cmdAdd_Click(object sender, EventArgs e) { GPItem.Visible = true; WSPresupuestos.WSPresupuestos WSPres = new WSPresupuestos.WSPresupuestos(); WSPres.Url = mdlGenerales.DireccionWS + "FazServices/WSPresupuestos.asmx"; Int32 Tipo = 0; if (rbHijo.Checked == true) { Tipo = 0; } else { Tipo = 1; } if (TxtDesc.Text.ToString() == "") { MessageBoxAdv.Show("Debe de registrar la descripción de la tarea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtDesc.Focus(); return; } if ((txtMetrado.Text.ToString() == "") && (txtPrecio.Text.ToString() == "") && (txtUnidad.Text.ToString() == "")) { WSPres.AddItemPresupuesto(mdlGenerales.Conexion, strIDTipoPresupuesto, strIDProyecto, strNumeroRuc, lblItemNIvel1.Text.ToString(), lblItemNivel2.Text.ToString(), lblItemNivel3.Text.ToString(), lblItemNivel4.Text.ToString(), lblItemNivel5.Text.ToString(), lblNivel.Text.ToString(), Tipo.ToString(), TxtDesc.Text.ToString(), txtMetrado.Text.ToString(), txtUnidad.Text.ToString(), txtPrecio.Text.ToString()); MessageBoxAdv.Show("Tarea Registrada", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); if (chkContinuar.CheckState != CheckState.Checked) { LimpiarPanel(); GPItem.Visible = false; CargaGridPresupuesto(strIDTipoPresupuesto, strIDProyecto, strNumeroRuc); } else { TxtDesc.Text = ""; txtMetrado.Text = ""; txtUnidad.Text = ""; txtPrecio.Text = ""; } } else { if ((txtMetrado.Text.ToString() != "") && (txtPrecio.Text.ToString() != "") && (txtUnidad.Text.ToString() != "")) { if (MayorACero(txtMetrado.Text.ToString()) == false) { MessageBoxAdv.Show("El metrado debe de ser un valor númerico mayor a 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMetrado.Focus(); return; } if (MayorACero(txtPrecio.Text.ToString()) == false) { MessageBoxAdv.Show("El metrado debe de ser un valor númerico mayor a 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPrecio.Focus(); return; } WSPres.AddItemPresupuesto(mdlGenerales.Conexion, strIDTipoPresupuesto, strIDProyecto, strNumeroRuc, lblItemNIvel1.Text.ToString(), lblItemNivel2.Text.ToString(), lblItemNivel3.Text.ToString(), lblItemNivel4.Text.ToString(), lblItemNivel5.Text.ToString(), lblNivel.Text.ToString(), Tipo.ToString(), TxtDesc.Text.ToString(), txtMetrado.Text.ToString(), txtUnidad.Text.ToString(), txtPrecio.Text.ToString()); MessageBoxAdv.Show("Tarea Registrada", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); if (chkContinuar.CheckState != CheckState.Checked) { LimpiarPanel(); GPItem.Visible = false; CargaGridPresupuesto(strIDTipoPresupuesto, strIDProyecto, strNumeroRuc); } else { TxtDesc.Text = ""; txtMetrado.Text = ""; txtUnidad.Text = ""; txtPrecio.Text = ""; } } else { if (txtMetrado.Text.ToString() == "") { MessageBoxAdv.Show("Debe de registrar el metrado de la tarea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMetrado.Focus(); return; } if (txtPrecio.Text.ToString() == "") { MessageBoxAdv.Show("Debe de registrar el precio de la tarea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPrecio.Focus(); return; } if (txtUnidad.Text.ToString() == "") { MessageBoxAdv.Show("Debe de registrar las unidades de la tarea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUnidad.Focus(); return; } } } }