public frmDifOCProv1() { base.Closed += new EventHandler(this.frmDifOCProv1_Closed); base.Load += new EventHandler(this.frmDifOCProv1_Load); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; string selectCommandText = "Select * from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty"; this.AdapOCPend = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapOCPend.Fill(this.DS, "detdes"); selectCommandText = "Select * from hdrdes where packlist in (Select packlist from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty)"; this.AdapHdrdes = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapHdrdes.Fill(this.DS, "hdrdes"); selectCommandText = "Select SC01001,SC01002,SC01003 from SC010100"; this.AdapProd = new SqlDataAdapter(selectCommandText, str3); this.AdapProd.Fill(this.DS, "SC010100"); this.Informe.Load(Application.StartupPath + @"\repdifocprov.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaexp"]; definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["hastafechaexp"]; definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; this.CrystalReportViewer1.ReportSource = this.Informe; }
public frmRepEnsXFecha1() { base.Closed += new EventHandler(this.frmRepEnsXFecha1_Closed); base.Load += new EventHandler(this.frmRepEnsXFecha1_Load); base.Click += new EventHandler(this.frmRepEnsXFecha1_Click); base.Leave += new EventHandler(this.frmRepEnsXFecha1_Leave); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PC1TmpRepGesEns"); if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0) { this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); } else { this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); } FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { this.cmbSalir.Enabled = false; this.Informe.Close(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; string selectCommandText = "Select * from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty"; this.AdapOCPend = new SqlDataAdapter(selectCommandText, selectConnectionString); this.DS.Clear(); this.AdapOCPend.Fill(this.DS, "detdes"); selectCommandText = "Select * from hdrdes where packlist in (Select packlist from detdes where datexp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and datexp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "' and expqty<>cntqty)"; this.AdapHdrdes = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapHdrdes.Fill(this.DS, "hdrdes"); selectCommandText = "Select SC01001,SC01002,SC01003 from SC010100"; this.AdapProd = new SqlDataAdapter(selectCommandText, str3); this.AdapProd.Fill(this.DS, "SC010100"); this.Informe.Load(Application.StartupPath + @"\repdifocprov.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaexp"]; definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["hastafechaexp"]; definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { this.cmbSalir.Enabled = false; this.Informe.Close(); SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); string str3 = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null"; if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))) { if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)) { str3 = str3 + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str3 = str3 + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str3 = (str3 + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } } SqlCommand command = new SqlCommand(str3 + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy HH:mm:ss") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy HH:mm:ss") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Zoom(1); this.cmbSalir.Enabled = true; }
public Enrollment EnrollStudent(EnrollStudentRequest request) { using (var db = new s18838Context()) { if (request.Studies == null || request.BirthDate == null || request.FirstName == null || request.IndexNumber == null || request.LastName == null) { throw new Exception(); } using (var transaction = db.Database.BeginTransaction()) { var study = GetStudies(request.Studies); if (study == null) { transaction.Rollback(); throw new Exception(); } Enrollment enrollment = GetLastEnrollmentForStudy(study.IdStudy); if (enrollment == null) { enrollment = new Enrollment() { Semester = 1, IdStudy = study.IdStudy, StartDate = DateType.FromString(DateTime.Now.ToString("MM.dd.yyyy")) }; SaveEnrollment(db, enrollment); } if (CheckIfStudentExists(request.IndexNumber)) { transaction.Rollback(); throw new Exception(); } var student = new Student() { IndexNumber = request.IndexNumber, FirstName = request.FirstName, LastName = request.LastName, BirthDate = DateType.FromString(request.BirthDate), IdEnrollment = IntegerType.FromObject(enrollment.IdEnrollment) }; SaveStudent(db, student); transaction.Commit(); return(enrollment); } } }
public frmRepRegPedExp1() { base.Closed += new EventHandler(this.frmRepRegPedExp1_Closed); base.Load += new EventHandler(this.frmRepRegPedExp1_Load); base.Click += new EventHandler(this.frmRepRegPedExp1_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); SqlCommand command = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRegPedExp as PC1TmpRegPedExp", connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpRegPedExp"); this.Informe.Load(Application.StartupPath + @"\repregpedexp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefechaent"); if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaent"); if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); ProjectData.ClearProjectError(); } }
public Models_Zadanie10.Enrollment EnrollStudent(EnrollStudentReq req) { using (var db = new s18734Context()) { using (var transaction = db.Database.BeginTransaction()) { var study = DoStudiesExist(req.Studies); if (study == null) { transaction.Rollback(); throw new Exception("Studia nie istnieja"); } Models_Zadanie10.Enrollment enrollment = GetEnrollment(study.IdStudy); if (enrollment == null) { enrollment = new Models_Zadanie10.Enrollment() { Semester = 1, IdStudy = study.IdStudy, StartDate = DateType.FromString(DateTime.Now.ToString("MM.dd.yyyy")) }; db.Enrollment.Add(enrollment); db.SaveChanges(); } if (checkIfStudentExist(req.IndexNumber)) { transaction.Rollback(); throw new Exception(); } var stud = new Models_Zadanie10.Student { IndexNumber = req.IndexNumber, FirstName = req.FirstName, LastName = req.LastName, BirthDate = DateType.FromString(req.BirthDate), IdEnrollment = IntegerType.FromObject(enrollment.IdEnrollment) }; db.Student.Add(stud); db.SaveChanges(); transaction.Commit(); return(enrollment); } } }
public static bool IsDate(Object VarName) { if(VarName is DateTime) { return true; } else if(VarName is String) { try { DateType.FromString((String)VarName); return true; } catch(Exception) { return false; } } else { return false; } }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); 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 + "TmpOVPend", connection2); int num2 = command4.ExecuteNonQuery(); string cmdText = "SELECT SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,sum(SC03003) as SC03003,sum(SC03004+SC03005) as StkComp,OR010100.OR01079 FROM dbo.SL010100,dbo.OR010100,dbo.OR030100,dbo.SC030100 where OR010100.OR01002<>6 and OR03011-OR03012<>0 "; if (StringType.StrCmp(Variables.gAlmacen1, "01", false) == 0) { cmdText = cmdText + "and SC03002='01' and OR01050='01'"; } else { cmdText = cmdText + "and SC03002='02' and OR01050='02'"; } if ((StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0)) { cmdText = cmdText + " and OR01015>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "MM/dd/yyyy") + "' and OR01015<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "MM/dd/yyyy") + "'"; } if ((StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0)) { cmdText = cmdText + " and OR01016>='" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "MM/dd/yyyy") + "' and OR01016<='" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "MM/dd/yyyy") + "'"; } if (StringType.StrCmp(Variables.gCodCli, Strings.Space(0), false) != 0) { cmdText = cmdText + " and OR01004='" + Variables.gCodCli + "'"; } cmdText = cmdText + " and OR01001=OR03001 and OR01004=SL01001 and OR03005=SC03001" + " group by SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,OR010100.OR01079"; SqlCommand command2 = new SqlCommand(cmdText, connection); command2.CommandTimeout = 500; SqlDataAdapter adapter3 = new SqlDataAdapter(); adapter3.SelectCommand = command2; connection.Open(); adapter3.Fill(dataSet, "SC030100"); long num3 = dataSet.Tables["SC030100"].Rows.Count - 1; for (long i = 0L; i <= num3; i += 1L) { SqlDataReader reader; string str4; DataRow row = dataSet.Tables["SC030100"].Rows[(int)i]; if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) > 0) { cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row["OR03005"]), "' and PC03043<PC03044 and PC03029=1 ")); if (StringType.StrCmp(Variables.gAlmacen1, "01", false) == 0) { cmdText = cmdText + "and PC03035='01' order by PC03016"; } else { cmdText = cmdText + "and PC03035='02' order by PC03016"; } SqlCommand command = new SqlCommand(cmdText, 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ",'"), row["OR01079"]), "')")); 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } } else if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) == 0) { cmdText = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR010100.OR01016,OR030100.OR03011,OR030100.OR03012 FROM dbo.OR030100,OR010100 where OR03005='", row["OR03005"]), "' and OR03012<OR03011 and OR01002=6 and OR03001=OR01001 order by OR01016")); reader = new SqlCommand(cmdText, 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["OR03011"], reader["OR03012"])), ",'"), row["OR01079"]), "')")); 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } } 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), 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.Close(); ProjectData.ClearProjectError(); } } connection.Close(); connection2.Close(); try { FormulaFieldDefinition definition6; connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); if (Variables.gOVaListar == 1) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend"; } else if (Variables.gOVaListar == 2) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))"; } else if (Variables.gOVaListar == 3) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1"; } else if (Variables.gOVaListar == 4) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1"; } else if (Variables.gOVaListar == 5) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)"; } else if (Variables.gOVaListar == 6) { cmdText = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)"; } command2 = new SqlCommand(cmdText, connection); command2.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command2; dataSet.Clear(); this.AdapOR01.Fill(dataSet, "PC1TmpOVPend"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovpend.rpt"); } else if (Variables.gOrdenList == 3) { this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt"); } this.Informe.SetDataSource(dataSet); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaov"]; if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafechaov"]; if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } FormulaFieldDefinition definition3 = formulaFields["desdefechaent"]; if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition3.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"; } else { definition3.Text = "''"; } FormulaFieldDefinition definition4 = formulaFields["hastafechaent"]; if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition4.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"; } else { definition4.Text = "''"; } FormulaFieldDefinition definition5 = formulaFields["tipo"]; definition5.Text = "'" + Variables.gTipoList + "'"; if (Variables.gOrdenList == 1) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Entrega Prevista'"; } else if (Variables.gOrdenList == 2) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por N\x00b0 de Cliente'"; } else if (Variables.gOrdenList == 3) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Orden de Venta'"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; } catch (Exception exception3) { ProjectData.SetProjectError(exception3); Exception exception2 = exception3; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
// Extract the time portion of a value. public static DateTime TimeValue(String StringTime) { long ticks = (DateType.FromString(StringTime)).Ticks; return(new DateTime(ticks % TimeSpan.TicksPerDay)); }
// Convert a string into a date value. public static DateTime DateValue(String StringDate) { return((DateType.FromString(StringDate)).Date); }
public void FromString_ThrowsOverflowException(string value) { Assert.Throws <OverflowException>(() => DateType.FromString(value)); }
public void FromString_ThrowsInvalidCastException(string value) { Assert.Throws <InvalidCastException>(() => DateType.FromString(value)); }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { SqlDataAdapter adapter3; SqlCommand command; DataRow row; DataRow row2; long num; long num2; SqlDataReader reader; int num3; SqlCommand command3; SqlCommand command5; string str5; DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); string connectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); string str9 = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; SqlConnection connection2 = new SqlConnection(str9); connection2.Open(); if ((Variables.gCodEstado == 1) | (Variables.gCodEstado == 4)) { command5 = new SqlCommand("delete " + Variables.gTermi + "TmpOVPend", connection2); num3 = command5.ExecuteNonQuery(); string str = "SELECT SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,sum(SC03003) as SC03003,sum(SC03004+SC03005) as StkComp,OR010100.OR01079 FROM dbo.SL010100,dbo.OR010100,dbo.OR030100,dbo.SC030100 where OR010100.OR01002<>6 and OR03011-OR03012<>0 "; command3 = new SqlCommand(((str + "and SC03002='01' and OR01050='01'") + " and OR01001='" + Variables.gNroOV + "'") + " and OR01001=OR03001 and OR01004=SL01001 and OR03005=SC03001" + " group by SL01001,SL01002,SL01060,SL01075,OR01001,OR01015,OR01016,OR01091,OR01018,OR01072,OR03005,OR03006,OR03007,OR03011,OR03012,OR010100.OR01079", connection); command3.CommandTimeout = 500; SqlDataAdapter adapter5 = new SqlDataAdapter(); adapter5.SelectCommand = command3; connection.Open(); adapter5.Fill(dataSet, "SC030100"); long num10 = dataSet.Tables["SC030100"].Rows.Count - 1; for (num = 0L; num <= num10; num += 1L) { row = dataSet.Tables["SC030100"].Rows[(int)num]; if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) > 0) { command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row["OR03005"]), "' and PC03043<PC03044 and PC03029=1 ")) + "and PC03035='01' order by PC03016", connection); reader = command.ExecuteReader(); if (reader.Read()) { str5 = 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ",'"), row["OR01079"]), "')")); reader.Close(); command5 = new SqlCommand(str5, connection2); } else { reader.Close(); command5 = 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } } else if (ObjectType.ObjTst(row["StkComp"], row["SC03003"], false) == 0) { command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR010100.OR01016,OR030100.OR03011,OR030100.OR03012 FROM dbo.OR030100,OR010100 where OR03005='", row["OR03005"]), "' and OR03012<OR03011 and OR01002=6 and OR03001=OR01001 order by OR01016")), connection); reader = command.ExecuteReader(); if (reader.Read()) { str5 = 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,FechaOC,CantOC,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["OR01016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["OR03011"], reader["OR03012"])), ",'"), row["OR01079"]), "')")); reader.Close(); command5 = new SqlCommand(str5, connection2); } else { reader.Close(); command5 = 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } } else { command5 = 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(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 + "TmpOVPend (Cliente,NomCli,EntBloq,ExcLimCre,NroOV,FechaOV,FechaEnt,Reserva,RefCli,OCompra,CodProd,Desc1,Desc2,Cantidad,StockFisico,StockComp,EntParc) values ('", row["SL01001"]), "','"), row["SL01002"]), "','"), row["SL01060"]), "','"), row["SL01075"]), "','"), row["OR01001"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01015"]), "MM/dd/yyyy")), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["OR01016"]), "MM/dd/yyyy")), "',"), row["OR01091"]), ",'"), row["OR01018"]), "','"), row["OR01072"]), "','"), row["OR03005"]), "','"), row["OR03006"]), "','"), row["OR03007"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","), row["SC03003"]), ","), row["StkComp"]), ",'"), row["OR01079"]), "')")), connection2); } try { num3 = command5.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); } } connection.Close(); connection2.Close(); try { connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; connection = new SqlConnection(connectionString); connection.Open(); command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend", connection); command3.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command3; dataSet.Clear(); this.AdapOR01.Fill(dataSet, "PC1TmpOVPend"); this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendEnt.rpt"); this.Informe.SetDataSource(dataSet); connection.Close(); FormulaFieldDefinition definition = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo"); if (Variables.gCodEstado == 1) { definition.set_Text("'Consulta Ordenes de Venta - Estado Pendiente de Entrega'"); } else { definition.set_Text("'Consulta Ordenes de Venta - Estado Preparado pend.imp.doc.exp.'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; } catch (Exception exception7) { ProjectData.SetProjectError(exception7); Exception exception2 = exception7; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, 0, null); ProjectData.ClearProjectError(); } } if (Variables.gCodEstado == 2) { if (Variables.gCodEstado == 2) { SqlCommand command2; SqlDataAdapter adapter2 = new SqlDataAdapter("select * from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and NroRemito is null", str9); adapter2.Fill(dataSet, "PrepPed"); if (dataSet.Tables["PrepPed"].Rows.Count != 0) { long num9 = dataSet.Tables["PrepPed"].Rows.Count - 1; for (num = 0L; num <= num9; num += 1L) { row = dataSet.Tables["PrepPed"].Rows[(int)num]; adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR19012 from OR190100 where OR19001='", row["NroOV"]), "' and OR19002='"), row["NroLinea"]), "' and OR19003='"), row["EstLinea"]), "' and OR19011='"), Strings.Format(RuntimeHelpers.GetObjectValue(row["FechaPrep"]), "MM/dd/yyyy")), "' and OR19012<>'' order by OR19012")), connectionString); this.DS19.Clear(); adapter3.Fill(this.DS19, "OR190100"); if (this.DS19.Tables["OR190100"].Rows.Count != 0) { long num8 = this.DS19.Tables["OR190100"].Rows.Count - 1; num2 = 0L; while (num2 <= num8) { row2 = this.DS19.Tables["OR190100"].Rows[(int)num2]; command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("Select NroRemito from PrepPed where NroOV='", row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and EstLinea='"), row["EstLinea"]), "' and NroRemito='"), row2["OR19012"]), "'")), connection2); reader = command.ExecuteReader(); if (reader.Read()) { reader.Close(); } else { reader.Close(); try { command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set NroRemito='", row2["OR19012"]), "' where NroOV='"), row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito is null")), connection2); num3 = command2.ExecuteNonQuery(); } catch (Exception exception8) { ProjectData.SetProjectError(exception8); Exception exception3 = exception8; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, 0, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); } goto Label_167A; } num2 += 1L; } } else { adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR23012 from OR230100 where OR23001='", row["NroOV"]), "' and OR23002='"), row["NroLinea"]), "' and OR23003='"), row["EstLinea"]), "' and OR23011='"), Strings.Format(RuntimeHelpers.GetObjectValue(row["FechaPrep"]), "MM/dd/yyyy")), "' and OR23012<>'' order by OR23012")), connectionString); this.DS20.Clear(); adapter3.Fill(this.DS20, "OR230100"); if (this.DS20.Tables["OR230100"].Rows.Count != 0) { long num7 = this.DS20.Tables["OR230100"].Rows.Count - 1; num2 = 0L; while (num2 <= num7) { row2 = this.DS20.Tables["OR230100"].Rows[(int)num2]; 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("Select NroRemito from PrepPed where NroOV='", row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito='"), row2["OR23012"]), "'")), connection2); reader = command.ExecuteReader(); if (reader.Read()) { reader.Close(); } else { reader.Close(); try { command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set NroRemito='", row2["OR23012"]), "' where NroOV='"), row["NroOV"]), "' and NroLinea='"), row["NroLinea"]), "' and TipoLinea="), row["TipoLinea"]), " and EstLinea='"), row["EstLinea"]), "' and NroRemito is null")), connection2); num3 = command2.ExecuteNonQuery(); } catch (Exception exception9) { ProjectData.SetProjectError(exception9); Exception exception4 = exception9; Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, 0, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); } goto Label_167A; } num2 += 1L; } } } Label_167A :; } } new SqlDataAdapter("select NroOV from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and Producto=0 group by NroOV", str9).Fill(dataSet, "PrepPed"); if (dataSet.Tables["PrepPed"].Rows.Count != 0) { long num6 = dataSet.Tables["PrepPed"].Rows.Count - 1; for (num = 0L; num <= num6; num += 1L) { row = dataSet.Tables["PrepPed"].Rows[(int)num]; adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR01015,OR01072 from OR010100 where OR01001='", row["NroOV"]), "'")), connectionString); this.DS19.Clear(); adapter3.Fill(this.DS19, "OR190100"); if (this.DS19.Tables["OR190100"].Rows.Count != 0) { row2 = this.DS19.Tables["OR190100"].Rows[0]; try { command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set OCompra='", row2["OR01072"]), "',FechaOV='"), Strings.Format(RuntimeHelpers.GetObjectValue(row2["OR01015"]), "MM/dd/yyyy")), "' where NroOV='"), row["NroOV"]), "'")), connection2); num3 = command2.ExecuteNonQuery(); } catch (Exception exception10) { ProjectData.SetProjectError(exception10); Exception exception5 = exception10; Interaction.MsgBox("Se ha producido el siguiente error:" + exception5.Message, 0, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); } } else { adapter3 = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select OR20015,OR20072 from OR200100 where OR20001='", row["NroOV"]), "'")), connectionString); this.DS20.Clear(); adapter3.Fill(this.DS20, "OR230100"); if (this.DS20.Tables["OR230100"].Rows.Count != 0) { row2 = this.DS20.Tables["OR230100"].Rows[0]; try { num3 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("update PrepPed set OCompra='", row2["OR20072"]), "',FechaOV='"), Strings.Format(RuntimeHelpers.GetObjectValue(row2["OR20015"]), "MM/dd/yyyy")), "' where NroOV='"), row["NroOV"]), "'")), connection2).ExecuteNonQuery(); } catch (Exception exception11) { ProjectData.SetProjectError(exception11); Exception exception6 = exception11; Interaction.MsgBox("Se ha producido el siguiente error:" + exception6.Message, 0, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); } } } } } } connection.Close(); connection2.Close(); this.AdapProdPend = new SqlDataAdapter("Select NroOV,NroLinea,EstLinea,Codigo,Desc1,Desc2,CantOrden,CantPrep,FechaPrep,NroRemito,Cliente,NomCli,OCompra,FechaOV from PrepPed where NroOV='" + Variables.gNroOV + "' and Expedicion='N' and Producto=0", connectionString); this.AdapProdPend.Fill(dataSet, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\ConsultaOVPendExp.rpt"); this.Informe.SetDataSource(dataSet); this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; } if ((Variables.gCodEstado == 3) | (Variables.gCodEstado == 5)) { command5 = new SqlCommand("delete " + Variables.gTermi + "TmpOVExped", connection2); num3 = command5.ExecuteNonQuery(); reader = new SqlCommand("Select Fecha from RecConfCliOV where NroOV='" + Variables.gNroOV + "'", connection2).ExecuteReader(); if (reader.Read()) { Variables.gFechaRecConfCli = StringType.FromObject(reader["Fecha"]); reader.Close(); } else { Variables.gFechaRecConfCli = ""; reader.Close(); } adapter3 = new SqlDataAdapter("select OR19012,OR19034,OR01057,OR01058,OR01059,OR01060,OR03005,OR03006,OR03007,OR19030 from OR190100,OR010100,OR030100 where OR19001=OR01001 and OR19001=OR03001 AND OR19002=OR03002 AND OR19003=OR03003 and OR19001='" + Variables.gNroOV + "' and OR01002='" + StringType.FromInteger(Variables.gTipoOV) + "' and OR19011='" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy") + "' and OR19012<>''", connectionString); this.DS19.Clear(); adapter3.Fill(this.DS19, "OR190100"); if (this.DS19.Tables["OR190100"].Rows.Count != 0) { long num5 = this.DS19.Tables["OR190100"].Rows.Count - 1; for (num2 = 0L; num2 <= num5; num2 += 1L) { row2 = this.DS19.Tables["OR190100"].Rows[(int)num2]; str5 = ((((((((("insert into " + Variables.gTermi + "TmpOVExped (NroOV,TipoOV,Cliente,NomCli,OCompra,CodMetEnt,DescMetEnt,LugarEnt,FechaOV,FechaEnt,FechaPrep,FechaExp,FechaRecConfCli,NroRemito,NroFactura,PesoNeto,PesoBruto,Volumen,Bultos,CodProd,Desc1,Desc2,Cantidad) values ('" + Variables.gNroOV + "'," + StringType.FromInteger(Variables.gTipoOV)) + ",'" + Variables.gCliente) + "','" + Variables.gNomCli) + "','" + Variables.gNroOC + "'," + Variables.gCodMetEnt) + ",'" + Variables.gDescMetEnt) + "','" + Variables.gLugarEnt) + "','" + Strings.Format(Variables.gFechaOV, "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaEntOV), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaExp), "MM/dd/yyyy") + "',"; if (StringType.StrCmp(Variables.gFechaRecConfCli, Strings.Space(0), false) != 0) { str5 = str5 + "'" + Strings.Format(DateType.FromString(Variables.gFechaRecConfCli), "MM/dd/yyyy") + "',"; } else { str5 = str5 + "Null,"; } str5 = 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(str5 + "'", row2["OR19012"]), "','"), row2["OR19034"]), "',"), row2["OR01057"]), ","), row2["OR01058"]), ","), row2["OR01059"]), ","), row2["OR01060"]), ",'"), row2["OR03005"]), "','"), row2["OR03006"]), "','"), row2["OR03007"]), "',"), row2["OR19030"]), ")")); reader.Close(); command5 = new SqlCommand(str5, connection2); num3 = command5.ExecuteNonQuery(); } } else { adapter3 = new SqlDataAdapter("select OR23012,OR23034,OR20057,OR20058,OR20059,OR20060,OR21005,OR21006,OR21007,OR23030 from OR230100,OR200100,OR210100 where OR23001=OR20001 and OR23001=OR21001 AND OR23002=OR21002 AND OR23003=OR21003 and OR23001='" + Variables.gNroOV + "' and OR20002='" + StringType.FromInteger(Variables.gTipoOV) + "' and OR23011='" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy") + "' and OR23012<>''", connectionString); this.DS20.Clear(); adapter3.Fill(this.DS20, "OR200100"); if (this.DS20.Tables["OR200100"].Rows.Count != 0) { long num4 = this.DS20.Tables["OR200100"].Rows.Count - 1; for (num2 = 0L; num2 <= num4; num2 += 1L) { row2 = this.DS20.Tables["OR200100"].Rows[(int)num2]; str5 = ((((((((("insert into " + Variables.gTermi + "TmpOVExped (NroOV,TipoOV,Cliente,NomCli,OCompra,CodMetEnt,DescMetEnt,LugarEnt,FechaOV,FechaEnt,FechaPrep,FechaExp,FechaRecConfCli,NroRemito,NroFactura,PesoNeto,PesoBruto,Volumen,Bultos,CodProd,Desc1,Desc2,Cantidad) values ('" + Variables.gNroOV + "'," + StringType.FromInteger(Variables.gTipoOV)) + ",'" + Variables.gCliente) + "','" + Variables.gNomCli) + "','" + Variables.gNroOC + "'," + Variables.gCodMetEnt) + ",'" + Variables.gDescMetEnt) + "','" + Variables.gLugarEnt) + "','" + Strings.Format(Variables.gFechaOV, "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaEntOV), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaPrep), "MM/dd/yyyy")) + "','" + Strings.Format(DateType.FromString(Variables.gFechaExp), "MM/dd/yyyy") + "',"; if (StringType.StrCmp(Variables.gFechaRecConfCli, Strings.Space(0), false) != 0) { str5 = str5 + "'" + Strings.Format(DateType.FromString(Variables.gFechaRecConfCli), "MM/dd/yyyy") + "',"; } else { str5 = str5 + "Null,"; } str5 = 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(str5 + "'", row2["OR23012"]), "','"), row2["OR23034"]), "',"), row2["OR20057"]), ","), row2["OR20058"]), ","), row2["OR20059"]), ","), row2["OR20060"]), ",'"), row2["OR21005"]), "','"), row2["OR21006"]), "','"), row2["OR21007"]), "',"), row2["OR23030"]), ")")); reader.Close(); num3 = new SqlCommand(str5, connection2).ExecuteNonQuery(); } } } connection.Close(); connection2.Close(); command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpOVExped as PC1TmpOVExped", connection); command3.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command3; dataSet.Clear(); this.AdapOR01.Fill(dataSet, "PC1TmpOVExped"); this.Informe.Load(Application.StartupPath + @"\ConsultaOVExped.rpt"); this.Informe.SetDataSource(dataSet); connection.Close(); FormulaFieldDefinition definition2 = this.Informe.get_DataDefinition().get_FormulaFields().get_Item("Titulo"); if (Variables.gCodEstado == 3) { definition2.set_Text("'Consulta Ordenes de Venta - Estado Expedido'"); } else { definition2.set_Text("'Consulta Ordenes de Venta - Estado Recepci\x00f3n Conformada'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; } }
public frmRepInvFis1() { base.Closed += new EventHandler(this.frmRepInvFis1_Closed); this.DS = new DataSet(); this.DS1 = new DataSet(); this.DSTmp = new DataSet(); this.Informe = new ReportDocument(); this.InitializeComponent(); string selectConnectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"; string selectCommandText = "select * from Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "'"; if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) != 0) { selectCommandText = selectCommandText + " and Operador='" + Variables.gOperario + "'"; } if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) != 0)) { selectCommandText = selectCommandText + " and Codigo>='" + Variables.gCodProdDesde + "' and Codigo<='" + Variables.gCodProdHasta + "'"; } if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) != 0) { selectCommandText = selectCommandText + " and Fecha='" + Strings.Format(DateType.FromString(Variables.gFechaLec), "MM/dd/yyyy") + "'"; } this.AdapTmp = new SqlDataAdapter(selectCommandText, selectConnectionString); this.AdapTmp.Fill(this.DS, "Inventario"); this.Informe.Load(Application.StartupPath + @"\repinvfis.rpt"); this.Informe.SetDataSource(this.DS); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["fechainv"]; definition.Text = "'" + Strings.Format(Variables.gFechaInv, "dd/MM/yyyy") + "'"; FormulaFieldDefinition definition2 = formulaFields["operario"]; if (StringType.StrCmp(Variables.gOperario, Strings.Space(0), false) == 0) { definition2.Text = "'Todos los operarios'"; } else { definition2.Text = "'Operario: " + Variables.gOperario + "'"; } FormulaFieldDefinition definition3 = formulaFields["productos"]; if ((StringType.StrCmp(Variables.gCodProdDesde, Strings.Space(0), false) == 0) & (StringType.StrCmp(Variables.gCodProdHasta, Strings.Space(0), false) == 0)) { definition3.Text = "'Todos los productos'"; } else { definition3.Text = "'Desde Producto: " + Variables.gCodProdDesde + "-" + Strings.Trim(Variables.gDescProdDesde1) + " " + Strings.Trim(Variables.gDescProdDesde2) + " Hasta Producto: " + Variables.gCodProdHasta + "-" + Strings.Trim(Variables.gDescProdHasta1) + " " + Strings.Trim(Variables.gDescProdHasta2) + "'"; } FormulaFieldDefinition definition4 = formulaFields["fechalec"]; if (StringType.StrCmp(Variables.gFechaLec, Strings.Space(0), false) == 0) { definition4.Text = "'Todos las fechas de lectura'"; } else { definition4.Text = "'Fecha de Lectura: " + Strings.Format(DateType.FromString(Variables.gFechaLec), "dd/MM/yyyy") + "'"; } this.CrystalReportViewer1.ReportSource = this.Informe; }
public frmRepOCPend1() { string str; base.Closed += new EventHandler(this.frmRepOCPend1_Closed); base.Load += new EventHandler(this.frmRepOCPend1_Load); this.DS = new DataSet(); this.DS1 = new DataSet(); this.DSTmp = new DataSet(); this.Informe = new ReportDocument(); this.InitializeComponent(); bool flag = false; string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096"; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) == 0) { str = "Select PC03001,PC03002,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016 from PC030100 where PC03010-PC03011<>0 and PC03010<>0"; if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'"; if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'"; } } else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'"; } if (StringType.StrCmp(Variables.gCodProd, "", false) != 0) { str = str + " and PC03005='" + Variables.gCodProd + "'"; } str = str + " order by PC03001,PC03016,PC03002"; } else { str = "Select PC03001,PC03002,PC03005,PC03006,PC03007,PC03010,PC03011,PC03016 from PC030100 where PC03010-PC03011<>0 and PC03010<>0 and PC03016>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "' and PC03016<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0) { if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = (str + " and (PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'") + " or PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "')"; } else { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen1, 1, 2) + "'"; } } else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { str = str + " and PC03035='" + Strings.Mid(Variables.gAlmacen2, 1, 2) + "'"; } if (StringType.StrCmp(Variables.gCodProd, "", false) != 0) { str = str + " and PC03005='" + Variables.gCodProd + "'"; } str = str + " order by PC03001,PC03016,PC03002"; } this.DS.Clear(); this.AdapOCPend = new SqlDataAdapter(str, selectConnectionString); this.AdapOCPend.Fill(this.DS, "PC030100"); string str3 = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=edibar;persist security info=False;packet size=4096"; str = "Select distinct detdes.colnb,detdes.ordnb,detdes.lignb,detdes.datexp,detinv.invno,detinv.stamp,detinv.desqty,hdrdes.trind from detdes left outer join detinv on detdes.ordnb=detinv.purno and detdes.lignb=detinv.purlin inner join hdrdes on detdes.packlist=hdrdes.packlist where detdes.cntqty=0"; if (StringType.StrCmp(Variables.gCodProd, "", false) != 0) { str = str + " and detdes.itnbr='" + Variables.gCodProd + "'"; } this.AdapDetDes = new SqlDataAdapter(str, str3); this.DS1.Clear(); this.AdapDetDes.Fill(this.DS1, "detdes"); 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(); flag = true; SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpDetDes", connection); int num2 = command.ExecuteNonQuery(); int num3 = this.DS1.Tables["detdes"].Rows.Count - 1; for (int i = 0; i <= num3; i++) { DataRow row = this.DS1.Tables["detdes"].Rows[i]; str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into " + Variables.gTermi + "TmpDetDes (NroOC,NroLinea,NroBulto,PackList,FechaPL,NroFC,FechaFC,EnTransito) values ('" + Strings.Format(RuntimeHelpers.GetObjectValue(row["ordnb"]), "0000000000")) + "','" + Strings.Format(RuntimeHelpers.GetObjectValue(row["lignb"]), "000000")) + "','", row["colnb"]), "','"), row["trind"]), "','"), Strings.Format(RuntimeHelpers.GetObjectValue(row["datexp"]), "MM/dd/yyyy")), "',")); if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["invno"]))) { str = str + "'',"; } else { str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str + "'", row["invno"]), "',")); } if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["stamp"]))) { str = str + "'',"; } else { str = str + "'" + Strings.Format(DateType.FromString(Strings.Mid(StringType.FromObject(row["stamp"]), 1, 10)), "MM/dd/yyyy") + "',"; } if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["desqty"]))) { str = str + "0)"; } else { str = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str, row["desqty"]), ")")); } command = new SqlCommand(str, connection); try { command.ExecuteNonQuery(); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null); if (flag) { connection.Close(); flag = false; } ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } str = "select * from " + Variables.gTermi + "TmpDetDes as PC1TmpDetDes"; this.AdapTmp = new SqlDataAdapter(str, connectionString); this.AdapTmp.Fill(this.DS, "PC1TmpDetDes"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repocpend.rpt"); } else { this.Informe.Load(Application.StartupPath + @"\repocpend1.rpt"); } this.Informe.SetDataSource(this.DS); connection.Close(); flag = false; FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desde"); if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) == 0) { definition.set_Text("'" + Variables.gDesde + "'"); } else { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"); } FormulaFieldDefinition definition2 = definitions.get_Item("hasta"); if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) == 0) { definition2.set_Text("'" + Variables.gHasta + "'"); } else { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"); } FormulaFieldDefinition definition3 = definitions.get_Item("almacen"); if (StringType.StrCmp(Variables.gAlmacen1, Strings.Space(0), false) != 0) { if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { definition3.set_Text("'Almacenes: " + Strings.Trim(Variables.gAlmacen1) + "-" + Strings.Trim(Variables.gAlmacen2) + "'"); } else { definition3.set_Text("'Almacen: " + Strings.Trim(Variables.gAlmacen1) + "'"); } } else if (StringType.StrCmp(Variables.gAlmacen2, Strings.Space(0), false) != 0) { definition3.set_Text("'Almacen: " + Strings.Trim(Variables.gAlmacen2) + "'"); } else { definition3.set_Text("'Todos los almacenes'"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { DataRow row; long num; SqlDataReader reader; string str4; DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); 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 ((StringType.StrCmp(Variables.gDesdeFechaEnt, "", false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, "", false) != 0)) { 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, 0, null); connection.Close(); connection2.Close(); this.Close(); 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 ((StringType.StrCmp(Variables.gDesdeFechaEnt, "", false) != 0) & (StringType.StrCmp(Variables.gHastaFechaEnt, "", false) != 0)) { 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 exception4) { ProjectData.SetProjectError(exception4); Exception exception2 = exception4; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, 0, null); connection.Close(); connection2.Close(); this.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } connection.Close(); connection2.Close(); try { connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); command2 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRegPedExp as PC1TmpRegPedExp", connection); command2.CommandTimeout = 500; adapter = new SqlDataAdapter(); adapter.SelectCommand = command2; dataSet.Clear(); adapter.Fill(dataSet, "PC1TmpRegPedExp"); this.Informe.Load(Application.StartupPath + @"\repregpedexp.rpt"); this.Informe.SetDataSource(dataSet); connection.Close(); FormulaFieldDefinitions definitions = this.Informe.get_DataDefinition().get_FormulaFields(); FormulaFieldDefinition definition = definitions.get_Item("desdefechaent"); if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition.set_Text("'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"); } else { definition.set_Text("''"); } FormulaFieldDefinition definition2 = definitions.get_Item("hastafechaent"); if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition2.set_Text("'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"); } else { definition2.set_Text("''"); } this.CrystalReportViewer1.set_ReportSource(this.Informe); this.CrystalReportViewer1.Refresh(); this.cmbSalir.Enabled = true; } catch (Exception exception5) { ProjectData.SetProjectError(exception5); Exception exception3 = exception5; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, 0, null); ProjectData.ClearProjectError(); } }
private void ActTmp() { DataSet dataSet = new DataSet(); DataSet set2 = new DataSet(); this.cmbAceptar.Enabled = false; this.cmbSalir.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 num16 = new SqlCommand("delete " + Variables.gTermi + "TmpOCompra", connection2).ExecuteNonQuery(); num16 = new SqlCommand("delete " + Variables.gTermi + "TmpOCGen", connection2).ExecuteNonQuery(); SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpCodReemp", connection2); num16 = command4.ExecuteNonQuery(); string str = ""; string str10 = ""; string str2 = ""; string str11 = ""; string str3 = ""; string str12 = ""; string cmdText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00' and (PL23003='01' or PL23003='02' or PL23003='03') order by PL23003"; SqlDataReader reader = new SqlCommand(cmdText, connection).ExecuteReader(); if (reader.Read()) { str = StringType.FromObject(reader["PL23003"]); str10 = StringType.FromObject(reader["PL23004"]); } if (reader.Read()) { str2 = StringType.FromObject(reader["PL23003"]); str11 = StringType.FromObject(reader["PL23004"]); } if (reader.Read()) { str3 = StringType.FromObject(reader["PL23003"]); str12 = StringType.FromObject(reader["PL23004"]); } reader.Close(); cmdText = "SELECT SC01001,SC01089 FROM dbo.SC010100 where SC01089<>''"; SqlCommand command = new SqlCommand(cmdText, connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); while (reader.Read()) { command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCodReemp (Codigo,CodReemplazo) values ('", reader["SC01001"]), "','"), reader["SC01089"]), "')")), connection2); try { num16 = 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.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } reader.Close(); SqlCommand command2 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT SC01001,SC01002,SC01003,SC03010,SC03003,SC03004,SC03005,SC03006,SC03011,SC03018,SC01089,SC01125,SC03022,PL01002,SC01055,SC01056,SY14002 FROM SC010100 INNER JOIN SC030100 ON SC010100.SC01001 = SC030100.SC03001 INNER JOIN PL010100 ON SC030100.SC03022 = PL010100.PL01001 INNER JOIN SY140100 ON SC010100.SC01056 = SY140100.SY14001 WHERE SC030100.SC03002 = '", this.cbAlmacen.SelectedValue), "'")), connection); command2.CommandTimeout = 900; dataSet.Clear(); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command2; adapter.Fill(dataSet, "SC010100"); this.Label1.Visible = true; this.Label1.Refresh(); this.txtCodProd.Visible = true; long num17 = dataSet.Tables["SC010100"].Rows.Count - 1; for (long i = 0L; i <= num17; i += 1L) { double num13; double num14; double num15; DataRow row = dataSet.Tables["SC010100"].Rows[(int)i]; this.txtCodProd.Text = StringType.FromObject(row["SC01001"]); this.txtCodProd.Refresh(); string str5 = StringType.FromObject(row["SC01001"]); string str13 = Strings.Trim(StringType.FromObject(row["SC01002"])) + " " + Strings.Trim(StringType.FromObject(row["SC01003"])); double num5 = DoubleType.FromObject(row["SC03010"]); if (ObjectType.ObjTst(row["SC03003"], 0, false) < 0) { num15 = 0.0; } else { num15 = DoubleType.FromObject(row["SC03003"]); } double num9 = DoubleType.FromObject(ObjectType.AddObj(row["SC03004"], row["SC03005"])); double num8 = DoubleType.FromObject(row["SC03006"]); double num3 = DoubleType.FromObject(row["SC03011"]); double num2 = DoubleType.FromObject(row["SC03018"]); string sLeft = StringType.FromObject(row["SC01089"]); DateTime expression = DateType.FromObject(row["SC01125"]); string str7 = StringType.FromObject(row["SC03022"]); string str15 = StringType.FromObject(row["PL01002"]); double num11 = DoubleType.FromObject(row["SC01055"]); string str4 = StringType.FromObject(row["SC01056"]); string str14 = StringType.FromObject(row["SY14002"]); if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "01", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='01'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "03", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='03'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "05", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='05'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "07", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='07'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "08", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='08'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "09", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='09'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "10", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str5 + "' and SC03002='10'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } double num10 = 0.0; command = new SqlCommand("SELECT sum(OR03011-OR03012) as OVRes FROM dbo.OR030100,OR010100 where (OR01002=1 or OR01002=4 or OR01002=6) and OR01091=1 and OR03011-OR03012<>0 and OR03005='" + str5 + "' and OR01001=OR03001", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read() && !Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OVRes"]))) { num10 = DoubleType.FromObject(reader["OVRes"]); } reader.Close(); double num12 = 0.0; command = new SqlCommand("SELECT sum(OR03011) as PromVtas FROM dbo.OR030100,OR010100 where (OR01002=1 or OR01002=4 or OR01002=6) and OR01091=0 and OR03005='" + str5 + "' and OR01001=OR03001 and OR01015>='" + Strings.Format(DateAndTime.DateAdd(DateInterval.Month, -3.0, DateAndTime.Now), "MM/dd/yyyy") + "' and OR01015<='" + Strings.Format(DateAndTime.Now, "MM/dd/yyyy") + "'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read() && !Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["PromVtas"]))) { num12 = DoubleType.FromObject(reader["PromVtas"]); } reader.Close(); command = new SqlCommand("SELECT sum(OR21011) as PromVtas FROM dbo.OR210100,OR200100 where (OR20002=1 or OR20002=4 or OR20002=6) and OR20091=0 and OR21005='" + str5 + "' and OR20001=OR21001 and OR20015>='" + Strings.Format(DateAndTime.DateAdd(DateInterval.Month, -3.0, DateAndTime.Now), "MM/dd/yyyy") + "' and OR20015<='" + Strings.Format(DateAndTime.Now, "MM/dd/yyyy") + "'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read() && !Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["PromVtas"]))) { num12 = DoubleType.FromObject(ObjectType.AddObj(num12, reader["PromVtas"])); } reader.Close(); num12 /= 3.0; double num7 = num12 * Variables.gMesesNRNue; if (num7 == 0.0) { num7 = num5; } if (StringType.StrCmp(sLeft, " ", false) != 0) { num13 = 0.0; num14 = 0.0; if (!(((((StringType.StrCmp(Strings.Format(expression, "yyyyMMdd"), Strings.Format(DateAndTime.Now, "yyyyMMdd"), false) < 0) & (num15 == 0.0)) & (num9 == 0.0)) & (num8 == 0.0)) & (num10 == 0.0))) { command4 = new SqlCommand((((((((((((((((("insert into " + Variables.gTermi + "TmpOCompra (Codigo,Descripcion,NivelRepos,StockAl,OV,OCPend,OVRes,LoteOptCpra,CantMinPed,CodReemplazo,FecReemp,PropCpra,PromVtas,NivelReposPV,PropCpraPV,CodProv,NomProv,CodMetEnv01,DescMetEnv01,CantMetEnv01,FecEntOC01,CodMetEnv02,DescMetEnv02,CantMetEnv02,FecEntOC02,CodMetEnv03,DescMetEnv03,CantMetEnv03,FecEntOC03,Seleccion,PrecioCpra,CodMoneda,Moneda) values ('" + str5) + "','" + str13 + "'," + StringType.FromDouble(num5) + "," + StringType.FromDouble(num15) + "," + StringType.FromDouble(num9) + "," + StringType.FromDouble(num8) + "," + StringType.FromDouble(num10) + "," + StringType.FromDouble(num3) + "," + StringType.FromDouble(num2)) + ",'" + sLeft) + "','" + Strings.Format(expression, "MM/dd/yyyy") + "'," + StringType.FromDouble(num13) + "," + StringType.FromDouble(num12) + "," + StringType.FromDouble(num7) + "," + StringType.FromDouble(num14)) + ",'" + str7) + "','" + str15) + "','" + str) + "','" + str10 + "'," + StringType.FromDouble(num13)) + ",'" + Strings.Format(DateType.FromString(Variables.gFechaOC), "MM/dd/yyyy")) + "','" + str2) + "','" + str11) + "',0,'" + Strings.Format(DateType.FromString(Variables.gFechaOC), "MM/dd/yyyy")) + "','" + str3) + "','" + str12) + "',0,'" + Strings.Format(DateType.FromString(Variables.gFechaOC), "MM/dd/yyyy") + "',0," + StringType.FromDouble(num11)) + ",'" + str4) + "','" + str14 + "')", connection2); try { num16 = command4.ExecuteNonQuery(); } catch (Exception exception4) { ProjectData.SetProjectError(exception4); Exception exception2 = exception4; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } continue; } if (StringType.StrCmp(sLeft, " ", false) == 0) { string str6 = str5; while (1 != 0) { command = new SqlCommand("SELECT * FROM " + Variables.gTermi + "TmpCodReemp where CodReemplazo='" + str6 + "'", connection2); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.HasRows) { reader.Read(); str6 = StringType.FromObject(reader["Codigo"]); reader.Close(); } else { reader.Close(); break; } command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT SC03010,SC03003,SC03004,SC03005,SC03006,SC03011,SC03018 FROM SC030100 where SC03001='" + str6 + "' and SC03002='", this.cbAlmacen.SelectedValue), "'")), connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.HasRows) { reader.Read(); num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["SC03003"])); num9 = DoubleType.FromObject(ObjectType.AddObj(ObjectType.AddObj(num9, reader["SC03004"]), reader["SC03005"])); num8 = DoubleType.FromObject(ObjectType.AddObj(num8, reader["SC03006"])); } reader.Close(); if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "01", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='01'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "03", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='03'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "05", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='05'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "07", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='07'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "08", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='08'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "09", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='09'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } if (ObjectType.ObjTst(this.cbAlmacen.SelectedValue, "10", false) != 0) { command = new SqlCommand("SELECT SC03003 as Stock FROM dbo.SC030100 where SC03001='" + str6 + "' and SC03002='10'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read()) { num15 = DoubleType.FromObject(ObjectType.AddObj(num15, reader["Stock"])); } reader.Close(); } command = new SqlCommand("SELECT sum(OR03011-OR03012) as OVRes FROM dbo.OR030100,OR010100 where (OR01002=1 or OR01002=4 or OR01002=6) and OR01091=1 and OR03011-OR03012<>0 and OR03005='" + str6 + "' and OR01001=OR03001", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read() && !Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["OVRes"]))) { num10 = DoubleType.FromObject(ObjectType.AddObj(num10, reader["OVRes"])); } reader.Close(); num12 = 0.0; command = new SqlCommand("SELECT sum(OR03011) as PromVtas FROM dbo.OR030100,OR010100 where (OR01002=1 or OR01002=4 or OR01002=6) and OR01091=0 and OR03005='" + str6 + "' and OR01001=OR03001 and OR01015>='" + Strings.Format(DateAndTime.DateAdd(DateInterval.Month, -3.0, DateAndTime.Now), "MM/dd/yyyy") + "' and OR01015<='" + Strings.Format(DateAndTime.Now, "MM/dd/yyyy") + "'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read() && !Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["PromVtas"]))) { num12 = DoubleType.FromObject(reader["PromVtas"]); } reader.Close(); command = new SqlCommand("SELECT sum(OR21011) as PromVtas FROM dbo.OR210100,OR200100 where (OR20002=1 or OR20002=4 or OR20002=6) and OR20091=0 and OR21005='" + str6 + "' and OR20001=OR21001 and OR20015>='" + Strings.Format(DateAndTime.DateAdd(DateInterval.Month, -3.0, DateAndTime.Now), "MM/dd/yyyy") + "' and OR20015<='" + Strings.Format(DateAndTime.Now, "MM/dd/yyyy") + "'", connection); command.CommandTimeout = 300; reader = command.ExecuteReader(); if (reader.Read() && !Information.IsDBNull(RuntimeHelpers.GetObjectValue(reader["PromVtas"]))) { num12 = DoubleType.FromObject(ObjectType.AddObj(num12, reader["PromVtas"])); } reader.Close(); num12 /= 3.0; num7 = num12 * Variables.gMesesNRNue; if (num7 == 0.0) { num7 = num5; } } num13 = (((num5 - num15) + num9) - num8) - num10; num14 = (((num7 - num15) + num9) - num8) - num10; if (num13 > 0.0) { if ((num3 != 0.0) && (num3 > num13)) { num13 = num3; } if (num2 != 0.0) { num13 = Math.Round((double)((num13 / num2) + 0.49), 0) * num2; } command4 = new SqlCommand(((((((((((((((("insert into " + Variables.gTermi + "TmpOCompra (Codigo,Descripcion,NivelRepos,StockAl,OV,OCPend,OVRes,LoteOptCpra,CantMinPed,CodReemplazo,PropCpra,PromVtas,NivelReposPV,PropCpraPV,CodProv,NomProv,CodMetEnv01,DescMetEnv01,CantMetEnv01,FecEntOC01,CodMetEnv02,DescMetEnv02,CantMetEnv02,FecEntOC02,CodMetEnv03,DescMetEnv03,CantMetEnv03,FecEntOC03,Seleccion,PrecioCpra,CodMoneda,Moneda) values ('" + str5) + "','" + str13 + "'," + StringType.FromDouble(num5) + "," + StringType.FromDouble(num15) + "," + StringType.FromDouble(num9) + "," + StringType.FromDouble(num8) + "," + StringType.FromDouble(num10) + "," + StringType.FromDouble(num3) + "," + StringType.FromDouble(num2)) + ",'" + sLeft + "'," + StringType.FromDouble(num13) + "," + StringType.FromDouble(num12) + "," + StringType.FromDouble(num7) + "," + StringType.FromDouble(num14)) + ",'" + str7) + "','" + str15) + "','" + str) + "','" + str10 + "'," + StringType.FromDouble(num13)) + ",'" + Strings.Format(DateType.FromString(Variables.gFechaOC), "MM/dd/yyyy")) + "','" + str2) + "','" + str11) + "',0,'" + Strings.Format(DateType.FromString(Variables.gFechaOC), "MM/dd/yyyy")) + "','" + str3) + "','" + str12) + "',0,'" + Strings.Format(DateType.FromString(Variables.gFechaOC), "MM/dd/yyyy") + "',0," + StringType.FromDouble(num11)) + ",'" + str4) + "','" + str14 + "')", connection2); try { num16 = command4.ExecuteNonQuery(); } catch (Exception exception5) { ProjectData.SetProjectError(exception5); Exception exception3 = exception5; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null); connection.Close(); connection2.Close(); this.cmbAceptar.Enabled = true; this.cmbSalir.Enabled = true; ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } } } connection.Close(); connection2.Close(); }
private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e) { SqlDataAdapter adapter4; DataRow row; DataSet dataSet = new DataSet(); this.cmbSalir.Enabled = false; this.Informe.Close(); 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, MsgBoxStyle.OKOnly, 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 ((StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)) { 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()) { adapter4 = 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(); adapter4.Fill(dataSet, "SC010100"); row = dataSet.Tables["SC010100"].Rows[0]; 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"]))), "','"), row["SC01128"]), "','"), row["SY24003"]), "',"), 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(RuntimeHelpers.GetObjectValue(reader["OR04003"])), "0000000000") + "','')"; } command = new SqlCommand(cmdText, connection2); try { command.ExecuteNonQuery(); } catch (Exception exception5) { ProjectData.SetProjectError(exception5); Exception exception2 = exception5; Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, 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 ((StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) & (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0)) { 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()) { adapter4 = 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(); adapter4.Fill(dataSet, "SC010100"); row = dataSet.Tables["SC010100"].Rows[0]; 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"]))), "','"), row["SC01128"]), "','"), row["SY24003"]), "',"), 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(RuntimeHelpers.GetObjectValue(reader["OR22003"])), "0000000000") + "','')"; } command = new SqlCommand(cmdText, connection2); try { command.ExecuteNonQuery(); } catch (Exception exception6) { ProjectData.SetProjectError(exception6); Exception exception3 = exception6; Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null); reader.Close(); connection.Close(); connection2.Close(); ProjectData.ClearProjectError(); return; ProjectData.ClearProjectError(); } } reader.Close(); connection.Close(); connection2.Close(); try { SqlConnection connection4 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection4.Open(); SqlCommand command2 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpRepGesEns as PC1TmpRepGesEns", connection4); command2.CommandTimeout = 500; SqlDataAdapter adapter5 = new SqlDataAdapter(); adapter5.SelectCommand = command2; dataSet.Clear(); adapter5.Fill(dataSet, "PC1TmpRepGesEns"); if (StringType.StrCmp(Variables.gTipoList, "1", false) == 0) { this.Informe.Load(Application.StartupPath + @"\repensxfecha.rpt"); this.Informe.SetDataSource(dataSet); connection4.Close(); } else { this.Informe.Load(Application.StartupPath + @"\repensxfechaxgrupo.rpt"); this.Informe.SetDataSource(dataSet); connection4.Close(); } FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.cmbSalir.Enabled = true; } catch (Exception exception7) { ProjectData.SetProjectError(exception7); Exception exception4 = exception7; Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public frmRepRMDesp1() { base.Closed += new EventHandler(this.frmRepRMDesp1_Closed); base.Load += new EventHandler(this.frmRepRMDesp1_Load); base.Click += new EventHandler(this.frmRepRMDesp1_Click); base.Leave += new EventHandler(this.frmRepRMDesp1_Leave); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); string str = "SELECT distinct NroOV,Cliente,NomCli,OCompra,LugarEnt,MetEnvio,NroRemito,Bultos,PesoBruto,PesoNeto,Volumen,FechaExp,HoraExp from PrepPed where not NroRemito is null and not FechaExp is null"; if (!((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0))) { if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) == 0)) { str = str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) == 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str = str + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } else if ((StringType.StrCmp(Variables.gDesde, "", false) != 0) & (StringType.StrCmp(Variables.gHasta, "", false) != 0)) { str = (str + " and FechaExp>='" + Strings.Format(DateType.FromString(Variables.gDesde), "MM/dd/yyyy") + "'") + " and FechaExp<='" + Strings.Format(DateType.FromString(Variables.gHasta), "MM/dd/yyyy") + "'"; } } SqlCommand command = new SqlCommand(str + " and MetEnvio in (select MetEnvio from " + Variables.gTermi + "TmpMetEnvio where Seleccion=1)", connection); command.CommandTimeout = 500; this.AdapTmp = new SqlDataAdapter(); this.AdapTmp.SelectCommand = command; this.DS.Clear(); this.AdapTmp.Fill(this.DS, "PrepPed"); this.Informe.Load(Application.StartupPath + @"\reprmdesp.rpt"); this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefecha"]; if (StringType.StrCmp(Variables.gDesde, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesde), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafecha"]; if (StringType.StrCmp(Variables.gHasta, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHasta), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } this.CrystalReportViewer1.ReportSource = this.Informe; this.CrystalReportViewer1.Zoom(1); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public frmRepOVPend1() { base.Closed += new EventHandler(this.frmRepOVPend1_Closed); base.Load += new EventHandler(this.frmRepOVPend1_Load); base.Click += new EventHandler(this.frmRepOVPend1_Click); this.Informe = new ReportDocument(); this.DS = new DataSet(); this.InitializeComponent(); try { string str; FormulaFieldDefinition definition6; SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096"); connection.Open(); if (Variables.gOVaListar == 1) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend"; } else if (Variables.gOVaListar == 2) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and ((FechaOC>FechaEnt and not FechaOC is null) or FechaOC is null))"; } else if (Variables.gOVaListar == 3) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where EntBloq=1"; } else if (Variables.gOVaListar == 4) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where ExcLimCre=1"; } else if (Variables.gOVaListar == 5) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV not in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico)"; } else if (Variables.gOVaListar == 6) { str = "SELECT * from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where NroOV in (select NroOV from " + Variables.gTermi + "TmpOVPend as PC1TmpOVPend where Cantidad>StockFisico and StockFisico<>0 and EntParc=1)"; } SqlCommand command = new SqlCommand(str, connection); command.CommandTimeout = 500; this.AdapOR01 = new SqlDataAdapter(); this.AdapOR01.SelectCommand = command; this.DS.Clear(); this.AdapOR01.Fill(this.DS, "PC1TmpOVPend"); if (Variables.gOrdenList == 1) { this.Informe.Load(Application.StartupPath + @"\repovpend1.rpt"); } else if (Variables.gOrdenList == 2) { this.Informe.Load(Application.StartupPath + @"\repovpend.rpt"); } else if (Variables.gOrdenList == 3) { this.Informe.Load(Application.StartupPath + @"\repovpend3.rpt"); } this.Informe.SetDataSource(this.DS); connection.Close(); FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields; FormulaFieldDefinition definition = formulaFields["desdefechaov"]; if (StringType.StrCmp(Variables.gDesdeFechaOV, Strings.Space(0), false) != 0) { definition.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaOV), "dd/MM/yyyy") + "'"; } else { definition.Text = "''"; } FormulaFieldDefinition definition2 = formulaFields["hastafechaov"]; if (StringType.StrCmp(Variables.gHastaFechaOV, Strings.Space(0), false) != 0) { definition2.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaOV), "dd/MM/yyyy") + "'"; } else { definition2.Text = "''"; } FormulaFieldDefinition definition3 = formulaFields["desdefechaent"]; if (StringType.StrCmp(Variables.gDesdeFechaEnt, Strings.Space(0), false) != 0) { definition3.Text = "'" + Strings.Format(DateType.FromString(Variables.gDesdeFechaEnt), "dd/MM/yyyy") + "'"; } else { definition3.Text = "''"; } FormulaFieldDefinition definition4 = formulaFields["hastafechaent"]; if (StringType.StrCmp(Variables.gHastaFechaEnt, Strings.Space(0), false) != 0) { definition4.Text = "'" + Strings.Format(DateType.FromString(Variables.gHastaFechaEnt), "dd/MM/yyyy") + "'"; } else { definition4.Text = "''"; } FormulaFieldDefinition definition5 = formulaFields["tipo"]; definition5.Text = "'" + Variables.gTipoList + "'"; if (Variables.gOrdenList == 1) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Entrega Prevista'"; } else if (Variables.gOrdenList == 2) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por N\x00b0 de Cliente'"; } else if (Variables.gOrdenList == 3) { definition6 = formulaFields["orden"]; definition6.Text = "'Ordenado por Fecha de Orden de Venta'"; } this.CrystalReportViewer1.ReportSource = this.Informe; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public void FromString(string value, DateTime expected) { Assert.Equal(expected, DateType.FromString(value)); Assert.Equal(expected, DateType.FromString(value, System.Globalization.CultureInfo.InvariantCulture)); }
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 FromString_NotSupported(string value, DateTime expected) { Assert.Throws <InvalidCastException>(() => DateType.FromString(value)); }
public static DateTime DateStartOfDay(this DateTime dateValue) { return(DateTimeHelper.DateAndTime(dateValue, DateType.FromString("00:00"))); }
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(); } }