public void setup_generate_random1(object setup_low_rand, object setup_high_rand) { setup_rand_finished = false; while (!setup_rand_finished) { VBMath.Randomize(); setup_random1 = IntegerType.FromObject(Conversion.Int(ObjectType.AddObj(ObjectType.MulObj(ObjectType.AddObj(setup_high_rand, 1), VBMath.Rnd()), 0))); if (!BooleanType.FromObject(ObjectType.BitAndObj(ObjectType.ObjTst(setup_random1, setup_low_rand, false) >= 0, ObjectType.ObjTst(setup_random1, setup_high_rand, false) <= 0))) { continue; } setup_rand_finished = true; } }
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(); } }
public void BitAndObj(object x, object y, object expected) { Assert.Equal(expected, ObjectType.BitAndObj(x, y)); }
private void cmbAceptar_Click(object sender, EventArgs e) { DataSet dataSet = new DataSet(); DataSet set2 = new DataSet(); bool flag = false; if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbAlmacen.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbAlmacen.SelectedValue, Strings.Space(0), false) == 0))) { Interaction.MsgBox("Debe seleccionar almac\x00e9n", MsgBoxStyle.Critical, "Operador"); this.cbAlmacen.Focus(); } else if (((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) == 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) != 0)) | ((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) != 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) == 0))) { Interaction.MsgBox("Debe indicar desde y hasta rack", MsgBoxStyle.Critical, "Operador"); this.editDesdeRack.Focus(); } else { this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; Variables.gFechaInv = this.dtpFechaInv.Value; Variables.gCodAlmacen = StringType.FromObject(this.cbAlmacen.SelectedValue); Variables.gNomAlmacen = this.cbAlmacen.Text; Variables.gDesdeRack = Strings.Trim(this.editDesdeRack.Text); Variables.gHastaRack = Strings.Trim(this.editHastaRack.Text); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); SqlTransaction transaction = connection.BeginTransaction(); flag = true; SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM dbo.RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "'", connectionString); adapter.Fill(dataSet, "RepDifInv"); if (dataSet.Tables["RepDifInv"].Rows.Count != 0) { Interaction.MsgBox("Ya se gener\x00f3 diferencia de inventario sobre estos datos", MsgBoxStyle.Critical, "Operador"); if (flag) { transaction.Rollback(); flag = false; } connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; this.cmbAceptar.Focus(); } else { dataSet.Tables["RepDifInv"].Rows.Clear(); adapter = new SqlDataAdapter("SELECT Fecha FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "'", connectionString); adapter.Fill(dataSet, "Inventario"); if (dataSet.Tables["Inventario"].Rows.Count == 0) { Interaction.MsgBox("No se realizo inventario f\x00edsico en la fecha indicada", MsgBoxStyle.Critical, "Operador"); if (flag) { transaction.Rollback(); flag = false; } connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; this.cmbAceptar.Focus(); } else { DataRow row; long num; int num2; SqlCommand command3; string str; string str2; dataSet.Tables["Inventario"].Rows.Clear(); if (Strings.Len(Variables.gDesdeRack) == 2) { str = "SELECT SC03001,SC03002,SC03003,SC01002,SC01003,SC03013 FROM dbo.SC030100 INNER JOIN SC010100 on SC03001=SC01001 where SC03003<>0 and SC03002='" + Variables.gCodAlmacen + "' and substring(SC03013,3,2)>='" + Variables.gDesdeRack + "' and substring(SC03013,3,2)<='" + Variables.gHastaRack + "'"; } else if (Strings.Len(Variables.gDesdeRack) == 1) { str = "SELECT SC03001,SC03002,SC03003,SC01002,SC01003,SC03013 FROM dbo.SC030100 INNER JOIN SC010100 on SC03001=SC01001 where SC03003<>0 and SC03002='" + Variables.gCodAlmacen + "' and substring(SC03013,3,1)>='" + Variables.gDesdeRack + "' and substring(SC03013,3,1)<='" + Variables.gHastaRack + "'"; } else { str = "SELECT SC03001,SC03002,SC03003,SC01002,SC01003,SC03013 FROM dbo.SC030100 INNER JOIN SC010100 on SC03001=SC01001 where SC03003<>0 and SC03002='" + Variables.gCodAlmacen + "'"; } SqlCommand command = new SqlCommand(str, connection); command.CommandTimeout = 500; command.Transaction = transaction; SqlDataAdapter adapter3 = new SqlDataAdapter(); adapter3.SelectCommand = command; adapter3.Fill(dataSet, "SC030100"); this.Label1.Visible = true; this.Label1.Refresh(); this.txtCodProd.Visible = true; long num4 = dataSet.Tables["SC030100"].Rows.Count - 1; for (num = 0L; num <= num4; num += 1L) { row = dataSet.Tables["SC030100"].Rows[(int)num]; this.txtCodProd.Text = StringType.FromObject(row["SC03001"]); this.txtCodProd.Refresh(); adapter = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT Codigo,sum(Cantidad) as Cantidad,Posicion FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and Codigo='", row["SC03001"]), "' and Posicion='"), row["SC03013"]), "' group by Codigo,Posicion")), connectionString); adapter.Fill(dataSet, "Inventario"); try { DataRow row2; string str4; if (dataSet.Tables["Inventario"].Rows.Count != 0) { row2 = dataSet.Tables["Inventario"].Rows[0]; 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((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','", row["SC03002"]), "','"), row2["Posicion"]), "','"), row["SC03001"]), "','"), row["SC01002"]), "','"), row["SC01003"]), "',"), row2["Cantidad"]), ",'"), row["SC03013"]), "',"), row["SC03003"]), ",0,0)")); dataSet.Tables["Inventario"].Rows.Clear(); } else { dataSet.Tables["Inventario"].Rows.Clear(); new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT Codigo,sum(Cantidad) as Cantidad,Posicion FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and Codigo='", row["SC03001"]), "' group by Codigo,Posicion")), connectionString).Fill(dataSet, "Inventario"); if (dataSet.Tables["Inventario"].Rows.Count != 0) { row2 = dataSet.Tables["Inventario"].Rows[0]; 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((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','", row["SC03002"]), "','"), row2["Posicion"]), "','"), row["SC03001"]), "','"), row["SC01002"]), "','"), row["SC01003"]), "',"), row2["Cantidad"]), ",'"), row["SC03013"]), "',"), row["SC03003"]), ",0,0)")); dataSet.Tables["Inventario"].Rows.Clear(); } else { 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((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','", row["SC03002"]), "',' ','"), row["SC03001"]), "','"), row["SC01002"]), "','"), row["SC01003"]), "',0,'"), row["SC03013"]), "',"), row["SC03003"]), ",0,0)")); } command3 = new SqlCommand(str4, connection); command3.Transaction = transaction; } num2 = command3.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); if (flag) { transaction.Rollback(); flag = false; } connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } if (Strings.Len(Variables.gDesdeRack) == 2) { str2 = "SELECT Posicion,Codigo,Desc1,Desc2,sum(Cantidad) as Cantidad FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and substring(Posicion,3,2)>='" + Variables.gDesdeRack + "' and substring(Posicion,3,2)<='" + Variables.gHastaRack + "' group by Posicion,Codigo,Desc1,Desc2"; } else if (Strings.Len(Variables.gDesdeRack) == 1) { str2 = "SELECT Posicion,Codigo,Desc1,Desc2,sum(Cantidad) as Cantidad FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and substring(Posicion,3,1)>='" + Variables.gDesdeRack + "' and substring(Posicion,3,1)<='" + Variables.gHastaRack + "' group by Posicion,Codigo,Desc1,Desc2"; } else { str2 = "SELECT Posicion,Codigo,Desc1,Desc2,sum(Cantidad) as Cantidad FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' group by Posicion,Codigo,Desc1,Desc2"; } new SqlDataAdapter(str2, connectionString).Fill(dataSet, "Inventario"); long num3 = dataSet.Tables["Inventario"].Rows.Count - 1; for (num = 0L; num <= num3; num += 1L) { row = dataSet.Tables["Inventario"].Rows[(int)num]; this.txtCodProd.Text = StringType.FromObject(row["Codigo"]); this.txtCodProd.Refresh(); try { command3 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','" + Variables.gCodAlmacen) + "','", row["Posicion"]), "','"), row["Codigo"]), "','"), row["Desc1"]), "','"), row["Desc2"]), "',"), row["Cantidad"]), ",' ',0,0,0)")), connection); command3.Transaction = transaction; num2 = command3.ExecuteNonQuery(); } catch (SqlException exception4) { ProjectData.SetProjectError(exception4); SqlException exception2 = exception4; if (exception2.Number != 0xa43) { Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); if (flag) { transaction.Rollback(); flag = false; } connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; } ProjectData.ClearProjectError(); } catch (Exception exception5) { ProjectData.SetProjectError(exception5); Exception exception3 = exception5; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null); if (flag) { transaction.Rollback(); flag = false; } connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } transaction.Commit(); flag = false; connection.Close(); Variables.gGenDifInv = true; frmGenDifInv1 inv = new frmGenDifInv1(); this.Hide(); inv.Show(); } } } }
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 if (StringType.StrCmp(this.txtDespacho.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe ingresar Despacho", 0x10, "Operador"); this.txtDespacho.Focus(); } else if (StringType.StrCmp(this.txtCodAduana.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe ingresar C\x00f3digo de Aduana", 0x10, "Operador"); this.txtCodAduana.Focus(); } else { this.cbPackList.Enabled = false; this.cmbAceptar.Enabled = false; this.GroupBox2.Enabled = false; Variables.gDespacho = this.txtDespacho.Text; Variables.gFechaImp = this.dtpFechaImp.Value; Variables.gCodAduana = this.txtCodAduana.Text; string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); SqlDataReader reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select * from Recepcion where PackList='", this.cbPackList.SelectedValue), "'")), connection).ExecuteReader(); if (reader.Read()) { reader.Close(); connection.Close(); Interaction.MsgBox("Este packing list ya fue procesado", 0x40, "Operador"); this.cbPackList.Enabled = true; this.cmbAceptar.Enabled = true; this.GroupBox2.Enabled = true; this.cbPackList.Focus(); } else { reader.Close(); Variables.gPackList = StringType.FromObject(this.cbPackList.SelectedValue); string selectCommandText = "select * from Despachos where Despacho='" + Variables.gDespacho + "' order by NroFCProv"; this.Adap = new SqlDataAdapter(selectCommandText, connectionString); this.CB = new SqlCommandBuilder(this.Adap); this.Adap.Fill(this.DS, "FCProv"); this.dgFcProv.DataSource = this.DS.Tables["FCProv"]; DataGridTableStyle table = new DataGridTableStyle(); table.MappingName = "FCProv"; DataGridTextBoxColumn column = new DataGridTextBoxColumn(); column = new DataGridTextBoxColumn(); DataGridTextBoxColumn column2 = column; column2.HeaderText = "Factura Proveedor"; column2.MappingName = "NroFCProv"; column2.Width = 150; column2 = null; table.GridColumnStyles.Add(column); this.dgFcProv.TableStyles.Add(table); this.dgFcProv.Refresh(); this.GroupBox1.Visible = true; this.editNroFC.Focus(); } } }
private void cmbAceptar_Click(object sender, EventArgs e) { DataSet dataSet = new DataSet(); DataSet set2 = new DataSet(); if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbAlmacen.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbAlmacen.SelectedValue, Strings.Space(0), false) == 0))) { Interaction.MsgBox("Debe seleccionar almac\x00e9n", 0x10, "Operador"); this.cbAlmacen.Focus(); } else if (((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) == 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) != 0)) | ((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) != 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) == 0))) { Interaction.MsgBox("Debe indicar desde y hasta rack", 0x10, "Operador"); this.editDesdeRack.Focus(); } else if (StringType.StrCmp(this.editReferencia.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe ingresar referencia", 0x10, "Operador"); this.editReferencia.Focus(); } else { this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; Variables.gFechaInv = this.dtpFechaInv.Value; Variables.gCodAlmacen = StringType.FromObject(this.cbAlmacen.SelectedValue); Variables.gNomAlmacen = this.cbAlmacen.Text; Variables.gDesdeRack = Strings.Trim(this.editDesdeRack.Text); Variables.gHastaRack = Strings.Trim(this.editHastaRack.Text); Variables.gReferencia = Strings.Trim(this.editReferencia.Text); string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); new SqlDataAdapter("SELECT * FROM dbo.RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "'", connectionString).Fill(dataSet, "RepDifInv"); if (dataSet.Tables["RepDifInv"].Rows.Count == 0) { Interaction.MsgBox("No se gener\x00f3 diferencia de inventario sobre estos datos", 0x10, "Operador"); connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; this.cmbAceptar.Focus(); } else { dataSet.Tables["RepDifInv"].Rows.Clear(); SqlCommand command3 = new SqlCommand("delete " + Variables.gTermi + "TmpInventario", connection); int num2 = command3.ExecuteNonQuery(); command3 = new SqlCommand("insert into " + Variables.gTermi + "TmpInventario select Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar from RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "' and (Cantidad<>CantSist or Posicion<>PosSist)", connection); try { num2 = command3.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); connection.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } connection.Close(); frmRepDifInv2 inv = new frmRepDifInv2(); this.Hide(); inv.Show(); } } }