Exemplo n.º 1
0
 public void setup_generate_random1(object setup_low_rand, object setup_high_rand)
 {
     setup_rand_finished = false;
     while (!setup_rand_finished)
     {
         VBMath.Randomize();
         setup_random1 = IntegerType.FromObject(Conversion.Int(ObjectType.AddObj(ObjectType.MulObj(ObjectType.AddObj(setup_high_rand, 1), VBMath.Rnd()), 0)));
         if (!BooleanType.FromObject(ObjectType.BitAndObj(ObjectType.ObjTst(setup_random1, setup_low_rand, false) >= 0, ObjectType.ObjTst(setup_random1, setup_high_rand, false) <= 0)))
         {
             continue;
         }
         setup_rand_finished = true;
     }
 }
Exemplo n.º 2
0
 private void cmbAceptar_Click(object sender, EventArgs e)
 {
     if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbPackList.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbPackList.SelectedValue, Strings.Space(0), false) == 0)))
     {
         Interaction.MsgBox("Debe seleccionar packing list", 0x10, "Operador");
         this.cbPackList.Focus();
     }
     else
     {
         this.cbPackList.Enabled = false;
         this.cmbAceptar.Enabled = false;
         Variables.gPackList     = StringType.FromObject(this.cbPackList.SelectedValue);
         this.Close();
     }
 }
Exemplo n.º 3
0
        private void ParseQ1(string q1Result)
        {
            string q1Dados = q1Result; // modVariaveis.Q1Dados;

            NobreakInfo.TensaoEntrada               = !(StringType.StrCmp(Strings.Mid(q1Dados, 2, 3), "@@@", false) != 0 & StringType.StrCmp(Strings.Mid(q1Dados, 6, 1), "@", false) != 0) ? -1.0 : Conversion.Val(Strings.Mid(q1Dados, 2, 3)) + Conversion.Val(Strings.Mid(q1Dados, 6, 1)) / 10.0;
            NobreakInfo.TensaoEntrada2              = !(StringType.StrCmp(Strings.Mid(q1Dados, 8, 3), "@@@", false) != 0 & StringType.StrCmp(Strings.Mid(q1Dados, 12, 1), "@", false) != 0) ? -1.0 : Conversion.Val(Strings.Mid(q1Dados, 8, 3)) + Conversion.Val(Strings.Mid(q1Dados, 12, 1)) / 10.0;
            NobreakInfo.TensaoSaida                 = !(StringType.StrCmp(Strings.Mid(q1Dados, 14, 3), "@@@", false) != 0 & StringType.StrCmp(Strings.Mid(q1Dados, 18, 1), "@", false) != 0) ? -1.0 : Conversion.Val(Strings.Mid(q1Dados, 14, 3)) + Conversion.Val(Strings.Mid(q1Dados, 18, 1)) / 10.0;
            NobreakInfo.Carga                       = StringType.StrCmp(Strings.Mid(q1Dados, 20, 3), "@@@", false) == 0 ? -1L : checked ((long)Math.Round(Conversion.Val(Strings.Mid(q1Dados, 20, 3))));
            NobreakInfo.Frequencia                  = !(StringType.StrCmp(Strings.Mid(q1Dados, 24, 2), "@@", false) != 0 & StringType.StrCmp(Strings.Mid(StringType.FromInteger(27), 1), "@", false) != 0) ? -1.0 : Conversion.Val(Strings.Mid(q1Dados, 24, 2)) + Conversion.Val(Strings.Mid(q1Dados, 27, 1)) / 10.0;
            NobreakInfo.TensaoBateria               = !(StringType.StrCmp(Strings.Mid(q1Dados, 29, 2), "@@", false) != 0 & StringType.StrCmp(Strings.Mid(q1Dados, 32, 1), "@", false) != 0) ? -1.0 : Conversion.Val(Strings.Mid(q1Dados, 29, 2)) + Conversion.Val(Strings.Mid(q1Dados, 32, 1)) / 10.0;
            NobreakInfo.Temperatura                 = !(StringType.StrCmp(Strings.Mid(q1Dados, 34, 2), "@@", false) != 0 & StringType.StrCmp(Strings.Mid(q1Dados, 37, 1), "@", false) != 0) ? -1.0 : Conversion.Val(Strings.Mid(q1Dados, 34, 2)) + Conversion.Val(Strings.Mid(q1Dados, 37, 1)) / 10.0;
            NobreakInfo.StatusUtilityFail           = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 39, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusBateriaBaixa          = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 40, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusBypassBoostBuckActive = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 41, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusFalhaUps              = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 42, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusUpsStandBy            = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 43, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusTesteEmProgresso      = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 44, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusShutdownAtivo         = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 45, 1), "1", false) == 0, (object)true, (object)false));
            NobreakInfo.StatusBeepLigado            = BooleanType.FromObject(Interaction.IIf(StringType.StrCmp(Strings.Mid(q1Dados, 46, 1), "1", false) == 0, (object)true, (object)false));
        }
Exemplo n.º 4
0
        // Find a true element in an array and return the corresponding object.
        public static Object Switch(params Object[] VarExpr)
        {
            if (VarExpr == null)
            {
                return(null);
            }
            int len = VarExpr.Length;

            if ((len & 1) != 0)
            {
                throw new ArgumentException(S._("VB_MustBeEvenSized"));
            }
            int posn;

            for (posn = 0; posn < len; posn += 2)
            {
                if (BooleanType.FromObject(VarExpr[posn]))
                {
                    return(VarExpr[posn + 1]);
                }
            }
            return(null);
        }
