private void IbtnUpdate_Click(object sender, EventArgs e)
        {
            CultureInfo culture = new CultureInfo("en-US");

            if (ValidateData())
            {
                DateTime   localDate  = DateTime.Now;
                Cotization cotization = new Cotization();
                cotization.Cotization_id = order.Cotization.Cotization_id;
                cotization.Cotization_generation_date = DateTime.Parse(localDate.ToString("yyyy-MM-dd HH:mm:ss"));
                //Calculamos la cantidad de servicios y repuestos
                byte quantity = 0;
                quantity = Convert.ToByte(dts.Rows.Count + dtr.Rows.Count);
                cotization.Cotization_quantity = quantity;
                //Capturamos los comentarios técnicos
                cotization.Cotization_comentarys = txtComentarys.Text;
                //Calculamos el subtotal
                Decimal Dsubtotal = 0m;
                //Obtenemos la suma de los servicios
                for (int i = 0; i < dts.Rows.Count; i++)
                {
                    Service service = serviceLog.Read_once(dts.Rows[i][0].ToString());
                    //Creamos cotization_service (DETALLES)
                    Cotization_serviceFK cotization_ServiceFK = new Cotization_serviceFK
                    {
                        Cotization_id    = order.Cotization.Cotization_id,
                        Service_code     = service.Service_code,
                        Actionof         = txtArticleCode.Text,
                        Service_quantity = Convert.ToByte(dts.Rows[i][2].ToString()),
                    };
                    //Capturamos el costo en string
                    string strCost = service.Service_cost;
                    //Lo convertimos a decimal
                    decimal decCost = decimal.Parse(strCost, culture);
                    //Lo multiplicamos por la cantidad
                    decimal decAmount = decCost * cotization_ServiceFK.Service_quantity;
                    //Lo agregamos al objeto en formato string
                    cotization_ServiceFK.Service_amount = decAmount.ToString().Replace(',', '.');
                    //Lo sumamos en el subtotal
                    Dsubtotal += decAmount;
                    //Creamos el objeto cotization service
                    cotizationServiceLog.Create(cotization_ServiceFK);
                }
                //Obtenemos la suma de los repuestos
                for (int i = 0; i < dtr.Rows.Count; i++)
                {
                    Refaction refaction = refactionLog.Read_once(dtr.Rows[i][0].ToString());
                    //Creamos cotization_refaction (DETALLES)
                    Cotization_refactionFK cotization_RefactionFK = new Cotization_refactionFK
                    {
                        Cotization_id      = order.Cotization.Cotization_id,
                        Refaction_code     = refaction.Refaction_code,
                        Replacementof      = txtArticleCode.Text,
                        Refaction_quantity = Convert.ToByte(dtr.Rows[i][2].ToString()),
                    };
                    //Capturamos el precio unitario en string
                    string strPrice = refaction.Refaction_unit_price;
                    //Lo convertimos a decimal
                    decimal decPrice = decimal.Parse(strPrice, culture);
                    //Lo multiplicamos por la cantidad
                    decimal decAmountr = decPrice * cotization_RefactionFK.Refaction_quantity;
                    //Lo agregamos al objeto en formato string
                    cotization_RefactionFK.Refaction_amount = decAmountr.ToString().Replace(',', '.');
                    //Lo sumamos en el subtotal
                    Dsubtotal += decAmountr;
                    //Creamos el objeto cotization refaction
                    cotizationRefactionLog.Create(cotization_RefactionFK);
                    //subtotal += Decimal.Parse(cotization_RefactionFK.Refaction_amount);
                }
                Console.WriteLine("Subtotal decimal: " + Dsubtotal);
                Console.WriteLine("Subtotal string: " + Dsubtotal.ToString().Replace(',', '.'));
                cotization.Cotization_subtotal = Dsubtotal.ToString().Replace(',', '.');
                //Definimos el descuento->preguntar a EVANS si maneja descuento
                cotization.Cotization_discount = "0";
                //DEfinimos el IVA del subtotal->por ahora se hará con el 19%. pero se debe tener en cuenta el IVA
                //Consultamos el iva codigo 19
                decimal im = taxLog.Read_once_value("19");
                //Calculamos el IVA
                decimal iva = Dsubtotal * im;
                //Agregamos el string del iva al objeto cotization
                cotization.Cotization_iva = iva.ToString().Replace(',', '.');
                decimal total = Dsubtotal + iva;
                cotization.Cotization_total = total.ToString().Replace(',', '.');
                //Agregamos el usuario que la actualizará
                cotization.Update_by = UserCache.UserAccount;
                //Agregamos la fecha de actualizacion
                cotization.Update_date = cotization.Cotization_generation_date;
                //Actualizamos la cotización
                cotizationLog.Update(cotization);
                //Cambiamos el estado de la orden
                orderLog.UpdateState(order.Order_number, "Cotizada");
                DialogResult = DialogResult.Yes;
                this.Close();
            }
        }
 private void UpdateOrderState()
 {
     orderLog.UpdateState(txtOrderNumber.Text, "En espera");
 }