private Cotization GetEntity_v3(SqlDataReader ObjDr)
        {
            Cotization obj = new Cotization
            {
                Id              = ObjDr.GetColumnValue <Int32>("ID"),
                FileName        = ObjDr.GetColumnValue <String>("FileName"),
                FileDescription = ObjDr.GetColumnValue <String>("DESCRIPTION"),
                FileExtension   = ObjDr.GetColumnValue <String>("FileExtension"),
                FilePublicName  = ObjDr.GetColumnValue <String>("FilePublicname"),
                DOCTYPE         = ObjDr.GetColumnValue <String>("DOCTYPE"),
                NameResource    = ObjDr.GetColumnValue <String>("NameResource"),
                AplicationId    = ObjDr.GetColumnValue <Int32>("AplicationId"),
                UserId          = ObjDr.GetColumnValue <Int32>("DistributorId"),
                Photoid         = ObjDr.GetColumnValue <Int32>("LEGACYNUMBER"),
                Status          = ObjDr.GetColumnValue <Int16>("STATUS"),
                isUpload        = ObjDr.GetColumnValue <Int16>("ISUPLOAD"),
                Url             = ObjDr.GetColumnValue <String>("URL"),
                UnitPrice       = ObjDr.GetColumnValue <Decimal>("UnitPrice"),
                CategotyId      = ObjDr.GetColumnValue <Int32>("RESOURCECATEGORYID"),
                SystemContactId = ObjDr.GetColumnValue <Int32>("SYSTEMCONTACID"),
                Name            = ObjDr.GetColumnValue <String>("NAME"),
                TranslationKey  = ObjDr.GetColumnValue <String>("KeyName") ?? String.Empty,
                Category        = ObjDr.GetColumnValue <String>("Category").ToString()
            };

            return(obj);
        }