Exemplo n.º 5
0
        private void ActTmp()
        {
            DataRow       row;
            long          num;
            SqlDataReader reader;
            DateTime      time2;
            DateTime      time3;
            string        str4;
            DataSet       dataSet = new DataSet();
            DataSet       set2    = new DataSet();

            this.cmbSalir.Enabled  = false;
            this.cmbVolver.Enabled = false;
            SqlConnection connection = new SqlConnection("data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096");

            connection.Open();
            SqlConnection connection2 = new SqlConnection("data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096");

            connection2.Open();
            int        num4     = new SqlCommand("delete " + Variables.gTermi + "TmpCalendario", connection2).ExecuteNonQuery();
            SqlCommand command4 = new SqlCommand("delete " + Variables.gTermi + "TmpCalendarioStkComp", connection2);

            num4 = command4.ExecuteNonQuery();
            string str = "SELECT OR01001,OR01004,OR01016,OR01050,OR03002,OR03005,OR03006,OR03007,OR03011,OR03012,OR03051,OR04002,OR04003,OR04004,OR04005,OR04008 FROM dbo.OR010100 inner join OR030100 on OR010100.OR01001=OR030100.OR03001 inner join OR040100 on OR010100.OR01001=OR040100.OR04001 where OR010100.OR01002=6 and OR010100.OR01091=0 and OR03011-OR03012<>0 and OR03034=1 and (";

            if (Variables.gIntr01)
            {
                str = str + "OR01004='INTR01' ";
                if (Variables.gIntr02)
                {
                    str = str + "or OR01004='INTR02' ";
                }
                if (Variables.gIntr03)
                {
                    str = str + "or OR01004='INTR03' ";
                }
                if (Variables.gIntr04)
                {
                    str = str + "or OR01004='INTR04' ";
                }
            }
            else if (Variables.gIntr02)
            {
                str = str + "OR01004='INTR02' ";
                if (Variables.gIntr03)
                {
                    str = str + "or OR01004='INTR03' ";
                }
                if (Variables.gIntr04)
                {
                    str = str + "or OR01004='INTR04' ";
                }
            }
            else if (Variables.gIntr03)
            {
                str = str + "OR01004='INTR03' ";
                if (Variables.gIntr04)
                {
                    str = str + "or OR01004='INTR04' ";
                }
            }
            else if (Variables.gIntr04)
            {
                str = str + "OR01004='INTR04' ";
            }
            SqlCommand command3 = new SqlCommand(str + ") order by OR010100.OR01016", connection);

            command3.CommandTimeout = 900;
            dataSet.Clear();
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = command3;
            adapter.Fill(dataSet, "OR010100");
            long num9 = dataSet.Tables["OR010100"].Rows.Count - 1;

            for (num = 0L; num <= num9; num += 1L)
            {
                row  = dataSet.Tables["OR010100"].Rows[(int)num];
                str4 = "insert into " + Variables.gTermi + "TmpCalendario (FechaEnt,Cliente,ListaRec,NroOA,NroLinea,Codigo,Descripcion,Almacen,Cantidad,AsignadoA,Observaciones,ReqEsp,Horas,SinStock,Obs) values (";
                CalcDates dates        = new CalcDatesClass();
                short     daysToDue    = 0;
                DataRow   row3         = row;
                string    str9         = "OR01016";
                DateTime  currentDate  = DateType.FromObject(row3[str9]);
                string    dayCountType = "H";
                string    company      = "01";
                dates.WeekDate(ref daysToDue, ref currentDate, ref dayCountType, ref company);
                row3[str9] = currentDate;
                str4       = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((str4 + "'" + Strings.Format(dates.MidDate, "MM/dd/yyyy")) + "','", row["OR01004"]), "','"), row["OR03051"]), "','"), row["OR01001"]), "','"), row["OR03002"]), "','"), row["OR03005"]), "','"), row["OR03006"]), " "), row["OR03007"]), "','"), row["OR01050"]), "',"), ObjectType.SubObj(row["OR03011"], row["OR03012"])), ","));
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04002"])), "0", false) == 0)
                {
                    str4 = str4 + "'',";
                }
                else
                {
                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04002"]), "',"));
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04003"])), "0", false) == 0)
                {
                    if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04004"])), "0", false) == 0)
                    {
                        str4 = str4 + "'',";
                    }
                    else
                    {
                        str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04004"]), "',"));
                    }
                }
                else if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04004"])), "0", false) == 0)
                {
                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04003"]), "',"));
                }
                else
                {
                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04003"]), " "), row["OR04004"]), "',"));
                }
                if (StringType.StrCmp(Strings.Trim(StringType.FromObject(row["OR04005"])), "0", false) == 0)
                {
                    str4 = str4 + "'',";
                }
                else
                {
                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04005"]), "',"));
                }
                command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(str4 + "'", row["OR04008"]), "',0,0)")), connection2);
                try
                {
                    num4 = command4.ExecuteNonQuery();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                    connection.Close();
                    connection2.Close();
                    this.cmbSalir.Enabled  = true;
                    this.cmbVolver.Enabled = true;
                    ProjectData.ClearProjectError();
                    return;

                    ProjectData.ClearProjectError();
                }
            }
            command3 = new SqlCommand("SELECT distinct NroOA from " + Variables.gTermi + "TmpCalendario", connection2);
            command3.CommandTimeout = 900;
            dataSet.Clear();
            adapter = new SqlDataAdapter();
            adapter.SelectCommand = command3;
            adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario");
            long num7 = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count - 1;

            for (num = 0L; num <= num7; num += 1L)
            {
                row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[(int)num];
                SqlCommand command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT * from GesEnsObs where NroOE='", row["NroOA"]), "'")), connection2);
                reader = command.ExecuteReader();
                if (reader.Read())
                {
                    reader.Close();
                    command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpCalendario set Obs=1 where NroOA='", row["NroOA"]), "'")), connection2);
                    try
                    {
                        num4 = command4.ExecuteNonQuery();
                    }
                    catch (Exception exception8)
                    {
                        ProjectData.SetProjectError(exception8);
                        Exception exception2 = exception8;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                        connection.Close();
                        connection2.Close();
                        this.cmbSalir.Enabled = true;
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
                else
                {
                    reader.Close();
                }
            }
            command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpCalendario order by FechaEnt", connection2);
            command3.CommandTimeout = 900;
            dataSet.Clear();
            adapter = new SqlDataAdapter();
            adapter.SelectCommand = command3;
            adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario");
            if (dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count != 0)
            {
                row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[0];
                if (DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday) > 1)
                {
                    time3 = DateAndTime.DateAdd(DateInterval.Day, (double)((DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday) - 1) * -1), DateType.FromObject(row["FechaEnt"]));
                }
                else
                {
                    time3 = DateType.FromObject(row["FechaEnt"]);
                }
            }
            command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpCalendario order by FechaEnt desc", connection2);
            command3.CommandTimeout = 900;
            dataSet.Clear();
            adapter = new SqlDataAdapter();
            adapter.SelectCommand = command3;
            adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario");
            if (dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count != 0)
            {
                row = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[0];
                if (DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday) < 7)
                {
                    time2 = DateAndTime.DateAdd(DateInterval.Day, (double)(7 - DateAndTime.Weekday(DateType.FromObject(row["FechaEnt"]), FirstDayOfWeek.Sunday)), DateType.FromObject(row["FechaEnt"]));
                }
                else
                {
                    time2 = DateType.FromObject(row["FechaEnt"]);
                }
            }
            while (DateTime.Compare(time3, time2) <= 0)
            {
                SqlCommand command2 = new SqlCommand("SELECT * FROM " + Variables.gTermi + "TmpCalendario where FechaEnt='" + Strings.Format(time3, "MM/dd/yyyy") + "'", connection2);
                reader = command2.ExecuteReader();
                if (reader.Read())
                {
                    reader.Close();
                }
                else
                {
                    reader.Close();
                    reader = new SqlCommand("SELECT * FROM dbo.SYHO0100 where SYHO001='" + Strings.Format(time3, "MM/dd/yyyy") + "'", connection).ExecuteReader();
                    if (reader.Read())
                    {
                        command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into " + Variables.gTermi + "TmpCalendario (FechaEnt,Observaciones) values (") + "'" + Strings.Format(time3, "MM/dd/yyyy") + "',") + "'", reader["SYHO002"]), "')")), connection2);
                        reader.Close();
                    }
                    else
                    {
                        command4 = new SqlCommand(("insert into " + Variables.gTermi + "TmpCalendario (FechaEnt) values (") + "'" + Strings.Format(time3, "MM/dd/yyyy") + "')", connection2);
                        reader.Close();
                    }
                    try
                    {
                        num4 = command4.ExecuteNonQuery();
                    }
                    catch (Exception exception9)
                    {
                        ProjectData.SetProjectError(exception9);
                        Exception exception3 = exception9;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null);
                        connection.Close();
                        connection2.Close();
                        this.cmbSalir.Enabled  = true;
                        this.cmbVolver.Enabled = true;
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
                time3 = DateAndTime.DateAdd(DateInterval.Day, 1.0, time3);
            }
            command3 = new SqlCommand("SELECT * from " + Variables.gTermi + "TmpCalendario where not Codigo is null order by NroOA,NroLinea", connection2);
            command3.CommandTimeout = 900;
            dataSet.Clear();
            adapter = new SqlDataAdapter();
            adapter.SelectCommand = command3;
            adapter.Fill(dataSet, Variables.gTermi + "TmpCalendario");
            long num6 = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows.Count - 1;

            for (num = 0L; num <= num6; num += 1L)
            {
                row      = dataSet.Tables[Variables.gTermi + "TmpCalendario"].Rows[(int)num];
                command3 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT OR03005,OR03006,OR03007,OR03011,OR03012,SC03003,SC03004,SC03005 FROM dbo.OR030100 inner join SC030100 on OR030100.OR03005=SC030100.SC03001 where OR03001='", row["NroOA"]), "' and OR03002='"), row["NroLinea"]), "' and OR03003<>'000' and SC03002='"), row["Almacen"]), "'")), connection);
                command3.CommandTimeout = 900;
                set2.Clear();
                SqlDataAdapter adapter2 = new SqlDataAdapter();
                adapter2.SelectCommand = command3;
                adapter2.Fill(set2, "OR030100");
                bool flag = false;
                long num5 = set2.Tables["OR030100"].Rows.Count - 1;
                for (long i = 0L; i <= num5; i += 1L)
                {
                    DataRow row2 = set2.Tables["OR030100"].Rows[(int)i];
                    if (BooleanType.FromObject(ObjectType.BitOrObj(ObjectType.ObjTst(row2["SC03003"], 0, false) <= 0, ObjectType.ObjTst(ObjectType.AddObj(row2["SC03004"], row2["SC03005"]), row2["SC03003"], false) > 0)))
                    {
                        flag = true;
                    }
                    if (ObjectType.ObjTst(ObjectType.AddObj(row2["SC03004"], row2["SC03005"]), row2["SC03003"], false) > 0)
                    {
                        reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT PC03043,PC03044,PC03016 FROM dbo.PC030100 where PC03005='", row2["OR03005"]), "' and PC03043<PC03044 and PC03029=1 ")) + "and PC03035='", row["Almacen"]), "' order by PC03016")), connection).ExecuteReader();
                        if (reader.Read())
                        {
                            str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCalendarioStkComp (NroOA,NroLinea,CodComp,DescComp,Cantidad,StkFisico,StkComprometido,FechaOC,CantOC) values ('", row["NroOA"]), "','"), row["NroLinea"]), "','"), row2["OR03005"]), "','"), row2["OR03006"]), " "), row2["OR03007"]), "',"), ObjectType.SubObj(row2["OR03011"], row2["OR03012"])), ","), row2["SC03003"]), ","), ObjectType.AddObj(row2["SC03004"], row2["SC03005"])), ",'"), Strings.Format(RuntimeHelpers.GetObjectValue(reader["PC03016"]), "MM/dd/yyyy")), "',"), ObjectType.SubObj(reader["PC03044"], reader["PC03043"])), ")"));
                            reader.Close();
                            command4 = new SqlCommand(str4, connection2);
                            try
                            {
                                num4 = command4.ExecuteNonQuery();
                            }
                            catch (Exception exception10)
                            {
                                ProjectData.SetProjectError(exception10);
                                Exception exception4 = exception10;
                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception4.Message, MsgBoxStyle.OKOnly, null);
                                connection.Close();
                                connection2.Close();
                                this.cmbSalir.Enabled  = true;
                                this.cmbVolver.Enabled = true;
                                ProjectData.ClearProjectError();
                                return;

                                ProjectData.ClearProjectError();
                            }
                        }
                        else
                        {
                            reader.Close();
                            command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCalendarioStkComp (NroOA,NroLinea,CodComp,DescComp,Cantidad,StkFisico,StkComprometido) values ('", row["NroOA"]), "','"), row["NroLinea"]), "','"), row2["OR03005"]), "','"), row2["OR03006"]), " "), row2["OR03007"]), "',"), ObjectType.SubObj(row2["OR03011"], row2["OR03012"])), ","), row2["SC03003"]), ","), ObjectType.AddObj(row2["SC03004"], row2["SC03005"])), ")")), connection2);
                            try
                            {
                                num4 = command4.ExecuteNonQuery();
                            }
                            catch (Exception exception11)
                            {
                                ProjectData.SetProjectError(exception11);
                                Exception exception5 = exception11;
                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception5.Message, MsgBoxStyle.OKOnly, null);
                                connection.Close();
                                connection2.Close();
                                this.cmbSalir.Enabled  = true;
                                this.cmbVolver.Enabled = true;
                                ProjectData.ClearProjectError();
                                return;

                                ProjectData.ClearProjectError();
                            }
                        }
                    }
                    else
                    {
                        command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpCalendarioStkComp (NroOA,NroLinea,CodComp,DescComp,Cantidad,StkFisico,StkComprometido) values ('", row["NroOA"]), "','"), row["NroLinea"]), "','"), row2["OR03005"]), "','"), row2["OR03006"]), " "), row2["OR03007"]), "',"), ObjectType.SubObj(row2["OR03011"], row2["OR03012"])), ","), row2["SC03003"]), ","), ObjectType.AddObj(row2["SC03004"], row2["SC03005"])), ")")), connection2);
                        try
                        {
                            num4 = command4.ExecuteNonQuery();
                        }
                        catch (Exception exception12)
                        {
                            ProjectData.SetProjectError(exception12);
                            Exception exception6 = exception12;
                            Interaction.MsgBox("Se ha producido el siguiente error:" + exception6.Message, MsgBoxStyle.OKOnly, null);
                            connection.Close();
                            connection2.Close();
                            this.cmbSalir.Enabled  = true;
                            this.cmbVolver.Enabled = true;
                            ProjectData.ClearProjectError();
                            return;

                            ProjectData.ClearProjectError();
                        }
                    }
                }
                if (flag)
                {
                    command4 = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("update " + Variables.gTermi + "TmpCalendario set SinStock=1 where NroOA='", row["NroOA"]), "'")), connection2);
                    try
                    {
                        num4 = command4.ExecuteNonQuery();
                    }
                    catch (Exception exception13)
                    {
                        ProjectData.SetProjectError(exception13);
                        Exception exception7 = exception13;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception7.Message, MsgBoxStyle.OKOnly, null);
                        connection.Close();
                        connection2.Close();
                        this.cmbSalir.Enabled  = true;
                        this.cmbVolver.Enabled = true;
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
            }
            connection.Close();
            connection2.Close();
        }
