Пример #1
0
        //Borro la tabla temporal
        public static void DeleteTmpArtiObra(ClsArticuloObra ArtiO)
        {
            try
            {
                SqlParameter[] Parameters;
                Parameters = new SqlParameter[1];

                if (ArtiO.IdArticuloTmp != 0)
                {
                    Parameters[0]               = new SqlParameter();
                    Parameters[0].Direction     = ParameterDirection.Input;
                    Parameters[0].SqlDbType     = SqlDbType.Int;
                    Parameters[0].ParameterName = "@IdArti";
                    Parameters[0].Value         = ArtiO.IdArticuloTmp;
                }

                if (ArtiO.IdArticuloTmp == 0)
                {
                    Parameters[0]               = new SqlParameter();
                    Parameters[0].Direction     = ParameterDirection.Input;
                    Parameters[0].SqlDbType     = SqlDbType.Int;
                    Parameters[0].ParameterName = "@IdArti";
                    Parameters[0].Value         = null;
                }


                Data DataAccess = new Data(System.Configuration.ConfigurationManager.ConnectionStrings["SISCOC_FEL.Properties.Settings.SISCOC_CON"].ToString());
                DataAccess.ExecuteSPQuery(Parameters, "Sp_Delete_TempArtiObra");
                DataAccess.CloseConnection();
            }
            catch (Exception EX)
            {
                throw new Exception(EX.Message, EX.InnerException);
            }
        }
Пример #2
0
        private static SqlParameter[] SplitItemToParameterTmp(ClsArticuloObra ArtiObra, int Opcion, int Id)
        {
            try
            {
                SqlParameter[] Parameters;
                //if (Id == 0)
                //Parameters = new SqlParameter[3];
                //else
                Parameters = new SqlParameter[5];

                Parameters[0]               = new SqlParameter();
                Parameters[0].Direction     = ParameterDirection.Input;
                Parameters[0].SqlDbType     = SqlDbType.Int;
                Parameters[0].ParameterName = "@Opcion";
                Parameters[0].Value         = Opcion;

                Parameters[1]               = new SqlParameter();
                Parameters[1].Direction     = ParameterDirection.Input;
                Parameters[1].SqlDbType     = SqlDbType.Int;
                Parameters[1].ParameterName = "@IdArticulo";
                Parameters[1].Value         = ArtiObra.IdArticulo;


                Parameters[2]               = new SqlParameter();
                Parameters[2].Direction     = ParameterDirection.Input;
                Parameters[2].SqlDbType     = SqlDbType.VarChar;
                Parameters[2].ParameterName = "@Descripcion";
                Parameters[2].Value         = ArtiObra.Descripcion;


                Parameters[3]               = new SqlParameter();
                Parameters[3].Direction     = ParameterDirection.Input;
                Parameters[3].SqlDbType     = SqlDbType.VarChar;
                Parameters[3].ParameterName = "@Cantidad";
                Parameters[3].Value         = ArtiObra.CantidadArt;

                if (Id != 0)
                {
                    Parameters[4]               = new SqlParameter();
                    Parameters[4].Direction     = ParameterDirection.Input;
                    Parameters[4].SqlDbType     = SqlDbType.VarChar;
                    Parameters[4].ParameterName = "@Id";
                    Parameters[4].Value         = Id;
                }
                else
                {
                    Parameters[4]               = new SqlParameter();
                    Parameters[4].Direction     = ParameterDirection.Input;
                    Parameters[4].SqlDbType     = SqlDbType.VarChar;
                    Parameters[4].ParameterName = "@Id";
                    Parameters[4].Value         = 0;
                }

                return(Parameters);
            }
            catch (Exception EX)
            {
                throw new Exception(EX.Message, EX.InnerException);
            }
        }
Пример #3
0
 //Guarda los articulos en una tabla de paso.
 public static void AddArtObraTmp(ClsArticuloObra ArtObraTmp, int Opcion, int Id)
 {
     try
     {
         Data DataAccess = new Data(System.Configuration.ConfigurationManager.ConnectionStrings["SISCOC_FEL.Properties.Settings.SISCOC_CON"].ToString());
         DataAccess.ExecuteSPNonQuery(SplitItemToParameterTmp(ArtObraTmp, Opcion, Id), "Sp_Insert_TempArtiObra");
         DataAccess.CloseConnection();
     }
     catch (Exception EX)
     {
         throw new Exception(EX.Message, EX.InnerException);
     }
 }
Пример #4
0
        private static ClsArticuloObra FillTmp(DataRow Row)
        {
            ClsArticuloObra ArtiObraTmp = new ClsArticuloObra();

            try
            {
                ArtiObraTmp.ArticuloTmp   = Convert.ToString(Row["Descripcion"]);
                ArtiObraTmp.IdArticuloTmp = Convert.ToInt32(Row["IdArticulo"]);
                ArtiObraTmp.CantidadArt   = Convert.ToDecimal(Row["Cantidad"]);

                return(ArtiObraTmp);
            }


            catch (Exception EX)
            {
                throw new Exception(EX.Message, EX.InnerException);
            }
        }
