Пример #1
0
 public void FromObject()
 {
     Assert.Equal(0m, DecimalType.FromObject(null));
     Assert.Equal(-1m, DecimalType.FromObject(true));
     Assert.Equal(123m, DecimalType.FromObject((byte)123));
     Assert.Equal(123m, DecimalType.FromObject((short)123));
     Assert.Equal(123m, DecimalType.FromObject((int)123));
     Assert.Equal(123m, DecimalType.FromObject((long)123));
     Assert.Equal(123m, DecimalType.FromObject((float)123));
     Assert.Equal(123m, DecimalType.FromObject((double)123));
     Assert.Equal(123m, DecimalType.FromObject((decimal)123));
     Assert.Equal(123m, DecimalType.FromObject("123"));
 }
        public Decimal AbonoTotal()
        {
            Decimal d1    = Decimal.Zero;
            int     num1  = 0;
            int     num2  = checked (this._Registros - 1);
            int     index = num1;

            while (index <= num2)
            {
                d1 = Decimal.Add(d1, DecimalType.FromObject(this.dgDatos[index, 2]));
                checked { ++index; }
            }
            return(d1);
        }
        public void RegistrarAbonos(int Año, int AlmacenGas, int MovimientoAlmacen, DateTime FVenta, string Usuario)
        {
            int num1  = 0;
            int num2  = checked (this._Registros - 1);
            int index = num1;

            while (index <= num2)
            {
                Decimal num3 = DecimalType.FromObject(this.dgDatos[index, 2]);
                int     num4 = IntegerType.FromObject(this.dgDatos[index, 0]);
                int     num5 = IntegerType.FromObject(this.dgDatos[index, 1]);
                new Consulta.cCobroComisionista().Actualizar((short)1, 0, Año, this._Cliente, num3, AlmacenGas, MovimientoAlmacen, FVenta, Usuario, 0, "", num4, num5, (short)0, DateAndTime.Now);
                checked { ++index; }
            }
        }
Пример #4
0
        private void CargarDatos(int Mes, int Año)
        {
            this.dgPedidos.DataSource = (object)null;
            Consulta.cPedidoComisionRes pedidoComisionRes = new Consulta.cPedidoComisionRes(0, this.Cliente, Mes, Año);
            this.Cursor = Cursors.WaitCursor;
            Decimal d1    = Decimal.Zero;
            int     num1  = 0;
            int     num2  = checked (((DataTable)pedidoComisionRes.dtTable).Rows.Count - 1);
            int     index = num1;

            while (index <= num2)
            {
                d1 = Decimal.Add(d1, DecimalType.FromObject(((DataTable)pedidoComisionRes.dtTable).Rows[index][3]));
                checked { ++index; }
            }
            this.dgPedidos.DataSource = (object)pedidoComisionRes.dtTable;
            this.lblTotal.Text        = Strings.Format((object)d1, "n2");
            this.Cursor = Cursors.Default;
        }
 public void Consulta(int Cliente, int Año, int Mes, string Usuario)
 {
     try
     {
         this.cnSigamet = new SqlConnection(Globals.GetInstance._CadenaConexion);
         SqlCommand sqlCommand = new SqlCommand("spPTLClienteComisionista", this.cnSigamet);
         sqlCommand.Parameters.Add("@Configuracion", SqlDbType.SmallInt).Value = (object)2;
         sqlCommand.Parameters.Add("@Cliente", SqlDbType.Int).Value            = (object)Cliente;
         sqlCommand.Parameters.Add("@Año", SqlDbType.Int).Value = (object)Año;
         sqlCommand.Parameters.Add("@Mes", SqlDbType.Int).Value = (object)Mes;
         sqlCommand.Parameters.Add("@ComisionDiaria", SqlDbType.Money).Value    = (object)0;
         sqlCommand.Parameters.Add("@ComisionPorTanque", SqlDbType.Money).Value = (object)0;
         sqlCommand.Parameters.Add("@Prestaciones", SqlDbType.Money).Value      = (object)0;
         sqlCommand.Parameters.Add("@Deducciones", SqlDbType.Money).Value       = (object)0;
         sqlCommand.Parameters.Add("@ComisionMensual", SqlDbType.Money).Value   = (object)0;
         sqlCommand.Parameters.Add("@Total", SqlDbType.Money).Value             = (object)0;
         sqlCommand.Parameters.Add("@Factor", SqlDbType.Decimal).Value          = (object)0;
         sqlCommand.Parameters.Add("@Kilos", SqlDbType.Decimal).Value           = (object)0;
         sqlCommand.Parameters.Add("@Usuario", SqlDbType.VarChar).Value         = (object)Usuario;
         sqlCommand.Parameters.Add("@AjustePorTanque", SqlDbType.Money).Value   = (object)0;
         sqlCommand.CommandType = CommandType.StoredProcedure;
         this.cnSigamet.Open();
         this.drReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (this.drReader.Read())
         {
             this.MontoComision  = DecimalType.FromObject(this.drReader[0]);
             this.MontoDeduccion = DecimalType.FromObject(this.drReader[1]);
         }
         this.cnSigamet.Close();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception exception = ex;
         EventLog.WriteEntry("Consulta cliente factor" + exception.Source, exception.Message, EventLogEntryType.Error);
         int num = (int)MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         ProjectData.ClearProjectError();
     }
 }