Exemplo n.º 6
0
        private void cmbAceptar_Click(object sender, EventArgs e)
        {
            DataSet dataSet = new DataSet();
            DataSet set2    = new DataSet();
            bool    flag    = false;

            if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbAlmacen.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbAlmacen.SelectedValue, Strings.Space(0), false) == 0)))
            {
                Interaction.MsgBox("Debe seleccionar almac\x00e9n", MsgBoxStyle.Critical, "Operador");
                this.cbAlmacen.Focus();
            }
            else if (((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) == 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) != 0)) | ((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) != 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) == 0)))
            {
                Interaction.MsgBox("Debe indicar desde y hasta rack", MsgBoxStyle.Critical, "Operador");
                this.editDesdeRack.Focus();
            }
            else
            {
                this.cmbAceptar.Enabled = false;
                this.cmbSalir.Enabled   = false;
                Variables.gFechaInv     = this.dtpFechaInv.Value;
                Variables.gCodAlmacen   = StringType.FromObject(this.cbAlmacen.SelectedValue);
                Variables.gNomAlmacen   = this.cbAlmacen.Text;
                Variables.gDesdeRack    = Strings.Trim(this.editDesdeRack.Text);
                Variables.gHastaRack    = Strings.Trim(this.editHastaRack.Text);
                string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                SqlConnection connection       = new SqlConnection(connectionString);
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                flag = true;
                SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM dbo.RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "'", connectionString);
                adapter.Fill(dataSet, "RepDifInv");
                if (dataSet.Tables["RepDifInv"].Rows.Count != 0)
                {
                    Interaction.MsgBox("Ya se gener\x00f3 diferencia de inventario sobre estos datos", MsgBoxStyle.Critical, "Operador");
                    if (flag)
                    {
                        transaction.Rollback();
                        flag = false;
                    }
                    connection.Close();
                    this.cmbAceptar.Enabled = true;
                    this.cmbSalir.Enabled   = true;
                    this.cmbAceptar.Focus();
                }
                else
                {
                    dataSet.Tables["RepDifInv"].Rows.Clear();
                    adapter = new SqlDataAdapter("SELECT Fecha FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "'", connectionString);
                    adapter.Fill(dataSet, "Inventario");
                    if (dataSet.Tables["Inventario"].Rows.Count == 0)
                    {
                        Interaction.MsgBox("No se realizo inventario f\x00edsico en la fecha indicada", MsgBoxStyle.Critical, "Operador");
                        if (flag)
                        {
                            transaction.Rollback();
                            flag = false;
                        }
                        connection.Close();
                        this.cmbAceptar.Enabled = true;
                        this.cmbSalir.Enabled   = true;
                        this.cmbAceptar.Focus();
                    }
                    else
                    {
                        DataRow    row;
                        long       num;
                        int        num2;
                        SqlCommand command3;
                        string     str;
                        string     str2;
                        dataSet.Tables["Inventario"].Rows.Clear();
                        if (Strings.Len(Variables.gDesdeRack) == 2)
                        {
                            str = "SELECT SC03001,SC03002,SC03003,SC01002,SC01003,SC03013 FROM dbo.SC030100 INNER JOIN SC010100 on SC03001=SC01001 where SC03003<>0 and SC03002='" + Variables.gCodAlmacen + "' and substring(SC03013,3,2)>='" + Variables.gDesdeRack + "' and substring(SC03013,3,2)<='" + Variables.gHastaRack + "'";
                        }
                        else if (Strings.Len(Variables.gDesdeRack) == 1)
                        {
                            str = "SELECT SC03001,SC03002,SC03003,SC01002,SC01003,SC03013 FROM dbo.SC030100 INNER JOIN SC010100 on SC03001=SC01001 where SC03003<>0 and SC03002='" + Variables.gCodAlmacen + "' and substring(SC03013,3,1)>='" + Variables.gDesdeRack + "' and substring(SC03013,3,1)<='" + Variables.gHastaRack + "'";
                        }
                        else
                        {
                            str = "SELECT SC03001,SC03002,SC03003,SC01002,SC01003,SC03013 FROM dbo.SC030100 INNER JOIN SC010100 on SC03001=SC01001 where SC03003<>0 and SC03002='" + Variables.gCodAlmacen + "'";
                        }
                        SqlCommand command = new SqlCommand(str, connection);
                        command.CommandTimeout = 500;
                        command.Transaction    = transaction;
                        SqlDataAdapter adapter3 = new SqlDataAdapter();
                        adapter3.SelectCommand = command;
                        adapter3.Fill(dataSet, "SC030100");
                        this.Label1.Visible = true;
                        this.Label1.Refresh();
                        this.txtCodProd.Visible = true;
                        long num4 = dataSet.Tables["SC030100"].Rows.Count - 1;
                        for (num = 0L; num <= num4; num += 1L)
                        {
                            row = dataSet.Tables["SC030100"].Rows[(int)num];
                            this.txtCodProd.Text = StringType.FromObject(row["SC03001"]);
                            this.txtCodProd.Refresh();
                            adapter = new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT Codigo,sum(Cantidad) as Cantidad,Posicion FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and Codigo='", row["SC03001"]), "' and Posicion='"), row["SC03013"]), "' group by Codigo,Posicion")), connectionString);
                            adapter.Fill(dataSet, "Inventario");
                            try
                            {
                                DataRow row2;
                                string  str4;
                                if (dataSet.Tables["Inventario"].Rows.Count != 0)
                                {
                                    row2 = dataSet.Tables["Inventario"].Rows[0];
                                    str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','", row["SC03002"]), "','"), row2["Posicion"]), "','"), row["SC03001"]), "','"), row["SC01002"]), "','"), row["SC01003"]), "',"), row2["Cantidad"]), ",'"), row["SC03013"]), "',"), row["SC03003"]), ",0,0)"));
                                    dataSet.Tables["Inventario"].Rows.Clear();
                                }
                                else
                                {
                                    dataSet.Tables["Inventario"].Rows.Clear();
                                    new SqlDataAdapter(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("SELECT Codigo,sum(Cantidad) as Cantidad,Posicion FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and Codigo='", row["SC03001"]), "' group by Codigo,Posicion")), connectionString).Fill(dataSet, "Inventario");
                                    if (dataSet.Tables["Inventario"].Rows.Count != 0)
                                    {
                                        row2 = dataSet.Tables["Inventario"].Rows[0];
                                        str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','", row["SC03002"]), "','"), row2["Posicion"]), "','"), row["SC03001"]), "','"), row["SC01002"]), "','"), row["SC01003"]), "',"), row2["Cantidad"]), ",'"), row["SC03013"]), "',"), row["SC03003"]), ",0,0)"));
                                        dataSet.Tables["Inventario"].Rows.Clear();
                                    }
                                    else
                                    {
                                        str4 = StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','", row["SC03002"]), "',' ','"), row["SC03001"]), "','"), row["SC01002"]), "','"), row["SC01003"]), "',0,'"), row["SC03013"]), "',"), row["SC03003"]), ",0,0)"));
                                    }
                                    command3             = new SqlCommand(str4, connection);
                                    command3.Transaction = transaction;
                                }
                                num2 = command3.ExecuteNonQuery();
                            }
                            catch (Exception exception1)
                            {
                                ProjectData.SetProjectError(exception1);
                                Exception exception = exception1;
                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                                if (flag)
                                {
                                    transaction.Rollback();
                                    flag = false;
                                }
                                connection.Close();
                                this.cmbAceptar.Enabled = true;
                                this.cmbSalir.Enabled   = true;
                                ProjectData.ClearProjectError();
                                return;

                                ProjectData.ClearProjectError();
                            }
                        }
                        if (Strings.Len(Variables.gDesdeRack) == 2)
                        {
                            str2 = "SELECT Posicion,Codigo,Desc1,Desc2,sum(Cantidad) as Cantidad FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and substring(Posicion,3,2)>='" + Variables.gDesdeRack + "' and substring(Posicion,3,2)<='" + Variables.gHastaRack + "' group by Posicion,Codigo,Desc1,Desc2";
                        }
                        else if (Strings.Len(Variables.gDesdeRack) == 1)
                        {
                            str2 = "SELECT Posicion,Codigo,Desc1,Desc2,sum(Cantidad) as Cantidad FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and substring(Posicion,3,1)>='" + Variables.gDesdeRack + "' and substring(Posicion,3,1)<='" + Variables.gHastaRack + "' group by Posicion,Codigo,Desc1,Desc2";
                        }
                        else
                        {
                            str2 = "SELECT Posicion,Codigo,Desc1,Desc2,sum(Cantidad) as Cantidad FROM dbo.Inventario where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' group by Posicion,Codigo,Desc1,Desc2";
                        }
                        new SqlDataAdapter(str2, connectionString).Fill(dataSet, "Inventario");
                        long num3 = dataSet.Tables["Inventario"].Rows.Count - 1;
                        for (num = 0L; num <= num3; num += 1L)
                        {
                            row = dataSet.Tables["Inventario"].Rows[(int)num];
                            this.txtCodProd.Text = StringType.FromObject(row["Codigo"]);
                            this.txtCodProd.Refresh();
                            try
                            {
                                command3             = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(((("insert into RepDifInv (FechaInv,DesdeRack,HastaRack,Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar) values ('" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "','" + Variables.gDesdeRack) + "','" + Variables.gHastaRack) + "','" + Variables.gCodAlmacen) + "','", row["Posicion"]), "','"), row["Codigo"]), "','"), row["Desc1"]), "','"), row["Desc2"]), "',"), row["Cantidad"]), ",' ',0,0,0)")), connection);
                                command3.Transaction = transaction;
                                num2 = command3.ExecuteNonQuery();
                            }
                            catch (SqlException exception4)
                            {
                                ProjectData.SetProjectError(exception4);
                                SqlException exception2 = exception4;
                                if (exception2.Number != 0xa43)
                                {
                                    Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                                    if (flag)
                                    {
                                        transaction.Rollback();
                                        flag = false;
                                    }
                                    connection.Close();
                                    this.cmbAceptar.Enabled = true;
                                    this.cmbSalir.Enabled   = true;
                                    ProjectData.ClearProjectError();
                                    return;
                                }
                                ProjectData.ClearProjectError();
                            }
                            catch (Exception exception5)
                            {
                                ProjectData.SetProjectError(exception5);
                                Exception exception3 = exception5;
                                Interaction.MsgBox("Se ha producido el siguiente error:" + exception3.Message, MsgBoxStyle.OKOnly, null);
                                if (flag)
                                {
                                    transaction.Rollback();
                                    flag = false;
                                }
                                connection.Close();
                                this.cmbAceptar.Enabled = true;
                                this.cmbSalir.Enabled   = true;
                                ProjectData.ClearProjectError();
                                return;

                                ProjectData.ClearProjectError();
                            }
                        }
                        transaction.Commit();
                        flag = false;
                        connection.Close();
                        Variables.gGenDifInv = true;
                        frmGenDifInv1 inv = new frmGenDifInv1();
                        this.Hide();
                        inv.Show();
                    }
                }
            }
        }
