protected override void DumpControls()
        {
            if (_data != null)
            {
                //agrego la cabecera
                tsa_CondicionesDeVentasExDataset data = (tsa_CondicionesDeVentasExDataset)_data;
                System.Data.DataRow row = data.tsa_CondicionesDeVentas.Rows[0];
                row["Descripcion"] = txtDescripcion.Text;
                if (txtRecargo.Text == txtRecargo.NullText)
                {
                    row["Recargo"] = 000.00;
                }
                else
                {
                    row["Recargo"] = txtRecargo.Text;
                }

                if (chActivo.Checked)
                {
                    row["Activo"] = true;
                }
                else
                {
                    row["Activo"] = false;
                }

                //agrego o modifico los detalles; puntualmente en base a las cuotas ingresadas
                if (txtCuotas.Text == String.Empty)
                {
                    txtCuotas.Text = "0";
                }
                InsertUpdateDetalles((string)row["IdCondicionDeVenta"], txtCuotas.Text);
            }
        }
        /// <summary>
        /// desarma el string text, de forma tal de poder insertar el detalle correspondiente a una
        /// condicion de venta determinada, basandose en los dias de vencimiento de las cuotas
        /// </summary>
        public void InsertUpdateDetalles(string idCondicionDeVenta, string text)
        {
            short cuota = 1;

            string[] dias            = text.Split(',');
            int      cantCuotas      = text.Split(',').Length;
            decimal  porcentajeCuota = 100 / cantCuotas;
            tsa_CondicionesDeVentasExDataset dataEX = (tsa_CondicionesDeVentasExDataset)_data;

            //borro todas las filas hijos
            foreach (System.Data.DataRow row in dataEX.tsa_CondicionesDeVentaDet.Rows)
            {
                row.Delete();
            }
            //agrego todos los hijos nuevos
            foreach (string dia in dias)
            {
                tsa_CondicionesDeVentasExDataset.tsa_CondicionesDeVentaDetRow row = dataEX.tsa_CondicionesDeVentaDet.Newtsa_CondicionesDeVentaDetRow();
                row["IdCondicionDeVentaDet"] = idCondicionDeVenta;
                row["Cuota"]           = cuota;
                row["DiasVencimiento"] = dia;
                row["Porcentual"]      = porcentajeCuota;
                cuota++;
                dataEX.tsa_CondicionesDeVentaDet.Addtsa_CondicionesDeVentaDetRow(row);
            }
        }
Ejemplo n.º 3
0
        public static void UpdateWithValidation(tsa_CondicionesDeVentasExDataset data)
        {
            ApplicationAssert.Check(data != null, "El argumento data no debe ser nulo.", ApplicationAssert.LineNumber);

            if (DatasetIsValid(data))
            {
                Update(data);
            }
        }
Ejemplo n.º 4
0
        public static void Update(tsa_CondicionesDeVentasExDataset dataSet)
        {
            ApplicationAssert.Check(dataSet != null, "El argumento dataSet no debe ser nulo.", ApplicationAssert.LineNumber);
            ApplicationAssert.Check(dataSet.tsa_CondicionesDeVentas.Rows.Count > 0, "La tabla tsa_CondicionesDeVenta debe poseer alguna fila.", ApplicationAssert.LineNumber);
            ApplicationAssert.Check(dataSet.tsa_CondicionesDeVentaDet.Rows.Count > 0, "La tabla tsa_CondicionesDeVentaDet debe poseer alguna fila.", ApplicationAssert.LineNumber);

            SentenciasReplicacion replicacion = GenerateReplication();

            mz.erp.dataaccess.tsa_CondicionesDeVentasEx.Update(dataSet, replicacion);
        }
Ejemplo n.º 5
0
        public static tsa_CondicionesDeVentasExDataset NewRow()
        {
            tsa_CondicionesDeVentasExDataset dataEx = new tsa_CondicionesDeVentasExDataset();

            tsa_CondicionesDeVentasDataset data = new tsa_CondicionesDeVentasDataset();

            System.Data.DataRow row = mz.erp.businessrules.tsa_CondicionesDeVentas.NewRow();
            try
            {
                dataEx.tsa_CondicionesDeVentas.LoadDataRow(row.ItemArray, false);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(dataEx);
        }
 protected override void FillControls()
 {
     if (_data != null)
     {
         try
         {
             tsa_CondicionesDeVentasExDataset data = (tsa_CondicionesDeVentasExDataset)_data;
             System.Data.DataRow row = data.tsa_CondicionesDeVentas.Rows[0];
             _idCondicionDeVenta = (string)row["IdCondicionDeVenta"];
             txtDescripcion.Text = (string)row["Descripcion"];
             txtRecargo.Text     = Convert.ToString(row["Recargo"]);
             txtCuotas.Text      = detalle.TextCuotas(_idCondicionDeVenta);
             bool _activo = (bool)row["Activo"];
             if (_activo)
             {
                 chActivo.Checked = true;
             }
         }
         catch (Exception e)
         { Console.WriteLine(e.Message); }
     }
 }
Ejemplo n.º 7
0
        public static tsa_CondicionesDeVentasExDataset GetByPk(string idCondicionDeVenta)
        {
            tsa_CondicionesDeVentasExDataset data = new tsa_CondicionesDeVentasExDataset();

            data.tsa_CondicionesDeVentas.ImportRow(mz.erp.businessrules.tsa_CondicionesDeVentas.GetByPk(idCondicionDeVenta));
            data.Merge(mz.erp.businessrules.tsa_CondicionesDeVentaDet.GetList(idCondicionDeVenta).tsa_CondicionesDeVentaDet);


            foreach (DataTable table in data.Tables)
            {
                foreach (DataRow row1 in table.Rows)
                {
                    foreach (DataColumn dc in row1.Table.Columns)
                    {
                        if (row1[dc] == System.DBNull.Value)
                        {
                            row1[dc] = Util.DefaultValue(dc.DataType);
                        }
                    }
                }
            }
            return(data);
        }
Ejemplo n.º 8
0
 public static bool DatasetIsValid(tsa_CondicionesDeVentasExDataset data)
 {
     return(true);
 }