private void dgTmpOVCli_Click(object sender, EventArgs e) { if (this.DS.Tables[Variables.gTermi + "TmpOVCli"].Rows.Count != 0) { Variables.gNroOV = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 0]); Variables.gSalir = false; new frmFcProfExp3().ShowDialog(); if (!Variables.gSalir) { this.GroupBox1.Visible = true; this.txtNroOV.Text = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 0]); this.mAlmacen = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 1]); this.txtNomAlmacen.Text = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 2]); this.txtMoneda.Text = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 3]); this.mCondPago = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 4]); this.mCondEnt = StringType.FromObject(this.dgTmpOVCli[this.dgTmpOVCli.CurrentCell.RowNumber, 5]); this.editFlete.Text = ""; this.editFlete.Focus(); } else { this.GroupBox1.Visible = false; this.txtNroOV.Text = ""; this.mAlmacen = ""; this.txtNomAlmacen.Text = ""; this.txtMoneda.Text = ""; this.mCondPago = ""; this.mCondEnt = ""; this.editFlete.Text = ""; } } }
public cClienteDeduccion(int _Configuracion, int Cliente, int Secuencia, int DeduccionPrestacion, Decimal Monto, DateTime FDeduccion, string Usuario) { try { this.cnSigamet = new SqlConnection(Globals.GetInstance._CadenaConexion); SqlCommand sqlCommand = new SqlCommand("spPTLClienteDeduccion", this.cnSigamet); sqlCommand.Parameters.Add("@Configuracion", SqlDbType.SmallInt).Value = (object)_Configuracion; sqlCommand.Parameters.Add("@Cliente", SqlDbType.Int).Value = (object)Cliente; sqlCommand.Parameters.Add("@Secuencia", SqlDbType.Int).Value = (object)Secuencia; sqlCommand.Parameters.Add("@DeduccionPrestacion", SqlDbType.Int).Value = (object)DeduccionPrestacion; sqlCommand.Parameters.Add("@Monto", SqlDbType.Money).Value = (object)Monto; sqlCommand.Parameters.Add("@FDeduccion", SqlDbType.DateTime).Value = (object)FDeduccion; sqlCommand.Parameters.Add("@Usuario", SqlDbType.VarChar).Value = (object)Usuario; sqlCommand.CommandType = CommandType.StoredProcedure; this.cnSigamet.Open(); this.drReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection); while (this.drReader.Read()) { this._Cliente = IntegerType.FromObject(this.drReader[0]); this._Secuencia = IntegerType.FromObject(this.drReader[1]); this._Status = StringType.FromObject(this.drReader[2]); } this.cnSigamet.Close(); } catch (Exception ex) { ProjectData.SetProjectError(ex); Exception exception = ex; EventLog.WriteEntry("Consulta cliente factor" + exception.Source, exception.Message, EventLogEntryType.Error); int num = (int)MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); ProjectData.ClearProjectError(); } }
private void BuscarClientePortatil(int ClientePortatil) { this.Cursor = Cursors.WaitCursor; if (this._CargarCliente) { Catalogo.cCliente cCliente = new Catalogo.cCliente(6, ClientePortatil); if (((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader).Read()) { int num1 = this.ExisteClientePortatil(); if (num1 == 0) { this.lblNombrePortatil.Text = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[1]); } else { this.lblNombrePortatil.Text = ""; ((TextBox)this.txtClientePortatil).Text = ""; int num2 = (int)MessageBox.Show("El cliente portátil ya esta relacionado con el cliente estacionario: " + StringType.FromInteger(num1), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } else { this.lblNombrePortatil.Text = ""; ((TextBox)this.txtClientePortatil).Text = ""; } this._CargarCliente = false; } this.Cursor = Cursors.Default; }
private void DataGrid_MouseUp(object sender, MouseEventArgs e) { DataGrid.HitTestInfo info = this.DataGridTableStyle.DataGrid.HitTest(e.X, e.Y); if (!this.m_depressedBounds.Equals(Rectangle.Empty)) { Rectangle cellBounds = this.DataGridTableStyle.DataGrid.GetCellBounds(info.Row, info.Column); if (this.m_depressedBounds.Equals(cellBounds)) { Rectangle rectangle3 = new Rectangle(e.X, e.Y, 1, 1); Rectangle controlBounds = this.GetControlBounds(cellBounds); if (rectangle3.IntersectsWith(controlBounds)) { object objectValue = RuntimeHelpers.GetObjectValue(this.DataGridTableStyle.DataGrid.DataSource); string dataMember = this.DataGridTableStyle.DataGrid.DataMember; CurrencyManager source = (CurrencyManager)this.DataGridTableStyle.DataGrid.BindingContext[RuntimeHelpers.GetObjectValue(objectValue), dataMember]; string str = StringType.FromObject(this.GetColumnValueAtRow(source, info.Row)); if (str.ToLower().Equals("start")) { str = "Stop"; } else if (str.ToLower().Equals("stop")) { str = "Start"; } this.SetColumnValueAtRow(source, info.Row, str); if (this.ClickEvent != null) { this.ClickEvent(new ButtonColumnEventArgs(info.Row, info.Column, str)); } } } this.m_depressedBounds = Rectangle.Empty; this.DataGridTableStyle.DataGrid.Invalidate(cellBounds); } }
protected DataTmpOCompra(SerializationInfo info, StreamingContext context) { string s = StringType.FromObject(info.GetValue("XmlSchema", typeof(string))); if (s != null) { DataSet dataSet = new DataSet(); dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s))); if (dataSet.Tables["PC1TmpOCompra"] != null) { this.Tables.Add(new PC1TmpOCompraDataTable(dataSet.Tables["PC1TmpOCompra"])); } this.DataSetName = dataSet.DataSetName; this.Prefix = dataSet.Prefix; this.Namespace = dataSet.Namespace; this.Locale = dataSet.Locale; this.CaseSensitive = dataSet.CaseSensitive; this.EnforceConstraints = dataSet.EnforceConstraints; this.Merge(dataSet, false, MissingSchemaAction.Add); this.InitVars(); } else { this.InitClass(); } this.GetSerializationData(info, context); CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged); this.Tables.CollectionChanged += handler; this.Relations.CollectionChanged += handler; }
private void LstMapFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lstMapFiles.SelectedIndex != -1) { Variables.selectedMap_Index = lstMapFiles.SelectedIndex; Variables.selectedMap_Name = StringType.FromObject(lstMapFiles.Items[Variables.selectedMap_Index]); saveUserSettings(); btnRunMap.IsEnabled = true; btnGrid.IsEnabled = true; if (CheckSavedMap(Variables.selectedMap_Name)) { LoadSavedMap(Variables.selectedMap_Name); return; } } else { btnRunMap.IsEnabled = false; btnGrid.IsEnabled = false; } resetCompileOptions(); }
private void dgClientes_Click(object sender, EventArgs e) { if (this.DS.Tables["SL010100"].Rows.Count != 0) { Variables.gCodCli = Strings.Trim(StringType.FromObject(this.dgClientes[this.dgClientes.CurrentCell.RowNumber, 0])); Variables.gNomCli = Strings.Trim(StringType.FromObject(this.dgClientes[this.dgClientes.CurrentCell.RowNumber, 1])); this.Close(); } }
private void dgProductos_Click(object sender, EventArgs e) { if (this.DS.Tables["SC010100"].Rows.Count != 0) { Variables.gCodProd = Strings.Trim(StringType.FromObject(this.dgProductos[this.dgProductos.CurrentCell.RowNumber, 0])); Variables.gDescProd1 = Strings.Trim(StringType.FromObject(this.dgProductos[this.dgProductos.CurrentCell.RowNumber, 1])); Variables.gDescProd2 = Strings.Trim(StringType.FromObject(this.dgProductos[this.dgProductos.CurrentCell.RowNumber, 2])); this.Close(); } }
private void dgTmpOVFcProExp_DoubleClick(object sender, EventArgs e) { bool flag = false; if ((this.DS.Tables[Variables.gTermi + "TmpOVFCProExp"].Rows.Count != 0) && (Interaction.MsgBox("Desea eliminar esta OV", 4, "Operador") == 6)) { SqlConnection connection; string str3; try { str3 = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"; connection = new SqlConnection(str3); connection.Open(); flag = true; SqlCommand command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpOVCli (NroOV,Almacen,NomAlmacen,Moneda,CondPago,CondEnt) values ('", this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 0]), "','"), this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 1]), "','"), this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 2]), "','"), this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 4]), "','"), this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 6]), "','"), this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 7]), "')")), connection); int num = command.ExecuteNonQuery(); command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("delete " + Variables.gTermi + "TmpOVFcProExp where NroOV='", this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 0]), "'")), connection); num = command.ExecuteNonQuery(); num = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpItemFcProExp set Seleccion=0 where NroOV='", this.dgTmpOVFcProExp[this.dgTmpOVFcProExp.CurrentCell.RowNumber, 0]), "'")), connection).ExecuteNonQuery(); connection.Close(); flag = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (flag) { connection.Close(); flag = false; } Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } string selectCommandText = "select * from " + Variables.gTermi + "TmpOVCli order by NomAlmacen,NroOV"; this.Adaptador = new SqlDataAdapter(selectCommandText, str3); this.DS.Tables[Variables.gTermi + "TmpOVCli"].Clear(); this.Adaptador.Fill(this.DS, Variables.gTermi + "TmpOVCli"); this.dgTmpOVCli.DataSource = this.DS.Tables[Variables.gTermi + "TmpOVCli"]; this.dgTmpOVCli.Refresh(); selectCommandText = "select * from " + Variables.gTermi + "TmpOVFcProExp order by NomAlmacen,NroOV"; this.Adap2 = new SqlDataAdapter(selectCommandText, str3); this.DS.Tables[Variables.gTermi + "TmpOVFcProExp"].Clear(); this.Adap2.Fill(this.DS, Variables.gTermi + "TmpOVFcProExp"); this.dgTmpOVFcProExp.DataSource = this.DS.Tables[Variables.gTermi + "TmpOVFcProExp"]; this.dgTmpOVFcProExp.Refresh(); } }
private void cmbModificar_Click(object sender, EventArgs e) { SqlConnection connection; bool flag2; bool flag = false; this.AdapTmpItemFcProExp.Update(this.DS, Variables.gTermi + "TmpItemFcProExp"); this.DS.Tables[Variables.gTermi + "TmpItemFcProExp"].AcceptChanges(); try { connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"); connection.Open(); flag = true; flag2 = false; int num3 = this.DS.Tables[Variables.gTermi + "TmpItemFcProExp"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { if (ObjectType.ObjTst(this.dgTmpItemFcProExp[i, 0], true, false) == 0) { flag2 = true; int num2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(("update " + Variables.gTermi + "TmpItemFcProExp set Seleccion=1 where NroOV='") + Variables.gNroOV + "' and Linea='", this.dgTmpItemFcProExp[i, 1]), "'")), connection).ExecuteNonQuery(); } } connection.Close(); flag = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (flag) { connection.Close(); flag = false; } Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); this.Close(); ProjectData.ClearProjectError(); } if (!flag2) { Variables.gSalir = true; } else { Variables.gSalir = false; } this.Close(); }
private void cmbAceptar_Click(object sender, EventArgs e) { if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbPackList.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbPackList.SelectedValue, Strings.Space(0), false) == 0))) { Interaction.MsgBox("Debe seleccionar packing list", 0x10, "Operador"); this.cbPackList.Focus(); } else { this.cbPackList.Enabled = false; this.cmbAceptar.Enabled = false; Variables.gPackList = StringType.FromObject(this.cbPackList.SelectedValue); this.Close(); } }
private void cmbAceptar_Click(object sender, EventArgs e) { this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; if (StringType.StrCmp(this.cbProveedor.Text, Strings.Space(0), false) != 0) { Variables.gCodProv = StringType.FromObject(this.cbProveedor.SelectedValue); Variables.gNomProv = this.cbProveedor.Text; } else { Variables.gCodProv = ""; Variables.gNomProv = ""; } if (StringType.StrCmp(this.cbAlmacen.Text, Strings.Space(0), false) != 0) { Variables.gCodAlmacen = StringType.FromObject(this.cbAlmacen.SelectedValue); Variables.gNomAlmacen = this.cbAlmacen.Text; } else { Variables.gCodAlmacen = ""; Variables.gNomAlmacen = ""; } if (StringType.StrCmp(this.cbMetEnv.Text, Strings.Space(0), false) != 0) { Variables.gCodMetEnt = StringType.FromObject(this.cbMetEnv.SelectedValue); Variables.gDescMetEnt = this.cbMetEnv.Text; } else { Variables.gCodMetEnt = ""; Variables.gDescMetEnt = ""; } new frmRepOCPendConf1().ShowDialog(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; this.cbProveedor.Text = ""; this.cbProveedor.SelectedValue = ""; this.cbAlmacen.Text = ""; this.cbAlmacen.SelectedValue = ""; this.cbMetEnv.Text = ""; this.cbMetEnv.SelectedValue = ""; this.cbProveedor.Text = ""; this.cbProveedor.SelectedValue = ""; this.cbMetEnv.Text = ""; this.cbMetEnv.SelectedValue = ""; }
// Join an array of strings together. public static String Join(Object[] SourceArray, [Optional][DefaultValue(" ")] String Delimiter) { if (SourceArray == null) { throw new ArgumentNullException("SourceArray"); } String[] strSource = new String [SourceArray.Length]; int posn; for (posn = 0; posn < SourceArray.Length; ++posn) { strSource[posn] = StringType.FromObject(SourceArray[posn]); } return(String.Join(Delimiter, strSource)); }
// Get a particular registry setting. public static String GetSetting (String AppName, String Section, String Key, [Optional][DefaultValue(null)] String Default) { String subkey = GetKey(AppName, Section); RegistryKey key = Registry.CurrentUser.OpenSubKey(subkey); try { return(StringType.FromObject(key.GetValue(Key, Default))); } finally { key.Close(); } }
private void editCodProd_LostFocus(object sender, EventArgs e) { bool flag = false; if (StringType.StrCmp(this.editCodProd.Text, Strings.Space(0), false) != 0) { SqlConnection connection; try { connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"); connection.Open(); flag = true; SqlDataReader reader = new SqlCommand("SELECT SC01001,SC01002,SC01003 FROM SC010100 where SC01001='" + this.editCodProd.Text + "'", connection).ExecuteReader(); if (reader.Read()) { this.editDescProd1.Text = StringType.FromObject(reader["SC01002"]); this.editDescProd2.Text = StringType.FromObject(reader["SC01003"]); reader.Close(); } else { Interaction.MsgBox("Producto hasta inexistente", 0x40, "Operador"); this.editDescProd1.Text = ""; this.editDescProd2.Text = ""; reader.Close(); return; } connection.Close(); flag = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (flag) { connection.Close(); flag = false; } Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); this.Close(); ProjectData.ClearProjectError(); } } }
public static string StringFromObject(object Value) { string sRet = null; if (Value != null) { //special case for Guid because is is not supported by Microsoft.VisualBasic.CompilerServices.StringType.FromObject if (Value.GetType() == typeof(Guid)) { sRet = Value.ToString(); } else { sRet = StringType.FromObject(Value); } } return(sRet); }
// Filter an array of strings on a condition. public static String[] Filter (Object[] source, String Match, [Optional][DefaultValue(true)] bool Include, [Optional, OptionCompare][DefaultValue(CompareMethod.Binary)] CompareMethod Compare) { if (source == null) { throw new ArgumentNullException("source"); } String[] strSource = new String [source.Length]; int posn; for (posn = 0; posn < source.Length; ++posn) { strSource[posn] = StringType.FromObject(source[posn]); } return(Filter(strSource, Match, Include, Compare)); }
private static bool ColumnValueToString(DataColumn myColumn, Object oColumnValue, ref string sValue) { bool bRet = false; if (IsPrintableType(myColumn.DataType)) { bRet = true; } else if ((myColumn.DataType == Type.GetType("System.Object")) && IsPrintableType(oColumnValue.GetType())) { sValue = StringType.FromObject(oColumnValue); bRet = true; } if (bRet) { sValue = StringType.FromObject(DataHelper.Nz((oColumnValue), "Null")); } return(bRet); }
private void BuscarCliente() { this.Cursor = Cursors.WaitCursor; Catalogo.cCliente cCliente = new Catalogo.cCliente(2, this._Cliente); if (((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader).Read()) { this.lblNombre.Text = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[1]); this.lblCliente.Text = StringType.FromInteger(this._Cliente); ((ComboBase)this.cboZonaEconomica).PosicionaCombo((int)ShortType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[2])); ((ComboBase)this.cboRuta).PosicionaCombo((int)ShortType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[3])); ((TextBox)this.txtClientePortatil).Text = ""; this.lblNombrePortatil.Text = ""; if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[4]))) { ((TextBox)this.txtClientePortatil).Text = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[4]); this.lblNombrePortatil.Text = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[5]); } } this.Cursor = Cursors.Default; }
public static int Len(Object Expression) { if (Expression == null) { return(0); } switch (ObjectType.GetTypeCode(Expression)) { case TypeCode.SByte: case TypeCode.Byte: return(1); case TypeCode.Boolean: case TypeCode.Char: case TypeCode.Int16: case TypeCode.UInt16: return(2); case TypeCode.Single: case TypeCode.Int32: case TypeCode.UInt32: return(4); case TypeCode.Double: case TypeCode.DateTime: case TypeCode.Int64: case TypeCode.UInt64: return(8); case TypeCode.Decimal: return(16); case TypeCode.String: return(Len(StringType.FromObject(Expression))); } if (Expression is char[]) { return(((char[])Expression).Length); } else if (Expression is ValueType) { return(Marshal.SizeOf(Expression)); } throw new ArgumentException (S._("VB_CouldntHandle"), "Expression"); }
private void txtCodAduana_LostFocus(object sender, EventArgs e) { if (StringType.StrCmp(this.txtCodAduana.Text, Strings.Space(0), false) != 0) { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=True;packet size=4096"); connection.Open(); SqlDataReader reader = new SqlCommand("SELECT SY24002,SY24003 FROM dbo.SY240100 where SY24001='YO' and SY24002='" + this.txtCodAduana.Text + "'", connection).ExecuteReader(); if (reader.Read()) { this.txtDescAdu.Text = StringType.FromObject(reader["SY24003"]); reader.Close(); connection.Close(); } else { Interaction.MsgBox("C\x00f3digo Aduana inexistente", 0x40, "Operador"); this.txtDescAdu.Text = ""; reader.Close(); } } }
private void cmbContinuar_Click(object sender, EventArgs e) { if (Interaction.MsgBox("Los datos del despacho son correctos?", 4, "Operador") == 7) { this.GroupBox2.Enabled = true; this.txtDespacho.Focus(); } else { Variables.gFechaRec = this.dtpFechaRec.Value; Variables.gCodProv = StringType.FromObject(this.cbProveedor.SelectedValue); Variables.gNomProv = this.cbProveedor.Text; Variables.gDespacho = this.txtDespacho.Text; Variables.gFechaImp = this.dtpFechaImp.Value; Variables.gCodAduana = this.txtCodAduana.Text; Variables.gNomAduana = this.txtDescAdu.Text; frmRecOCManual1 manual = new frmRecOCManual1(); this.Hide(); manual.Show(); } }
private void Imprimir() { if (this.Grid.VisibleRowCount <= 0) { return; } if (StringType.StrCmp(StringType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 9]), "1", false) == 0) { if (StringType.StrCmp(StringType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 7]), "AUTORIZADO", false) == 0) { this.ImprimirReporte((int)Globals.GetInstance._Sucursal, IntegerType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 0]), IntegerType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 1])); } else { int num1 = (int)MessageBox.Show("Para imprimir un vale, el anticipo debe ser autorizado.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } else { int num2 = (int)MessageBox.Show("Los vales solo se generan de los anticipos de comisión.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void dgFcProv_DoubleClick(object sender, EventArgs e) { bool flag = false; if ((this.DS.Tables["FCProv"].Rows.Count != 0) && (Interaction.MsgBox("Desea eliminar la factura", 4, "Operador") == 6)) { SqlConnection connection; string str3; try { str3 = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"; connection = new SqlConnection(str3); connection.Open(); flag = true; int num = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("delete Despachos where Despacho='" + Variables.gDespacho + "' and NroFCProv='", this.dgFcProv[this.dgFcProv.CurrentCell.RowNumber, 0]), "'")), connection).ExecuteNonQuery(); connection.Close(); flag = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (flag) { connection.Close(); flag = false; } Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); this.Close(); ProjectData.ClearProjectError(); } string selectCommandText = "select * from Despachos where Despacho='" + Variables.gDespacho + "' order by NroFCProv"; this.Adap = new SqlDataAdapter(selectCommandText, str3); this.DS.Tables["FCProv"].Clear(); this.Adap.Fill(this.DS, "FCProv"); this.dgFcProv.DataSource = this.DS.Tables["FCProv"]; this.dgFcProv.Refresh(); } }
// Get all settings within a particular registry section. public static String[,] GetAllSettings(String AppName, String Section) { String subkey = GetKey(AppName, Section); RegistryKey key = Registry.CurrentUser.OpenSubKey(subkey); try { String[] names = key.GetValueNames(); String[,] result = new String [names.Length, 2]; int posn; for (posn = 0; posn < names.Length; ++posn) { result[posn, 0] = names[posn]; result[posn, 1] = StringType.FromObject(key.GetValue(names[posn])); } return(result); } finally { key.Close(); } }
private void Modificar(int Configuracion) { if (this.Grid.VisibleRowCount <= 0) { return; } if (StringType.StrCmp(StringType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 7]), "CAPTURADO", false) == 0) { if (((Form) new frmUsuario(Globals.GetInstance._Usuario, Globals.GetInstance._Password)).ShowDialog() != DialogResult.OK) { return; } ClienteFactor.cClienteDeduccion clienteDeduccion = new ClienteFactor.cClienteDeduccion(Configuracion, IntegerType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 0]), IntegerType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 1]), 0, Decimal.Zero, this.dtpFInicio.Value, Globals.GetInstance._Usuario); frmRegistraDeduccion registraDeduccion = new frmRegistraDeduccion(); this.dtDatos.DefaultView.RowFilter = ""; this.CargarDatos(); this.ActiveControl = (Control)this.Grid; } else { int num = (int)MessageBox.Show("Para autorizar o cancelar una deducción debe estar en status CAPTURADO.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
public static String Oct(Object Number) { if (Number == null) { throw new ArgumentNullException("Number"); } switch (ObjectType.GetTypeCode(Number)) { case TypeCode.Byte: return(Oct(ByteType.FromObject(Number))); case TypeCode.Int16: return(Oct(ShortType.FromObject(Number))); case TypeCode.Boolean: case TypeCode.Char: case TypeCode.SByte: case TypeCode.UInt16: case TypeCode.Int32: return(Oct(IntegerType.FromObject(Number))); case TypeCode.Int64: return(Oct(LongType.FromObject(Number))); case TypeCode.UInt32: case TypeCode.UInt64: case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: return(Oct(LongType.FromObject(Number))); case TypeCode.String: return(Oct(LongType.FromString (StringType.FromObject(Number)))); } throw new ArgumentException(S._("VB_InvalidNumber"), "Number"); }
// Raise a particular error. public void Raise(int Number, [Optional][DefaultValue(null)] Object Source, [Optional][DefaultValue(null)] Object Description, [Optional][DefaultValue(null)] Object HelpFile, [Optional][DefaultValue(null)] Object HelpContext) { if (Number == 0) { throw new ArgumentException (S._("VB_InvalidErrorNumber"), "Number"); } this.Number = Number; this.Source = StringType.FromObject(Source); this.Description = StringType.FromObject(Description); this.HelpFile = StringType.FromObject(HelpFile); this.HelpContext = IntegerType.FromObject(HelpContext); this.exception = CreateExceptionFromNumber (Number, this.Description); #if !ECMA_COMPAT this.exception.Source = this.Source; this.exception.HelpLink = this.HelpFile; #endif throw this.exception; }
private void ActTmp() { DataRow row; long num; SqlDataReader reader; DateTime time2; DateTime time3; string str4; DataSet dataSet = new DataSet(); DataSet set2 = new DataSet(); this.cmbSalir.Enabled = false; this.cmbVolver.Enabled = false; SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"); connection.Open(); SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection2.Open(); int num4 = new SqlCommand("delete " + Variables.gTermi + "TmpCalendario", connection2).ExecuteNonQuery(); SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpCalendarioStkComp", connection2); num4 = command4.ExecuteNonQuery(); string str = "SELECT OR01001,OR01004,OR01016,OR01050,OR03002,OR03005,OR03006,OR03007,OR03011,OR03012,OR03051,OR04002,OR04003,OR04004,OR04005,OR04008 FROM dbo.OR010100 inner join OR030100 on OR010100.OR01001=OR030100.OR03001 inner join OR040100 on OR010100.OR01001=OR040100.OR04001 where OR010100.OR01002=6 and OR010100.OR01091=0 and OR03011-OR03012<>0 and OR03034=1 and ("; if (Variables.gIntr01) { str = str + "OR01004='INTR01' "; if (Variables.gIntr02) { str = str + "or OR01004='INTR02' "; } if (Variables.gIntr03) { str = str + "or OR01004='INTR03' "; } if (Variables.gIntr04) { str = str + "or OR01004='INTR04' "; } } else if (Variables.gIntr02) { str = str + "OR01004='INTR02' "; if (Variables.gIntr03) { str = str + "or OR01004='INTR03' "; } if (Variables.gIntr04) { str = str + "or OR01004='INTR04' "; } } else if (Variables.gIntr03) { str = str + "OR01004='INTR03' "; if (Variables.gIntr04) { str = str + "or OR01004='INTR04' "; } } else if (Variables.gIntr04) { str = str + "OR01004='INTR04' "; } SqlCommand command3 = new SqlCommand(str + ") order by OR010100.OR01016", connection); command3.CommandTimeout = 900; dataSet.Clear(); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command3; adapter.Fill(dataSet, "OR010100"); long num9 = dataSet.Tables["OR010100"].Rows.Count - 1; for (num = 0L; num <= num9; num += 1L) { row = dataSet.Tables["OR010100"].Rows[(int)num]; str4 = "insert into " + Variables.gTermi + "TmpCalendario (FechaEnt,Cliente,ListaRec,NroOA,NroLinea,Codigo,Descripcion,Almacen,Cantidad,AsignadoA,Observaciones,ReqEsp,Horas,SinStock,Obs) values ("; CalcDates dates = new CalcDatesClass(); short daysToDue = 0; DataRow row3 = row; string str9 = "OR01016"; DateTime currentDate = DateType.FromObject(row3[str9]); string dayCountType = "H"; string company = "01"; dates.WeekDate(ref daysToDue, ref currentDate, ref dayCountType, ref company); row3[str9] = currentDate; str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((str4 + "'" + Strings.Format(dates.MidDate, "MM/dd/yyyy")) + "','", row["OR01004"]), "','"), row["OR03051"]), "','"), row["OR01001"]), "','"), row["OR03002"]), "','"), row["OR03005"]), "','"), row["OR03006"]), " "), row["OR03007"]), "','"), row["OR01050"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ",")); if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04002"])), "0", false) == 0) { str4 = str4 + "'',"; } else { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04002"]), "',")); } if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04003"])), "0", false) == 0) { if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04004"])), "0", false) == 0) { str4 = str4 + "'',"; } else { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04004"]), "',")); } } else if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04004"])), "0", false) == 0) { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04003"]), "',")); } else { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04003"]), " "), row["OR04004"]), "',")); } if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04005"])), "0", false) == 0) { str4 = str4 + "'',"; } else { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04005"]), "',")); } command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04008"]), "',0,0)")), connection2); try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; this.cmbVolver.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } command3 = new SqlCommand("SELECT distinct NroOA from " + Variables.gTermi + "TmpCalendario", connection2); command3.CommandTimeout = 900; dataSet.Clear(); adapter = new SqlDataAdapter(); adapter.SelectCommand = command3; adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario"); long num7 = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count - 1; for (num = 0L; num <= num7; num += 1L) { row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[(int)num]; SqlCommand command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT * from GesEnsObs where NroOE='", row["NroOA"]), "'")), connection2); reader = command.ExecuteReader(); if (reader.Read()) { reader.Close(); command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpCalendario set Obs=1 where NroOA='", row["NroOA"]), "'")), connection2); try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception8) { ProjectData.SetProjectError(exception8); Exception exception2 = exception8; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } else { reader.Close(); } } command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpCalendario order by FechaEnt", connection2); command3.CommandTimeout = 900; dataSet.Clear(); adapter = new SqlDataAdapter(); adapter.SelectCommand = command3; adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario"); if (dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count != 0) { row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[0]; if (DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday) > 1) { time3 = DateAndTime.DateAdd(DateInterval.Day, (double)((DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday) - 1) * -1), DateType.FromObject(row["FechaEnt"])); } else { time3 = DateType.FromObject(row["FechaEnt"]); } } command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpCalendario order by FechaEnt desc", connection2); command3.CommandTimeout = 900; dataSet.Clear(); adapter = new SqlDataAdapter(); adapter.SelectCommand = command3; adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario"); if (dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count != 0) { row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[0]; if (DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday) < 7) { time2 = DateAndTime.DateAdd(DateInterval.Day, (double)(7 - DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday)), DateType.FromObject(row["FechaEnt"])); } else { time2 = DateType.FromObject(row["FechaEnt"]); } } while (DateTime.Compare(time3, time2) <= 0) { SqlCommand command2 = new SqlCommand("SELECT * FROM " + Variables.gTermi + "TmpCalendario where FechaEnt='" + Strings.Format(time3, "MM/dd/yyyy") + "'", connection2); reader = command2.ExecuteReader(); if (reader.Read()) { reader.Close(); } else { reader.Close(); reader = new SqlCommand("SELECT * FROM dbo.SYHO0100 where SYHO001='" + Strings.Format(time3, "MM/dd/yyyy") + "'", connection).ExecuteReader(); if (reader.Read()) { command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into " + Variables.gTermi + "TmpCalendario (FechaEnt,Observaciones) values (") + "'" + Strings.Format(time3, "MM/dd/yyyy") + "',") + "'", reader["SYHO002"]), "')")), connection2); reader.Close(); } else { command4 = new SqlCommand(("insert into " + Variables.gTermi + "TmpCalendario (FechaEnt) values (") + "'" + Strings.Format(time3, "MM/dd/yyyy") + "')", connection2); reader.Close(); } try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception9) { ProjectData.SetProjectError(exception9); Exception exception3 = exception9; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; this.cmbVolver.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } time3 = DateAndTime.DateAdd(DateInterval.Day, 1.0, time3); } command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpCalendario where not Codigo is null order by NroOA,NroLinea", connection2); command3.CommandTimeout = 900; dataSet.Clear(); adapter = new SqlDataAdapter(); adapter.SelectCommand = command3; adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario"); long num6 = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count - 1; for (num = 0L; num <= num6; num += 1L) { row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[(int)num]; command3 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR03005,OR03006,OR03007,OR03011,OR03012,SC03003,SC03004,SC03005 FROM dbo.OR030100 inner join SC030100 on OR030100.OR03005=SC030100.SC03001 where OR03001='", row["NroOA"]), "' and OR03002='"), row["NroLinea"]), "' and OR03003<>'000' and SC03002='"), row["Almacen"]), "'")), connection); command3.CommandTimeout = 900; set2.Clear(); SqlDataAdapter adapter2 = new SqlDataAdapter(); adapter2.SelectCommand = command3; adapter2.Fill(set2, "OR030100"); bool flag = false; long num5 = set2.Tables["OR030100"].Rows.Count - 1; for (long i = 0L; i <= num5; i += 1L) { DataRow row2 = set2.Tables["OR030100"].Rows[(int)i]; if (BooleanType.FromObject(ObjectType.BitOrObj(ObjectType.ObjTst(row2["SC03003"], 0, false) <= 0, ObjectType.ObjTst(ObjectType.AddObj(row2["SC03004"], row2["SC03005"]), row2["SC03003"], false) > 0))) { flag = true; } if (ObjectType.ObjTst(ObjectType.AddObj(row2["SC03004"], row2["SC03005"]), row2["SC03003"], false) > 0) { reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row2["OR03005"]), "' and PC03043<PC03044 and PC03029=1 ")) + "and PC03035='", row["Almacen"]), "' order by PC03016")), connection).ExecuteReader(); if (reader.Read()) { str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCalendarioStkComp (NroOA,NroLinea,CodComp,DescComp,Cantidad,StkFisico,StkComprometido,FechaOC,CantOC) values ('", row["NroOA"]), "','"), row["NroLinea"]), "','"), row2["OR03005"]), "','"), row2["OR03006"]), " "), row2["OR03007"]), "',"), ObjectType.SubObj(row2["OR03011"], row2["OR03012"])), ","), row2["SC03003"]), ","), ObjectType.AddObj(row2["SC03004"], row2["SC03005"])), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ")")); reader.Close(); command4 = new SqlCommand(str4, connection2); try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception10) { ProjectData.SetProjectError(exception10); Exception exception4 = exception10; Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; this.cmbVolver.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } else { reader.Close(); command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCalendarioStkComp (NroOA,NroLinea,CodComp,DescComp,Cantidad,StkFisico,StkComprometido) values ('", row["NroOA"]), "','"), row["NroLinea"]), "','"), row2["OR03005"]), "','"), row2["OR03006"]), " "), row2["OR03007"]), "',"), ObjectType.SubObj(row2["OR03011"], row2["OR03012"])), ","), row2["SC03003"]), ","), ObjectType.AddObj(row2["SC03004"], row2["SC03005"])), ")")), connection2); try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception11) { ProjectData.SetProjectError(exception11); Exception exception5 = exception11; Interaction.MsgBox("Se ha producido el siguiente error:" + exception5.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; this.cmbVolver.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } } else { command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCalendarioStkComp (NroOA,NroLinea,CodComp,DescComp,Cantidad,StkFisico,StkComprometido) values ('", row["NroOA"]), "','"), row["NroLinea"]), "','"), row2["OR03005"]), "','"), row2["OR03006"]), " "), row2["OR03007"]), "',"), ObjectType.SubObj(row2["OR03011"], row2["OR03012"])), ","), row2["SC03003"]), ","), ObjectType.AddObj(row2["SC03004"], row2["SC03005"])), ")")), connection2); try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception12) { ProjectData.SetProjectError(exception12); Exception exception6 = exception12; Interaction.MsgBox("Se ha producido el siguiente error:" + exception6.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; this.cmbVolver.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } } if (flag) { command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpCalendario set SinStock=1 where NroOA='", row["NroOA"]), "'")), connection2); try { num4 = command4.ExecuteNonQuery(); } catch (Exception exception13) { ProjectData.SetProjectError(exception13); Exception exception7 = exception13; Interaction.MsgBox("Se ha producido el siguiente error:" + exception7.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbSalir.Enabled = true; this.cmbVolver.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } } connection.Close(); connection2.Close(); }
private void cmbAceptar_Click(object sender, EventArgs e) { SqlConnection connection; bool flag = false; try { connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"); connection.Open(); flag = true; bool flag2 = false; int num3 = this.DS.Tables[Variables.gTermi + "TmpMetEnvio"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { int num2; if (ObjectType.ObjTst(this.dgMetEnvio[i, 0], true, false) == 0) { flag2 = true; SqlCommand command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpMetEnvio set Seleccion=1 where MetEnvio='", this.dgMetEnvio[i, 1]), "'")), connection); num2 = command.ExecuteNonQuery(); } else { num2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpMetEnvio set Seleccion=0 where MetEnvio='", this.dgMetEnvio[i, 1]), "'")), connection).ExecuteNonQuery(); } } connection.Close(); flag = false; if (!flag2) { Interaction.MsgBox("Debe seleccionar alg\x00fan m\x00e9todo de env\x00edo", 0x10, "Operador"); return; } } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (flag) { connection.Close(); flag = false; } Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); this.Close(); ProjectData.ClearProjectError(); } this.dtpFechaDesde.Enabled = false; this.dtpFechaHasta.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; if (this.dtpFechaDesde.Checked) { Variables.gDesde = StringType.FromDate(this.dtpFechaDesde.Value); } else { Variables.gDesde = ""; } if (this.dtpFechaHasta.Checked) { Variables.gHasta = StringType.FromDate(this.dtpFechaHasta.Value); } else { Variables.gHasta = ""; } frmRepRMDesp1 desp = new frmRepRMDesp1(); this.Hide(); desp.Show(); }