Exemple #2
0
        //Evento del botón "Crear"
        private void IbtnCreate_Click(object sender, EventArgs e)
        {
            if (ValidateFields())
            {
                Order order = new Order();
                order.Order_number         = txtNumber.Text;
                order.Order_reception_date = DateTime.Parse(dtpDateReception.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                order.Order_type           = cboType.Text;
                order.Order_invoice        = txtInvoice.Text;
                if (txtInvoice.Enabled)
                {
                    order.Order_sale_date = dtpSaleDate.Value;
                }
                //order.Order_comentarys = ""; -> Por definir funcionalidad
                order.Order_report_client = txtReportClient.Text;
                //Técnico
                Technician t = technicianLog.Read_once(txtTechnicianId.Text);
                order.Technician = t;
                //Cliente
                Client c = clientLog.Read_once(txtClientId.Text);
                order.Client = c;
                //Cotización
                //Creamos cotización
                Cotization cotization = new Cotization
                {
                    Cotization_id = "CT-" + PrOrder[cboType.SelectedIndex] + "" + orderLog.Read_count().ToString()
                };
                cotizationLog.Create(cotization);
                //Consultamos la cotización
                Cotization cn = cotizationLog.Read_once(cotization.Cotization_id);
                //MessageBox.Show("Cotizacion: " + cn.Cotization_id);
                order.Cotization = cn;
                //Capturamos el usuario que creará la orden
                order.Create_by = UserCache.UserAccount;                                          //Enviar desde el DAO
                //Capturamos el momento de la creacion
                order.Create_date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //Desde el DAO mejor
                //Creación de orden
                orderLog.Create(order);
                //Creamos el order_article para que asigne el artículo sobre el cual se va a operar
                //En una orden van n articulos, estos se definen en la tabla
                //for (int i = 0; i < dtoa.Rows.Count; i++)
                //{
                Order_articleFK order_articleFK = new Order_articleFK
                {
                    Order_number   = order.Order_number,
                    Article_code   = txtArticleCod.Text,
                    Model          = txtArticleModel.Text,
                    Especification = txtArticleEsp.Text,
                    Serial         = txtArticleSerial.Text
                };
                orderArticleLog.Create(order_articleFK);
                //}

                //Enviamos al caché la variable numero de orden
                Order.Order_number_st = order.Order_number;
                ViewReportOrderCreate();
                ResetControls(sender, e);
            }
        }
Exemple #3
0
        public Order Read_once(string number)
        {
            Order order = new Order();

            try
            {
                Database.Connect();
                command = new OdbcCommand
                {
                    Connection  = Database.GetConn(),
                    CommandType = CommandType.StoredProcedure,
                    CommandText = "{call csg.Order_ReadOnce(?)}"
                };
                command.Parameters.Add("Number", OdbcType.VarChar, 50).Value = number;
                dataReader = command.ExecuteReader();
                if (dataReader.Read())
                {
                    order = new Order
                    {
                        Order_number         = dataReader.GetString(0),
                        Order_reception_date = dataReader.GetDateTime(1),
                        //Order_end_date = dataReader.GetDateTime(2),
                        Order_type    = dataReader.GetString(3),
                        Order_invoice = dataReader.GetString(4),
                        //Order_sale_date = dataReader.GetDate(5),
                        Order_state = dataReader.GetString(6),
                        //Order_comentarys = dataReader.GetString(7),
                        Order_report_client = dataReader.GetString(8)
                    };
                    string t  = dataReader.GetString(9);
                    string c  = dataReader.GetString(10);
                    string ct = dataReader.GetString(11);
                    Database.Disconnect();
                    ITechnicianDAO technicianDAO = new TechnicianDAO();
                    Technician     technician    = technicianDAO.Read_once(t);
                    order.Technician = technician;
                    IClientDAO clientDAO = new ClientDAO();
                    Client     client    = clientDAO.Read_once(c);
                    order.Client = client;
                    ICotizationDAO cotizationDAO = new CotizationDAO();
                    Cotization     cotization    = cotizationDAO.Read_once(ct);
                    order.Cotization = cotization;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Excepción controlada en OrderDAO->Read_once: " + ex.Message, "Excepción", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Database.Disconnect();
            }
            return(order);
        }
        public Boolean SaveMyPhoto(ref BaseEntity Entity, Cotization Resource)
        {
            Boolean    success = false;
            SqlCommand cmd     = null;

            try
            {
                cmd = new SqlCommand("[SP_APPRESOURCES_MYPICTURE_SAVE]", clsConnection.GetConnection())
                {
                    CommandType = CommandType.StoredProcedure
                };

                SqlParameter outputParam = cmd.Parameters.Add("@PUBLICNAME", SqlDbType.VarChar, 100);
                outputParam.Direction = ParameterDirection.Output;
                outputParam           = cmd.Parameters.Add("@NEWID", SqlDbType.VarChar, 100);
                outputParam.Direction = ParameterDirection.Output;

                cmd.Parameters.AddWithValue("@FILEID", Resource.ID);
                cmd.Parameters.AddWithValue("@FILENAME", Resource.FileName);
                cmd.Parameters.AddWithValue("@DOCTYPE", Resource.DOCTYPE);
                cmd.Parameters.AddWithValue("@FILEPUBLICNAME", Resource.FilePublicName);
                cmd.Parameters.AddWithValue("@DESCRIPTION", Resource.FileDescription);
                cmd.Parameters.AddWithValue("@FILEEXTENSION", Resource.FileExtension);
                cmd.Parameters.AddWithValue("@NAMERESOURCE", Resource.FilePublicName + Resource.FileExtension);
                cmd.Parameters.AddWithValue("@APLICATIONID", Resource.AplicationId);
                cmd.Parameters.AddWithValue("@DISTRIBUTORID", Resource.UserId);
                cmd.Parameters.AddWithValue("@CREATEDBY", Resource.Createdby);
                cmd.Parameters.AddWithValue("@STATUS", Resource.Status);

                cmd.ExecuteNonQuery();

                if (!String.IsNullOrEmpty(cmd.Parameters["@PUBLICNAME"].Value.ToString()))
                {
                    Resource.FilePublicName = Convert.ToString(cmd.Parameters["@PUBLICNAME"].Value);
                }
                if (!String.IsNullOrEmpty(cmd.Parameters["@NEWID"].Value.ToString()))
                {
                    Resource.ID = Convert.ToInt32(cmd.Parameters["@NEWID"].Value);
                    Entity.ID   = Resource.ID;
                }
                success = true;
            }
            catch (Exception ex)
            {
                success = false;
                Entity.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  saving an Event."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(success);
        }
Exemple #5
0
        public Cotization Read_once(string id)
        {
            Cotization cotization = new Cotization();

            try
            {
                //Console.WriteLine("Conexion Cotizacion: " + Database.GetConn().State);
                if (!Database.GetConn().State.ToString().Equals("Open"))
                {
                    Database.Connect();
                }
                command = new OdbcCommand
                {
                    Connection  = Database.GetConn(),
                    CommandType = CommandType.StoredProcedure,
                    CommandText = "{call csg.Cotization_ReadOnce(?)}"
                };
                command.Parameters.Add("Id", OdbcType.VarChar, 50).Value = id;
                dataReader = command.ExecuteReader();
                if (dataReader.Read())
                {
                    cotization = new Cotization
                    {
                        Cotization_id = dataReader.GetString(0),
                        Cotization_generation_date = dataReader.GetDateTime(1),
                        Cotization_expiration_date = dataReader.GetDateTime(2),
                        Cotization_quantity        = dataReader.GetByte(3),
                        Cotization_comentarys      = dataReader.GetString(4),
                        Cotization_subtotal        = dataReader.GetString(5),
                        Cotization_discount        = dataReader.GetString(6),
                        Cotization_iva             = dataReader.GetString(7),
                        Cotization_total           = dataReader.GetString(8)
                    };
                }
                else
                {
                    cotization = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Excepción controlada en CotizationDAO->Read_once: " + ex.Message, "Excepción", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Database.Disconnect();
            }
            return(cotization);
        }
Exemple #6
0
        public Cotization AppResource_GetByID(ref BaseEntity entity, Int32 ID)
        {
            entity = new BaseEntity();
            Cotization dt = null;

            if (ID > 0)
            {
                dt = CotizationDAO.Instance.GetAllByID(ref entity, ID);
            }
            else
            {
                entity.Errors.Add(new BaseEntity.ListError(new Exception {
                }, "An error occurred sending data"));
            }
            return(dt);
        }
        public Cotization GetAllByID(ref BaseEntity Base, Int32 ID)
        {
            Cotization objAppResource = new Cotization();
            //List<clsLanguage> lstLanguages = new List<clsLanguage>(); comente
            SqlDataReader dr  = null;
            SqlCommand    cmd = null;

            try
            {
                cmd = new SqlCommand("AppResource_GetById_Sp", clsConnection.GetConnection())
                {
                    CommandType = CommandType.StoredProcedure
                };
                cmd.Parameters.AddWithValue("@ID", ID);
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    objAppResource = GetEntity_v3(dr);
                }

                dr.NextResult();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        //clsLanguage lang = new clsLanguage
                        //{
                        //    ID = dr.GetColumnValue<Int32>("LANGUAGEID")
                        //};
                        //lstLanguages.Add(lang);           comente
                    }
                    //objAppResource.ListLanguage = lstLanguages; comente
                }
            }
            catch (Exception ex)
            {
                objAppResource = null;
                Base.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  getting a Cotization by it's Id."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(objAppResource);
        }
Exemple #8
0
        public void Create(Cotization cotization)
        {
            try
            {
                Database.Connect();
                command = new OdbcCommand
                {
                    Connection  = Database.GetConn(),
                    CommandType = CommandType.StoredProcedure,
                    CommandText = "{call csg.Cotization_Create(?,?,?,?,?,?,?,?,?)}"
                };
                command.Parameters.Add("Id", OdbcType.VarChar, 50).Value = cotization.Cotization_id;
                //command.Parameters.Add("GenerationDate", OdbcType.DateTime).Value = null;
                //command.Parameters.Add("ExpirationDate", OdbcType.DateTime).Value = null;
                command.Parameters.Add("Quantity", OdbcType.SmallInt).Value        = cotization.Cotization_quantity;
                command.Parameters.Add("Comentarys", OdbcType.VarChar, 1000).Value = cotization.Cotization_comentarys;
                command.Parameters.Add("Subtotal", OdbcType.VarChar, 14).Value     = cotization.Cotization_subtotal;
                command.Parameters.Add("Discount", OdbcType.VarChar, 14).Value     = cotization.Cotization_discount;
                command.Parameters.Add("Iva", OdbcType.VarChar, 14).Value          = cotization.Cotization_iva;
                command.Parameters.Add("Total", OdbcType.VarChar, 14).Value        = cotization.Cotization_total;
                command.Parameters.Add("CreateBy", OdbcType.VarChar, 50).Value     = UserCache.UserCode;
                command.Parameters.Add("CreateDate", OdbcType.DateTime).Value      = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                if (command.ExecuteNonQuery() > 0)
                {
                    Console.WriteLine("Cotización creada exitosamente");
                    //MessageBox.Show("Cotización creada exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    Console.WriteLine("No se ha creado la cotización");
                    //MessageBox.Show("No se ha creado la cotización", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Excepción controlada en CotizationDAO->Create: " + ex.Message, "Excepción", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Database.Disconnect();
            }
        }
Exemple #9
0
        public List <Cotization> Read_all()
        {
            List <Cotization> cotizations = new List <Cotization>();

            try
            {
                Database.Connect();
                command = new OdbcCommand
                {
                    Connection  = Database.GetConn(),
                    CommandType = CommandType.StoredProcedure,
                    CommandText = "{call csg.Cotization_ReadAll}"
                };
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    Cotization cotization = new Cotization
                    {
                        Cotization_id = dataReader.GetString(0),
                        Cotization_generation_date = dataReader.GetDateTime(1),
                        Cotization_expiration_date = dataReader.GetDateTime(2),
                        Cotization_quantity        = dataReader.GetByte(3),
                        Cotization_comentarys      = dataReader.GetString(4),
                        Cotization_subtotal        = dataReader.GetString(5),
                        Cotization_discount        = dataReader.GetString(6),
                        Cotization_iva             = dataReader.GetString(7),
                        Cotization_total           = dataReader.GetString(8)
                    };
                    cotizations.Add(cotization);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Excepción controlada en CotizationDAO->Read_all: " + ex.Message, "Excepción", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Database.Disconnect();
            }
            return(cotizations);
        }
        public Int32 Get_QuantityLegalDocuments(ref BaseEntity Entity, Cotization resource /*, tBaseLanguagueIdList ListLanguage*/)
        {
            Int32      quantity = -1;
            SqlCommand cmd      = null;

            try
            {
                cmd = new SqlCommand("[AppResource_QuantityLegalDocuments_Sp]", clsConnection.GetConnection())
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.AddWithValue("@RESOURCECATEGORYID", resource.CategotyId);
                cmd.Parameters.AddWithValue("@RESOURCEID", resource.ID);

                //if (ListLanguage.Count > 0)
                //{
                //    cmd.Parameters.Add(new SqlParameter { ParameterName = "@TYPE_LANGUAGEID", Value = ListLanguage, SqlDbType = SqlDbType.Structured, TypeName = "dbo.TY_GET_LANGUAGESID" });
                //}

                SqlParameter outputParam = cmd.Parameters.Add("@QUANTITY", SqlDbType.Int);
                outputParam.Direction = ParameterDirection.Output;

                cmd.ExecuteNonQuery();
                if (!String.IsNullOrEmpty(cmd.Parameters["@QUANTITY"].Value.ToString()))
                {
                    quantity = Convert.ToInt32(cmd.Parameters["@QUANTITY"].Value);
                }
            }
            catch (Exception ex)
            {
                quantity = -1;
                Entity.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  deleting a resource."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(quantity);
        }
        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();
            }
        }
Exemple #12
0
 public void Update(Cotization cotization)
 {
     DAOFactory.GetCotizationDAO().Update(cotization);
 }
Exemple #13
0
 public void Create(Cotization cotization)
 {
     DAOFactory.GetCotizationDAO().Create(cotization);
 }
        private void FrmCotizationViewer_Load(object sender, EventArgs e)
        {
            order = orderLog.Read_once(Order.Order_number_st);
            //Si la orden es "en espera"D
            if (order.Order_state.Equals("En espera"))
            {
                //Bloqueamos botones guardar y guardar & enviar
                IbtnSave.Enabled     = false;
                IbtnSaveSend.Enabled = false;
                //Visibilidad false botones anteriores
                IbtnSave.Visible     = false;
                IbtnSaveSend.Visible = false;
                //Movemos los botones a la posicion deseada
                IbtnFacturar.Location = new Point(816, 21);
                IbtnCancel.Location   = new Point(764, 21);
                IbtnEdit.Location     = new Point(685, 21);
            }
            else if (order.Order_state.Equals("Cotizada"))
            {
                //Ocultamos los botones del if
                IbtnFacturar.Visible = false;
                IbtnCancel.Visible   = false;
                IbtnEdit.Visible     = false;
            }
            else if (order.Order_state.Equals("Cancelada") || order.Order_state.Equals("Facturada"))
            {
                panel2.Visible = false;
            }
            txtCotizationId.Text = order.Cotization.Cotization_id;
            txtOrderType.Text    = order.Order_type;
            txtOrderNumber.Text  = order.Order_number;
            txtOrderState.Text   = order.Order_state;
            dtpGeneration.Value  = order.Cotization.Cotization_generation_date;
            //Agregamos el cliente
            txtClientId.Text       = order.Client.Client_id;
            txtClientName.Text     = order.Client.Client_name;
            txtClientAddress.Text  = order.Client.Client_address;
            txtClientLocation.Text = order.Client.Client_location;
            txtClientCity.Text     = order.Client.Client_city;
            txtClientDpt.Text      = order.Client.Client_department;
            txtClientTel1.Text     = order.Client.Client_tel1;
            txtClientTel2.Text     = order.Client.Client_tel2;
            txtClientEmail.Text    = order.Client.Client_email;
            //Agregamos el equipo
            //Article article = articleLog.Read_once(orderArticleLog.Read_code_article_of_order(Order.Order_number_st));
            //txtArticleCode.Text = article.Article_code;
            //txtArticleDescription.Text = article.Article_description;
            CreateDataTables();
            //Agregamos los articulos
            AddArticles();

            //Agregamos los servicios
            AddServices();
            //Agregamos los repuesto
            AddRefactions();
            //Comentarios
            //Console.WriteLine("Reporte cliente: " + order.Order_report_client);
            string comentarys = "";

            comentarys += "Cliente: " + Environment.NewLine + order.Order_report_client +
                          Environment.NewLine + Environment.NewLine;
            Cotization cotization = cotizationLog.Read_once(txtCotizationId.Text);

            comentarys        += "Técnico: " + Environment.NewLine + cotization.Cotization_comentarys;
            txtComentarys.Text = cotization.Cotization_comentarys;
            //Cargamos subtotal, descuento, iva y total
            lblSubtotal.Text = decimal.Parse(cotization.Cotization_subtotal, culture).ToString("C2");
            lblDiscount.Text = decimal.Parse(cotization.Cotization_discount, culture).ToString("C2");
            lblIva.Text      = decimal.Parse(cotization.Cotization_iva, culture).ToString("C2");
            lblTotal.Text    = decimal.Parse(cotization.Cotization_total, culture).ToString("C2");
        }
        public Boolean Save(ref BaseEntity Entity, /*tBaseLanguagueIdList listLanguages,*/ Cotization Resource, Boolean RegisterTBL = false, String UserName = "")
        {
            Boolean    success = false;
            SqlCommand cmd     = null;

            try
            {
                cmd = new SqlCommand("Cotization_SaveFile_Sp", clsConnection.GetConnection())
                {
                    CommandType = CommandType.StoredProcedure
                };

                SqlParameter outputParam = cmd.Parameters.Add("@PUBLICNAME", SqlDbType.VarChar, 100);
                outputParam.Direction = ParameterDirection.Output;

                cmd.Parameters.AddWithValue("@FILEID", Resource.ID);
                cmd.Parameters.AddWithValue("@FILENAME", Resource.FileName);
                cmd.Parameters.AddWithValue("@DOCTYPE", Resource.DOCTYPE);
                cmd.Parameters.AddWithValue("@FILEPUBLICNAME", Resource.FilePublicName);
                cmd.Parameters.AddWithValue("@DESCRIPTION", Resource.FileDescription);
                cmd.Parameters.AddWithValue("@FILEEXTENSION", Resource.FileExtension);
                cmd.Parameters.AddWithValue("@NAMERESOURCE", Resource.NameResource);
                cmd.Parameters.AddWithValue("@DISTRIBUTORID", Resource.UserId);
                cmd.Parameters.AddWithValue("@CREATEDBY", Resource.Createdby);
                cmd.Parameters.AddWithValue("@STATUS", Resource.Status);
                cmd.Parameters.AddWithValue("@USERNAME", UserName);
                cmd.Parameters.AddWithValue("@URL", Resource.Url);
                cmd.Parameters.AddWithValue("@ISUPLOAD", Resource.isUpload);
                cmd.Parameters.AddWithValue("@RESOURCECATEGORYID", Resource.CategotyId);
                cmd.Parameters.AddWithValue("@NAME", Resource.Name);
                cmd.Parameters.AddWithValue("@COMPANY", Resource.Company);
                cmd.Parameters.AddWithValue("@PHONE", Resource.Phone);

                success = cmd.ExecuteNonQuery() > 0;
                if (!String.IsNullOrEmpty(cmd.Parameters["@PUBLICNAME"].Value.ToString()))
                {
                    Resource.FilePublicName = Convert.ToString(cmd.Parameters["@PUBLICNAME"].Value);
                }
            }
            catch (Exception ex)
            {
                success = false;
                Entity.Errors.Add(new BaseEntity.ListError(ex, "An error occurred  saving an Event."));
            }
            finally
            {
                clsConnection.DisposeCommand(cmd);
            }
            return(success);
        }
Exemple #16
0
        public Boolean AppResource_Save(ref BaseEntity Entity, /*tBaseLanguagueIdList listLanguages,*/ Cotization Resource, Boolean RegisterTBL = false, String Username = "")
        {
            Boolean success = false;

            Entity = new BaseEntity();

            success = CotizationDAO.Instance.Save(ref Entity, /*listLanguages,*/ Resource, RegisterTBL, Username);

            return(success);
        }
Exemple #17
0
 public Int32 Get_QuantityLegalDocuments(ref BaseEntity Base, Cotization resource /*, tBaseLanguagueIdList ListLanguage*/)
 {
     return(CotizationDAO.Instance.Get_QuantityLegalDocuments(ref Base, resource /*, ListLanguage*/));
 }