Exemplo n.º 7
0
 public void FromObject(bool expected, object value)
 {
     Assert.Equal(expected, BooleanType.FromObject(value));
 }
Exemplo n.º 8
0
 public void InvalidCastObject(object value)
 {
     Assert.Throws <InvalidCastException>(() => BooleanType.FromObject(value));
 }
Exemplo n.º 9
0
 private void cmbAceptar_Click(object sender, EventArgs e)
 {
     if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbPackList.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbPackList.SelectedValue, Strings.Space(0), false) == 0)))
     {
         Interaction.MsgBox("Debe seleccionar packing list", 0x10, "Operador");
         this.cbPackList.Focus();
     }
     else if (StringType.StrCmp(this.txtDespacho.Text, Strings.Space(0), false) == 0)
     {
         Interaction.MsgBox("Debe ingresar Despacho", 0x10, "Operador");
         this.txtDespacho.Focus();
     }
     else if (StringType.StrCmp(this.txtCodAduana.Text, Strings.Space(0), false) == 0)
     {
         Interaction.MsgBox("Debe ingresar C\x00f3digo de Aduana", 0x10, "Operador");
         this.txtCodAduana.Focus();
     }
     else
     {
         this.cbPackList.Enabled = false;
         this.cmbAceptar.Enabled = false;
         this.GroupBox2.Enabled  = false;
         Variables.gDespacho     = this.txtDespacho.Text;
         Variables.gFechaImp     = this.dtpFechaImp.Value;
         Variables.gCodAduana    = this.txtCodAduana.Text;
         string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096";
         SqlConnection connection       = new SqlConnection(connectionString);
         connection.Open();
         SqlDataReader reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select * from Recepcion where PackList='", this.cbPackList.SelectedValue), "'")), connection).ExecuteReader();
         if (reader.Read())
         {
             reader.Close();
             connection.Close();
             Interaction.MsgBox("Este packing list ya fue procesado", 0x40, "Operador");
             this.cbPackList.Enabled = true;
             this.cmbAceptar.Enabled = true;
             this.GroupBox2.Enabled  = true;
             this.cbPackList.Focus();
         }
         else
         {
             reader.Close();
             Variables.gPackList = StringType.FromObject(this.cbPackList.SelectedValue);
             string selectCommandText = "select * from Despachos where Despacho='" + Variables.gDespacho + "' order by NroFCProv";
             this.Adap = new SqlDataAdapter(selectCommandText, connectionString);
             this.CB   = new SqlCommandBuilder(this.Adap);
             this.Adap.Fill(this.DS, "FCProv");
             this.dgFcProv.DataSource = this.DS.Tables["FCProv"];
             DataGridTableStyle table = new DataGridTableStyle();
             table.MappingName = "FCProv";
             DataGridTextBoxColumn column = new DataGridTextBoxColumn();
             column = new DataGridTextBoxColumn();
             DataGridTextBoxColumn column2 = column;
             column2.HeaderText  = "Factura Proveedor";
             column2.MappingName = "NroFCProv";
             column2.Width       = 150;
             column2             = null;
             table.GridColumnStyles.Add(column);
             this.dgFcProv.TableStyles.Add(table);
             this.dgFcProv.Refresh();
             this.GroupBox1.Visible = true;
             this.editNroFC.Focus();
         }
     }
 }