Пример #5
0
        //Actualizo la información.
        public static void UpdateArticuloObra(ClsArticuloObra ArtiObr, int Opcion)
        {
            try
            {
                SqlParameter[] Parameters;
                Parameters = new SqlParameter[4];

                Parameters[0]               = new SqlParameter();
                Parameters[0].Direction     = ParameterDirection.Input;
                Parameters[0].SqlDbType     = SqlDbType.Int;
                Parameters[0].ParameterName = "@Opcion";
                Parameters[0].Value         = Opcion;

                Parameters[1]               = new SqlParameter();
                Parameters[1].Direction     = ParameterDirection.Input;
                Parameters[1].SqlDbType     = SqlDbType.Int;
                Parameters[1].ParameterName = "@IdArticuloObra";
                Parameters[1].Value         = ArtiObr.IdArticuloObra;

                Parameters[2]               = new SqlParameter();
                Parameters[2].Direction     = ParameterDirection.Input;
                Parameters[2].SqlDbType     = SqlDbType.Int;
                Parameters[2].ParameterName = "@IdObra";
                Parameters[2].Value         = ArtiObr.IdObra;

                Parameters[3]               = new SqlParameter();
                Parameters[3].Direction     = ParameterDirection.Input;
                Parameters[3].SqlDbType     = SqlDbType.Int;
                Parameters[3].ParameterName = "@Proveedor";
                Parameters[3].Value         = ArtiObr.IdProveedor;

                Data DataAccess = new Data(System.Configuration.ConfigurationManager.ConnectionStrings["SISCOC_FEL.Properties.Settings.SISCOC_CON"].ToString());
                DataAccess.ExecuteSPQuery(Parameters, "Sp_Update_ArticuloObra");
                DataAccess.CloseConnection();
            }
            catch (Exception EX)
            {
                throw new Exception(EX.Message, EX.InnerException);
            }
        }
Пример #6
0
        private static ClsArticuloObra FillArtis(DataRow Row)
        {
            ClsArticuloObra ArtiObra = new ClsArticuloObra();


            try
            {
                ArtiObra.IdArticuloObra = Convert.ToInt32(Row["IdArticuloObra"]);
                //ArtiObra.IdObra = Convert.ToInt32(Row["IdObra"]);
                //ArtiObra.Proveedor = Convert.ToString(Row["Proveedor"]);
                //ArtiObra.Factura = Convert.ToString(Row["Factura"]);
                ArtiObra.IdArticulo  = Convert.ToInt32(Row["IdArticulo"]);
                ArtiObra.CantidadArt = Convert.ToDecimal(Row["Cantidad"]);
                ArtiObra.Descripcion = Convert.ToString(Row["Articulo"]);

                return(ArtiObra);
            }
            catch (Exception EX)
            {
                throw new Exception(EX.Message, EX.InnerException);
            }
        }
Пример #7
0
 //busca por Id de Aplicacion
 public bool BuscaFacturaLike(ClsArticuloObra FilterFacturaList)
 {
     return(FilterFacturaList.Factura.ToUpper().Contains(FilterFacturaLists.ToUpper()));
 }
Пример #8
0
        //Agrego el Articulo-Obra
        private static SqlParameter[] SplitItemToParamArtiObra(ClsArticuloObra ArtiObra, int Opcion)
        {
            try
            {
                SqlParameter[] Parameters;

                if (Opcion == 1)
                {
                    Parameters = new SqlParameter[2];
                }
                else
                {
                    Parameters = new SqlParameter[7];
                }


                Parameters[0]               = new SqlParameter();
                Parameters[0].Direction     = ParameterDirection.Input;
                Parameters[0].SqlDbType     = SqlDbType.Int;
                Parameters[0].ParameterName = "@Opcion";
                Parameters[0].Value         = Opcion;

                Parameters[1]               = new SqlParameter();
                Parameters[1].Direction     = ParameterDirection.Input;
                Parameters[1].SqlDbType     = SqlDbType.Int;
                Parameters[1].ParameterName = "@IdObra";
                Parameters[1].Value         = ArtiObra.IdObra;


                if (Opcion != 1)
                {
                    Parameters[2]               = new SqlParameter();
                    Parameters[2].Direction     = ParameterDirection.Input;
                    Parameters[2].SqlDbType     = SqlDbType.Int;
                    Parameters[2].ParameterName = "@Proveedor";
                    Parameters[2].Value         = ArtiObra.IdProveedor;

                    Parameters[3]               = new SqlParameter();
                    Parameters[3].Direction     = ParameterDirection.Input;
                    Parameters[3].SqlDbType     = SqlDbType.VarChar;
                    Parameters[3].ParameterName = "@Factura";
                    Parameters[3].Value         = ArtiObra.Factura;

                    Parameters[4]               = new SqlParameter();
                    Parameters[4].Direction     = ParameterDirection.Input;
                    Parameters[4].SqlDbType     = SqlDbType.Int;
                    Parameters[4].ParameterName = "@IdArticulo";
                    Parameters[4].Value         = ArtiObra.IdArticulo;

                    Parameters[5]               = new SqlParameter();
                    Parameters[5].Direction     = ParameterDirection.Input;
                    Parameters[5].SqlDbType     = SqlDbType.Decimal;
                    Parameters[5].ParameterName = "@CantidadArt";
                    Parameters[5].Value         = ArtiObra.CantidadArt;

                    Parameters[6]               = new SqlParameter();
                    Parameters[6].Direction     = ParameterDirection.Input;
                    Parameters[6].SqlDbType     = SqlDbType.Decimal;
                    Parameters[6].ParameterName = "@IdArticuloObra";
                    Parameters[6].Value         = ArtiObra.IdArticuloObra;
                }
                return(Parameters);
            }
            catch (Exception EX)
            {
                throw new Exception(EX.Message, EX.InnerException);
            }
        }