private void cmbAceptar_Click(object sender, EventArgs e) { if (StringType.StrCmp(this.editMesesNRNue.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe ingresar meses para nivel de reposici\x00f3n", MsgBoxStyle.Critical, "Operador"); this.editMesesNRNue.Focus(); } else if (!Information.IsNumeric(this.editMesesNRNue.Text)) { Interaction.MsgBox("Meses para nivel de reposici\x00f3n debe ser num\x00e9rico", MsgBoxStyle.Critical, "Operador"); this.editMesesNRNue.Focus(); } else { this.dtpFechaOC.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; Variables.gFechaOC = StringType.FromDate(this.dtpFechaOC.Value); if (StringType.StrCmp(this.cbAlmacen.Text, Strings.Space(0), false) != 0) { Variables.gAlmacen1 = this.cbAlmacen.Text; } else { Variables.gAlmacen1 = ""; } Variables.gMesesNRNue = IntegerType.FromString(this.editMesesNRNue.Text); this.ActTmp(); frmGenOC1 noc = new frmGenOC1(); this.Hide(); noc.Show(); } }
private void cmbAceptar_Click(object sender, EventArgs e) { this.dtpFechaInv.Enabled = false; this.editOperario.Enabled = false; this.editCodProdDesde.Enabled = false; this.editCodProdHasta.Enabled = false; this.dtpFechaLec.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; Variables.gFechaInv = this.dtpFechaInv.Value; if (StringType.StrCmp(this.editOperario.Text, Strings.Space(0), false) != 0) { Variables.gOperario = this.editOperario.Text; } else { Variables.gOperario = ""; } if (StringType.StrCmp(this.editCodProdDesde.Text, Strings.Space(0), false) != 0) { Variables.gCodProdDesde = this.editCodProdDesde.Text; Variables.gDescProdDesde1 = this.editDescProdDesde1.Text; Variables.gDescProdDesde2 = this.editDescProdDesde2.Text; } else { Variables.gCodProdDesde = ""; Variables.gDescProdDesde1 = ""; Variables.gDescProdDesde2 = ""; } if (StringType.StrCmp(this.editCodProdHasta.Text, Strings.Space(0), false) != 0) { Variables.gCodProdHasta = this.editCodProdHasta.Text; Variables.gDescProdHasta1 = this.editDescProdHasta1.Text; Variables.gDescProdHasta2 = this.editDescProdHasta2.Text; } else { Variables.gCodProdHasta = ""; Variables.gDescProdHasta1 = ""; Variables.gDescProdHasta2 = ""; } if (this.dtpFechaLec.Checked) { Variables.gFechaLec = StringType.FromDate(this.dtpFechaLec.Value); } else { Variables.gFechaLec = ""; } frmRepInvFis1 fis = new frmRepInvFis1(); this.Hide(); fis.Show(); }
private void cmbAceptar_Click(object sender, EventArgs e) { this.dtpDesdeFechaExp.Enabled = false; this.dtpHastaFechaExp.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; Variables.gDesde = StringType.FromDate(this.dtpDesdeFechaExp.Value); Variables.gHasta = StringType.FromDate(this.dtpHastaFechaExp.Value); frmDifOCProv1 prov = new frmDifOCProv1(); this.Hide(); prov.Show(); }
private void btnModificar_Click(object sender, EventArgs e) { Variables.gNroOV = this.editNroOV.Text; Variables.gFechaEntOC = StringType.FromDate(this.dtpFechaOC.Value); Variables.gCliente = this.txtCliente.Text; Variables.gNomCli = this.txtNomCli.Text; Variables.gCodMetEnt = this.txtMetEnv.Text; Variables.gDescMetEnt = this.txtNomMetEnv.Text; Variables.gDirEnt1 = this.txtDirEnt1.Text; Variables.gDirEnt2 = this.txtDirEnt2.Text; Variables.gDirEnt3 = this.txtDirEnt3.Text; Variables.gDirEnt4 = this.txtDirEnt4.Text; Variables.gDirEnt5 = this.txtDirEnt5.Text; frmGenOCExp1 exp = new frmGenOCExp1(); this.Hide(); exp.Show(); }
private void cmbAceptar_Click(object sender, EventArgs e) { if (this.dtpFechaDesde.Checked & !this.dtpFechaHasta.Checked) { Interaction.MsgBox("Debe seleccionar desde y hasta fecha entrega", 0x10, "Operador"); this.dtpFechaHasta.Focus(); } else if (!this.dtpFechaDesde.Checked & this.dtpFechaHasta.Checked) { Interaction.MsgBox("Debe seleccionar desde y hasta fecha entrega", 0x10, "Operador"); this.dtpFechaDesde.Focus(); } else { this.dtpFechaDesde.Enabled = false; this.dtpFechaHasta.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; if (this.dtpFechaDesde.Checked & this.dtpFechaHasta.Checked) { Variables.gDesde = StringType.FromDate(this.dtpFechaDesde.Value); Variables.gHasta = StringType.FromDate(this.dtpFechaHasta.Value); } else { Variables.gDesde = ""; DateTime currentDate = DateAndTime.get_Now(); CalcDates dates = new CalcDatesClass(); short daysToDue = 0; string dayCountType = "H"; string company = "01"; dates.WeekDate(ref daysToDue, ref currentDate, ref dayCountType, ref company); Variables.gHasta = StringType.FromDate(dates.MidDate); } frmPrepPed1 ped = new frmPrepPed1(); this.Hide(); ped.Show(); } }
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(); }
private void cmbAceptar_Click(object sender, EventArgs e) { DataSet dataSet = new DataSet(); if (!this.dtpDesdeFechaEnt.Checked & this.dtpHastaFechaEnt.Checked) { Interaction.MsgBox("Debe ingresar desde fecha entrega", MsgBoxStyle.Critical, "Operador"); this.dtpDesdeFechaEnt.Checked = true; } else if (this.dtpDesdeFechaEnt.Checked & !this.dtpHastaFechaEnt.Checked) { Interaction.MsgBox("Debe ingresar hasta fecha entrega", MsgBoxStyle.Critical, "Operador"); this.dtpHastaFechaEnt.Checked = true; } else { DataRow row; long num; SqlDataReader reader; string str4; this.dtpDesdeFechaEnt.Enabled = false; this.dtpHastaFechaEnt.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; if (this.dtpDesdeFechaEnt.Checked) { Variables.gDesdeFechaEnt = StringType.FromDate(this.dtpDesdeFechaEnt.Value); } else { Variables.gDesdeFechaEnt = ""; } if (this.dtpHastaFechaEnt.Checked) { Variables.gHastaFechaEnt = StringType.FromDate(this.dtpHastaFechaEnt.Value); } else { Variables.gHastaFechaEnt = ""; } SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"); 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(); SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpRegPedExp", connection2); int num2 = command4.ExecuteNonQuery(); string str = "SELECT OR01001,OR01004,OR01016,OR01024,OR01072,OR03019,sum((OR03011-OR03012)*OR03008) as ImpAFac,OR04005,SL01002,PL23004,SY14002 FROM dbo.OR010100 inner join OR030100 on OR010100.OR01001=OR030100.OR03001 inner join OR040100 on OR010100.OR01001=OR040100.OR04001 inner join SL010100 on OR010100.OR01004=SL010100.SL01001 inner join PL230100 on OR010100.OR01014=convert(int,PL230100.PL23003) inner join SY140100 on OR010100.OR01028=SY140100.SY14001 where OR010100.OR01002<>6 and OR03011-OR03012<>0 and ((OR01004>='600000' and OR01004<='699000') or OR01004='00WARREXPO')"; if (this.dtpDesdeFechaEnt.Checked & this.dtpHastaFechaEnt.Checked) { str = str + " and OR03019>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR03019<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'"; } SqlCommand command2 = new SqlCommand(str + " and PL23001='2' and PL23002='00'" + " group by OR01001,OR01004,OR01016,OR01024,OR01072,OR03019,OR04005,SL01002,PL23004,SY14002", connection); command2.CommandTimeout = 500; SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command2; connection.Open(); adapter.Fill(dataSet, "OR010100"); long num4 = dataSet.Tables["OR010100"].Rows.Count - 1; for (num = 0L; num <= num4; num += 1L) { row = dataSet.Tables["OR010100"].Rows[(int)num]; SqlCommand command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC01001,PL01002 FROM dbo.PC010100 inner join PL010100 on PC010100.PC01003=PL010100.PL01001 where PC01017='ORDEN VENT", row["OR01001"]), "'")), connection); reader = command.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(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (1,'", row["OR01004"]), "','"), row["SL01002"]), "','"), row["OR01072"]), "','"), row["OR01001"]), "','"), reader["PC01001"]), "','"), reader["PL01002"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR03019"]), "MM/dd/yyyy")), "','"), row["OR04005"]), "','"), row["SY14002"]), "',"), row["OR01024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')")); reader.Close(); command4 = new SqlCommand(str4, connection2); } 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(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (1,'", row["OR01004"]), "','"), row["SL01002"]), "','"), row["OR01072"]), "','"), row["OR01001"]), "','','','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR03019"]), "MM/dd/yyyy")), "','"), row["OR04005"]), "','"), row["SY14002"]), "',"), row["OR01024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')")), connection2); } try { num2 = 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.dtpDesdeFechaEnt.Enabled = true; this.dtpHastaFechaEnt.Enabled = true; this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } str = "SELECT OR20001,OR20004,OR20016,OR20024,OR20072,OR21019,sum((OR21011-OR21012)*OR21008) as ImpAFac,OR22005,SL01002,PL23004,SY14002 FROM dbo.OR200100 inner join OR210100 on OR200100.OR20001=OR210100.OR21001 inner join OR220100 on OR200100.OR20001=OR220100.OR22001 inner join SL010100 on OR200100.OR20004=SL010100.SL01001 inner join PL230100 on OR200100.OR20014=convert(int,PL230100.PL23003) inner join SY140100 on OR200100.OR20028=SY140100.SY14001 where OR200100.OR20002<>6 and OR21011-OR21012<>0 and ((OR20004>='600000' and OR20004<='699000') or OR20004='00WARREXPO')"; if (this.dtpDesdeFechaEnt.Checked & this.dtpHastaFechaEnt.Checked) { str = str + " and OR21019>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR21019<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'"; } command2 = new SqlCommand(str + " and PL23001='2' and PL23002='00'" + " group by OR20001,OR20004,OR20016,OR20024,OR20072,OR21019,OR22005,SL01002,PL23004,SY14002", connection); command2.CommandTimeout = 500; SqlDataAdapter adapter2 = new SqlDataAdapter(); adapter2.SelectCommand = command2; adapter2.Fill(dataSet, "OR200100"); long num3 = dataSet.Tables["OR200100"].Rows.Count - 1; for (num = 0L; num <= num3; num += 1L) { row = dataSet.Tables["OR200100"].Rows[(int)num]; reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC01001,PL01002 FROM dbo.PC010100 inner join PL010100 on PC010100.PC01003=PL010100.PL01001 where PC01017='ORDEN VENT", row["OR20001"]), "'")), 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(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (2,'", row["OR20004"]), "','"), row["SL01002"]), "','"), row["OR20072"]), "','"), row["OR20001"]), "','"), reader["PC01001"]), "','"), reader["PL01002"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR20016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR21019"]), "MM/dd/yyyy")), "','"), row["OR22005"]), "','"), row["SY14002"]), "',"), row["OR20024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')")); reader.Close(); command4 = new SqlCommand(str4, connection2); } 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(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRegPedExp (Tipo,Cliente,NomCli,OCCliente,NroOV,NroOCProv,NomProv,FEntPed,FEntConf,PaisDest,Moneda,MontoOV,ImpAFac,FormaDesp) values (2,'", row["OR20004"]), "','"), row["SL01002"]), "','"), row["OR20072"]), "','"), row["OR20001"]), "','','','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR20016"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR21019"]), "MM/dd/yyyy")), "','"), row["OR22005"]), "','"), row["SY14002"]), "',"), row["OR20024"]), ","), row["ImpAFac"]), ",'"), row["PL23004"]), "')")), connection2); } try { num2 = command4.ExecuteNonQuery(); } catch (Exception exception3) { ProjectData.SetProjectError(exception3); Exception exception2 = exception3; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.dtpDesdeFechaEnt.Enabled = true; this.dtpHastaFechaEnt.Enabled = true; this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } connection.Close(); connection2.Close(); frmRepRegPedExp1 exp = new frmRepRegPedExp1(); this.Hide(); exp.Show(); } }
public void FromDate(DateTime value, string expected) { Assert.Equal(expected, StringType.FromDate(value)); }
// Inner version of "Print" and "Write". private static void Print(File file, Object[] Output, CultureInfo culture, bool print) { NumberFormatInfo nfi = culture.NumberFormat; if (Output == null) { return; } bool first = true; foreach (Object obj in Output) { if (!first && !print) { file.Write(","); } else { first = false; } if (obj == null) { if (!print) { file.Write("#NULL#"); } continue; } if (obj is TabInfo) { file.Tab((TabInfo)obj); continue; } else if (obj is SpcInfo) { file.Space((SpcInfo)obj); continue; } else if (obj is char[]) { file.Write(new String((char[])obj)); continue; } else if (obj is ErrObject) { if (print) { file.Write(String.Format("Error {0}", ((ErrObject)obj).Number)); } else { file.Write(String.Format("#ERROR {0}#", ((ErrObject)obj).Number)); } continue; } switch (ObjectType.GetTypeCode(obj)) { case TypeCode.DBNull: { if (print) { file.Write("Null"); } else { file.Write("#NULL#"); } } break; case TypeCode.Boolean: { bool b = BooleanType.FromObject(obj); if (print) { file.Write(b.ToString(culture)); } else if (b) { file.Write("#TRUE#"); } else { file.Write("#FALSE#"); } } break; case TypeCode.Byte: { byte by = ByteType.FromObject(obj); file.Write(by.ToString(nfi)); } break; case TypeCode.Int16: { short s = ShortType.FromObject(obj); file.Write(s.ToString(nfi)); } break; case TypeCode.Int32: { int i = IntegerType.FromObject(obj); file.Write(i.ToString(nfi)); } break; case TypeCode.Int64: { long l = LongType.FromObject(obj); file.Write(l.ToString(nfi)); } break; case TypeCode.Single: { float f = SingleType.FromObject(obj, nfi); file.Write(f.ToString(nfi)); } break; case TypeCode.Double: { double d = DoubleType.FromObject(obj, nfi); file.Write(d.ToString(nfi)); } break; case TypeCode.Decimal: { Decimal dc = DecimalType.FromObject(obj, nfi); file.Write(dc.ToString(nfi)); } break; case TypeCode.DateTime: { DateTime dt = DateType.FromObject(obj); if (print) { file.Write(StringType.FromDate(dt) + " "); } else { String format; long dayTicks = dt.Ticks % TimeSpan.TicksPerDay; if (dt.Ticks == dayTicks) { format = "T"; } else if (dayTicks == 0) { format = "d"; } else { format = "F"; } file.Write(dt.ToString (format, culture.DateTimeFormat)); } } break; case TypeCode.String: { file.Write(StringType.FromObject(obj)); } break; default: { Utils.ThrowException(5); // ArgumentException. } break; } } }
private void cmbAceptar_Click(object sender, EventArgs e) { if (!this.dtpFechaDesde.Checked & this.dtpFechaHasta.Checked) { Interaction.MsgBox("Debe ingresar ambas fechas o ninguna", 0x10, "Operador"); this.dtpFechaDesde.Checked = true; } else if (this.dtpFechaDesde.Checked & !this.dtpFechaHasta.Checked) { Interaction.MsgBox("Debe ingresar ambas fechas o ninguna", 0x10, "Operador"); this.dtpFechaHasta.Checked = true; } else if (!this.rbPorProd.Checked & !this.rbPorGrupoProd.Checked) { Interaction.MsgBox("Debe seleccionar tipo", 0x10, "Operador"); this.rbPorProd.Focus(); } else { SqlDataAdapter adapter; DataRow row; string str; string str2; this.dtpFechaDesde.Enabled = false; this.dtpFechaHasta.Enabled = false; this.editNroOE.Enabled = false; this.editNroOV.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 = ""; } if (StringType.StrCmp(this.editNroOE.Text, Strings.Space(0), false) != 0) { Variables.gNroOE = Strings.Format(Conversion.Val(this.editNroOE.Text), "0000000000"); } else { Variables.gNroOE = ""; } if (StringType.StrCmp(this.editNroOV.Text, Strings.Space(0), false) != 0) { Variables.gNroOV = this.editNroOV.Text; } else { Variables.gNroOV = ""; } if (this.rbPorProd.Checked) { Variables.gTipoList = "1"; } else { Variables.gTipoList = "2"; } DataSet dataSet = new DataSet(); SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"); connection2.Open(); SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpRepGesEns", connection2); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } string connectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=True;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); string cmdText = "SELECT DISTINCT OR010100.OR01001,OR010100.OR01015,OR010100.OR01016,OR030100.OR03002,OR030100.OR03005,OR030100.OR03006,OR030100.OR03007,OR030100.OR03011,OR030100.OR03012,OR190100.OR19011,OR040100.OR04002,OR040100.OR04003,OR040100.OR04004,OR040100.OR04005,OR040100.OR04008 FROM dbo.OR010100 INNER JOIN dbo.OR030100 on OR010100.OR01001=OR030100.OR03001 LEFT OUTER JOIN dbo.OR040100 on OR010100.OR01001=OR040100.OR04001 LEFT OUTER JOIN dbo.OR190100 on OR030100.OR03001=OR190100.OR19001 and OR030100.OR03002=OR190100.OR19002 where OR010100.OR01002=6 and OR030100.OR03003='000' and OR190100.OR19003='000' "; if (this.dtpFechaDesde.Checked & this.dtpFechaHasta.Checked) { cmdText = cmdText + " and OR190100.OR19011>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and OR190100.OR19011<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } if (StringType.StrCmp(Variables.gNroOE, "", false) != 0) { cmdText = cmdText + " and OR010100.OR01001='" + Variables.gNroOE + "'"; } if (StringType.StrCmp(Variables.gNroOV, "", false) != 0) { cmdText = cmdText + " and rtrim(OR040100.OR04003)='" + Variables.gNroOV + "'"; } command = new SqlCommand(cmdText, connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { adapter = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("Select SC01128,SY24003 from SC010100 inner join SY240100 on SC01128=SY24002 where SC01001='", reader["OR03005"]), "' and SY24001='II'")), connectionString); dataSet.Clear(); adapter.Fill(dataSet, "SC010100"); if (dataSet.Tables["SC010100"].Rows.Count != 0) { row = dataSet.Tables["SC010100"].Rows[0]; str = StringType.FromObject(row["SC01128"]); str2 = StringType.FromObject(row["SY24003"]); } else { str = ""; str2 = ""; } cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRepGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,Grupo,NomGrupo,CantOE,CantArmado,Cliente,NroOV,Obs) values ('", reader["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',")); if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OR19011"]))) { cmdText = cmdText + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR19011"]), "MM/dd/yyyy") + "',"; } else { cmdText = cmdText + "Null,"; } cmdText = 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(cmdText + "'", reader["OR03002"]), "','"), reader["OR03005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR03006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR03007"]))), "','"), str), "','"), str2), "',"), ObjectType.MulObj(reader["OR03011"], -1)), ","), ObjectType.MulObj(reader["OR03012"], -1)), ",")); if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04002"])), "0", false) == 0) { cmdText = cmdText + "'',"; } else { cmdText = cmdText + "'" + Strings.Trim(StringType.FromObject(reader["OR04002"])) + "',"; } if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR04003"])), "0", false) == 0) { cmdText = cmdText + "'','')"; } else { cmdText = cmdText + "'" + Strings.Format(Conversion.Val(Strings.Mid(StringType.FromObject(reader["OR04003"]), 1, 10)), "0000000000") + "','')"; } command = new SqlCommand(cmdText, connection2); try { command.ExecuteNonQuery(); } catch (Exception exception4) { ProjectData.SetProjectError(exception4); Exception exception2 = exception4; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, 0, null); reader.Close(); connection.Close(); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } reader.Close(); cmdText = "SELECT DISTINCT OR200100.OR20001,OR200100.OR20015,OR200100.OR20016,OR210100.OR21002,OR210100.OR21005,OR210100.OR21006,OR210100.OR21007,OR210100.OR21011,OR210100.OR21012,OR230100.OR23011,OR220100.OR22002,OR220100.OR22003,OR220100.OR22004,OR220100.OR22005,OR220100.OR22008 FROM dbo.OR200100 INNER JOIN dbo.OR210100 on OR200100.OR20001=OR210100.OR21001 LEFT OUTER JOIN dbo.OR220100 on OR200100.OR20001=OR220100.OR22001 LEFT OUTER JOIN dbo.OR230100 on OR210100.OR21001=OR230100.OR23001 and OR210100.OR21002=OR230100.OR23002 and OR210100.OR21065=OR230100.OR23034 where OR200100.OR20002=6 and OR210100.OR21003='000' and OR230100.OR23003='000' "; if (this.dtpFechaDesde.Checked & this.dtpFechaHasta.Checked) { cmdText = cmdText + " and OR230100.OR23011>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and OR230100.OR23011<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } if (StringType.StrCmp(Variables.gNroOE, "", false) != 0) { cmdText = cmdText + " and OR200100.OR20001='" + Variables.gNroOE + "'"; } if (StringType.StrCmp(Variables.gNroOV, "", false) != 0) { cmdText = cmdText + " and rtrim(OR220100.OR22003)='" + Variables.gNroOV + "'"; } command = new SqlCommand(cmdText, connection); command.CommandTimeout = 500; reader = command.ExecuteReader(); while (reader.Read()) { adapter = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("Select SC01128,SY24003 from SC010100 inner join SY240100 on SC01128=SY24002 where SC01001='", reader["OR21005"]), "' and SY24001='II'")), connectionString); dataSet.Clear(); adapter.Fill(dataSet, "SC010100"); if (dataSet.Tables["SC010100"].Rows.Count != 0) { row = dataSet.Tables["SC010100"].Rows[0]; str = StringType.FromObject(row["SC01128"]); str2 = StringType.FromObject(row["SY24003"]); } else { str = ""; str2 = ""; } cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpRepGesEns (NroOE,FechaOE,FechaEnt,FechaEnsReal,NroLinea,Codigo,Descripcion,Grupo,NomGrupo,CantOE,CantArmado,Cliente,NroOV,Obs) values ('", reader["OR20001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR20015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR20016"]), "MM/dd/yyyy")), "',")); if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OR23011"]))) { cmdText = cmdText + "'" + Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR23011"]), "MM/dd/yyyy") + "',"; } else { cmdText = cmdText + "Null,"; } cmdText = 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(cmdText + "'", reader["OR21002"]), "','"), reader["OR21005"]), "','"), Strings.Trim(StringType.FromObject(reader["OR21006"]))), " "), Strings.Trim(StringType.FromObject(reader["OR21007"]))), "','"), str), "','"), str2), "',"), ObjectType.MulObj(reader["OR21011"], -1)), ","), ObjectType.MulObj(reader["OR21012"], -1)), ",")); if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22002"])), "0", false) == 0) { cmdText = cmdText + "'',"; } else { cmdText = cmdText + "'" + Strings.Trim(StringType.FromObject(reader["OR22002"])) + "',"; } if (StringType.StrCmp(Strings.Trim(StringType.FromObject(reader["OR22003"])), "0", false) == 0) { cmdText = cmdText + "'','')"; } else { cmdText = cmdText + "'" + Strings.Format(Conversion.Val(Strings.Mid(StringType.FromObject(reader["OR22003"]), 1, 10)), "0000000000") + "','')"; } command = new SqlCommand(cmdText, connection2); try { command.ExecuteNonQuery(); } catch (Exception exception5) { ProjectData.SetProjectError(exception5); Exception exception3 = exception5; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, 0, null); reader.Close(); connection.Close(); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } reader.Close(); connection2.Close(); connection.Close(); frmRepEnsXFecha1 fecha = new frmRepEnsXFecha1(); this.Hide(); fecha.Show(); } }
private void cmbAceptar_Click(object sender, EventArgs e) { if (!this.dtpDesde.Checked & this.dtpHasta.Checked) { Interaction.MsgBox("Debe ingresar ambas fechas o ninguna", 0x10, "Operador"); this.dtpDesde.Checked = true; } else if (this.dtpDesde.Checked & !this.dtpHasta.Checked) { Interaction.MsgBox("Debe ingresar ambas fechas o ninguna", 0x10, "Operador"); this.dtpHasta.Checked = true; } else { this.dtpDesde.Enabled = false; this.dtpHasta.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; if (this.dtpDesde.Checked) { Variables.gDesde = StringType.FromDate(this.dtpDesde.Value); } else { Variables.gDesde = ""; } if (this.dtpHasta.Checked) { Variables.gHasta = StringType.FromDate(this.dtpHasta.Value); } else { Variables.gHasta = ""; } if (StringType.StrCmp(this.cbAlmacen1.Text, Strings.Space(0), false) != 0) { Variables.gAlmacen1 = this.cbAlmacen1.Text; } else { Variables.gAlmacen1 = ""; } if (StringType.StrCmp(this.cbAlmacen2.Text, Strings.Space(0), false) != 0) { Variables.gAlmacen2 = this.cbAlmacen2.Text; } else { Variables.gAlmacen2 = ""; } if (this.rbNroOC.Checked) { Variables.gOrdenList = 1; } else { Variables.gOrdenList = 2; } if (StringType.StrCmp(this.editCodProd.Text, Strings.Space(0), false) != 0) { Variables.gCodProd = this.editCodProd.Text; } else { Variables.gCodProd = ""; } frmRepOCPend1 pend = new frmRepOCPend1(); this.Hide(); pend.Show(); } }