Exemplo n.º 10
0
        // Inner version of "Print" and "Write".
        private static void Print(File file, Object[] Output,
                                  CultureInfo culture, bool print)
        {
            NumberFormatInfo nfi = culture.NumberFormat;

            if (Output == null)
            {
                return;
            }
            bool first = true;

            foreach (Object obj in Output)
            {
                if (!first && !print)
                {
                    file.Write(",");
                }
                else
                {
                    first = false;
                }
                if (obj == null)
                {
                    if (!print)
                    {
                        file.Write("#NULL#");
                    }
                    continue;
                }
                if (obj is TabInfo)
                {
                    file.Tab((TabInfo)obj);
                    continue;
                }
                else if (obj is SpcInfo)
                {
                    file.Space((SpcInfo)obj);
                    continue;
                }
                else if (obj is char[])
                {
                    file.Write(new String((char[])obj));
                    continue;
                }
                else if (obj is ErrObject)
                {
                    if (print)
                    {
                        file.Write(String.Format("Error {0}",
                                                 ((ErrObject)obj).Number));
                    }
                    else
                    {
                        file.Write(String.Format("#ERROR {0}#",
                                                 ((ErrObject)obj).Number));
                    }
                    continue;
                }
                switch (ObjectType.GetTypeCode(obj))
                {
                case TypeCode.DBNull:
                {
                    if (print)
                    {
                        file.Write("Null");
                    }
                    else
                    {
                        file.Write("#NULL#");
                    }
                }
                break;

                case TypeCode.Boolean:
                {
                    bool b = BooleanType.FromObject(obj);
                    if (print)
                    {
                        file.Write(b.ToString(culture));
                    }
                    else if (b)
                    {
                        file.Write("#TRUE#");
                    }
                    else
                    {
                        file.Write("#FALSE#");
                    }
                }
                break;

                case TypeCode.Byte:
                {
                    byte by = ByteType.FromObject(obj);
                    file.Write(by.ToString(nfi));
                }
                break;

                case TypeCode.Int16:
                {
                    short s = ShortType.FromObject(obj);
                    file.Write(s.ToString(nfi));
                }
                break;

                case TypeCode.Int32:
                {
                    int i = IntegerType.FromObject(obj);
                    file.Write(i.ToString(nfi));
                }
                break;

                case TypeCode.Int64:
                {
                    long l = LongType.FromObject(obj);
                    file.Write(l.ToString(nfi));
                }
                break;

                case TypeCode.Single:
                {
                    float f = SingleType.FromObject(obj, nfi);
                    file.Write(f.ToString(nfi));
                }
                break;

                case TypeCode.Double:
                {
                    double d = DoubleType.FromObject(obj, nfi);
                    file.Write(d.ToString(nfi));
                }
                break;

                case TypeCode.Decimal:
                {
                    Decimal dc = DecimalType.FromObject(obj, nfi);
                    file.Write(dc.ToString(nfi));
                }
                break;

                case TypeCode.DateTime:
                {
                    DateTime dt = DateType.FromObject(obj);
                    if (print)
                    {
                        file.Write(StringType.FromDate(dt) + " ");
                    }
                    else
                    {
                        String format;
                        long   dayTicks = dt.Ticks % TimeSpan.TicksPerDay;
                        if (dt.Ticks == dayTicks)
                        {
                            format = "T";
                        }
                        else if (dayTicks == 0)
                        {
                            format = "d";
                        }
                        else
                        {
                            format = "F";
                        }
                        file.Write(dt.ToString
                                       (format, culture.DateTimeFormat));
                    }
                }
                break;

                case TypeCode.String:
                {
                    file.Write(StringType.FromObject(obj));
                }
                break;

                default:
                {
                    Utils.ThrowException(5);                                            // ArgumentException.
                }
                break;
                }
            }
        }