Пример #6
0
        public static Object Int(Object Number)
        {
            if (Number == null)
            {
                throw new ArgumentNullException("Number");
            }
            switch (ObjectType.GetTypeCode(Number))
            {
            case TypeCode.Boolean:
            case TypeCode.Char:
            case TypeCode.SByte:
            case TypeCode.Byte:
            case TypeCode.Int16:
            case TypeCode.UInt16:
            case TypeCode.Int32:
                return(Int(IntegerType.FromObject(Number)));

            case TypeCode.UInt32:
            case TypeCode.Int64:
            case TypeCode.UInt64:
                return(Number);

            case TypeCode.Single:
                return(Int(SingleType.FromObject(Number)));

            case TypeCode.Double:
                return(Int(DoubleType.FromObject(Number)));

            case TypeCode.Decimal:
                return(Int(DecimalType.FromObject(Number)));

            case TypeCode.String:
                return(Int(DoubleType.FromString
                               (StringType.FromObject(Number))));
            }
            throw new ArgumentException(S._("VB_InvalidNumber"), "Number");
        }
            public Decimal FactorActual(int Cliente, DateTime FVenta)
            {
                Decimal num1 = 0;

                try
                {
                    this.cnSigamet = new SqlConnection(Globals.GetInstance._CadenaConexion);
                    SqlCommand sqlCommand = new SqlCommand("spPTLClienteIncentivo", this.cnSigamet);
                    sqlCommand.Parameters.Add("@Configuracion", SqlDbType.SmallInt).Value = (object)4;
                    sqlCommand.Parameters.Add("@Cliente", SqlDbType.Int).Value            = (object)Cliente;
                    sqlCommand.Parameters.Add("@TipoIncentivo", SqlDbType.Int).Value      = (object)0;
                    sqlCommand.Parameters.Add("@FIncentivo", SqlDbType.DateTime).Value    = (object)FVenta;
                    sqlCommand.Parameters.Add("@Incentivo", SqlDbType.Decimal).Value      = (object)0;
                    sqlCommand.Parameters.Add("@Usuario", SqlDbType.VarChar).Value        = (object)"";
                    sqlCommand.Parameters.Add("@Status", SqlDbType.VarChar).Value         = (object)"";
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    this.cnSigamet.Open();
                    this.drReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
                    Decimal num2 = 0;
                    while (this.drReader.Read())
                    {
                        num2 = DecimalType.FromObject(this.drReader[0]);
                    }
                    this.cnSigamet.Close();
                    num1 = num2;
                }
                catch (Exception ex)
                {
                    ProjectData.SetProjectError(ex);
                    Exception exception = ex;
                    EventLog.WriteEntry("Consulta cliente factor" + exception.Source, exception.Message, EventLogEntryType.Error);
                    int num2 = (int)MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    ProjectData.ClearProjectError();
                }
                return(num1);
            }
Пример #8
0
 public void FromObject_Invalid()
 {
     Assert.Throws <InvalidCastException>(() => DecimalType.FromObject('1'));
     Assert.Throws <InvalidCastException>(() => DecimalType.FromObject(DateTime.MinValue));
     Assert.Throws <InvalidCastException>(() => DecimalType.FromObject(Guid.Empty));
 }
Пример #9
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;
                }
            }
        }
Пример #10
0
        private void RegistrarInformacion()
        {
            ClienteFactor.cClientePrestacion clientePrestacion = new ClienteFactor.cClientePrestacion(0);
            clientePrestacion.Borra(this._Cliente);
            int num1  = 0;
            int num2  = checked (this.dtDatos.Rows.Count - 1);
            int index = num1;

            while (index <= num2)
            {
                clientePrestacion.Registra(this._Cliente, IntegerType.FromObject(this.dgDatos[index, 2]), DecimalType.FromObject(this.dgDatos[index, 1]), this.dtpFInicio.Value, this.dtpFInicio.Value, this.cboStatus.Text, Globals.GetInstance._Usuario);
                checked { ++index; }
            }
            this.DatosSalvados = true;
            this.Close();
        }
Пример #11
0
 private void CargarDatosPrestacion()
 {
     ClienteFactor.cClientePrestacion clientePrestacion = new ClienteFactor.cClientePrestacion(0);
     clientePrestacion.Consulta(this._Cliente);
     while (clientePrestacion.drReader.Read())
     {
         this.dtpFInicio.Value        = DateType.FromObject(clientePrestacion.drReader[3]);
         this.cboStatus.SelectedIndex = 0;
         this.DesplegarDatos(IntegerType.FromObject(clientePrestacion.drReader[5]), StringType.FromObject(clientePrestacion.drReader[7]), DecimalType.FromObject(clientePrestacion.drReader[6]));
     }
 }