Exemplo n.º 11
0
        private void cmbAceptar_Click(object sender, EventArgs e)
        {
            DataSet dataSet = new DataSet();
            DataSet set2    = new DataSet();

            if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbAlmacen.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbAlmacen.SelectedValue, Strings.Space(0), false) == 0)))
            {
                Interaction.MsgBox("Debe seleccionar almac\x00e9n", 0x10, "Operador");
                this.cbAlmacen.Focus();
            }
            else if (((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) == 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) != 0)) | ((StringType.StrCmp(this.editDesdeRack.Text, Strings.Space(0), false) != 0) & (StringType.StrCmp(this.editHastaRack.Text, Strings.Space(0), false) == 0)))
            {
                Interaction.MsgBox("Debe indicar desde y hasta rack", 0x10, "Operador");
                this.editDesdeRack.Focus();
            }
            else if (StringType.StrCmp(this.editReferencia.Text, Strings.Space(0), false) == 0)
            {
                Interaction.MsgBox("Debe ingresar referencia", 0x10, "Operador");
                this.editReferencia.Focus();
            }
            else
            {
                this.cmbAceptar.Enabled = false;
                this.cmbSalir.Enabled   = false;
                Variables.gFechaInv     = this.dtpFechaInv.Value;
                Variables.gCodAlmacen   = StringType.FromObject(this.cbAlmacen.SelectedValue);
                Variables.gNomAlmacen   = this.cbAlmacen.Text;
                Variables.gDesdeRack    = Strings.Trim(this.editDesdeRack.Text);
                Variables.gHastaRack    = Strings.Trim(this.editHastaRack.Text);
                Variables.gReferencia   = Strings.Trim(this.editReferencia.Text);
                string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                SqlConnection connection       = new SqlConnection(connectionString);
                connection.Open();
                new SqlDataAdapter("SELECT * FROM dbo.RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "'", connectionString).Fill(dataSet, "RepDifInv");
                if (dataSet.Tables["RepDifInv"].Rows.Count == 0)
                {
                    Interaction.MsgBox("No se gener\x00f3 diferencia de inventario sobre estos datos", 0x10, "Operador");
                    connection.Close();
                    this.cmbAceptar.Enabled = true;
                    this.cmbSalir.Enabled   = true;
                    this.cmbAceptar.Focus();
                }
                else
                {
                    dataSet.Tables["RepDifInv"].Rows.Clear();
                    SqlCommand command3 = new SqlCommand("delete " + Variables.gTermi + "TmpInventario", connection);
                    int        num2     = command3.ExecuteNonQuery();
                    command3 = new SqlCommand("insert into " + Variables.gTermi + "TmpInventario select Almacen,Posicion,Codigo,Desc1,Desc2,Cantidad,PosSist,CantSist,Aceptar,Rechazar from RepDifInv where FechaInv='" + Strings.Format(Variables.gFechaInv, "MM/dd/yyyy") + "' and DesdeRack='" + Variables.gDesdeRack + "' and HastaRack='" + Variables.gHastaRack + "' and Almacen='" + Variables.gCodAlmacen + "' and (Cantidad<>CantSist or Posicion<>PosSist)", connection);
                    try
                    {
                        num2 = command3.ExecuteNonQuery();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, 0, null);
                        connection.Close();
                        this.cmbAceptar.Enabled = true;
                        this.cmbSalir.Enabled   = true;
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                    connection.Close();
                    frmRepDifInv2 inv = new frmRepDifInv2();
                    this.Hide();
                    inv.Show();
                }
            }
        }