Beispiel #1
0
        public Task <FeatureValue> GetById(int id)
        {
            var featureValue = Task.FromResult(_dapperManager.Get <FeatureValue>($"select * from [FeatureValue] where ID = {id}", null,
                                                                                 commandType: CommandType.Text));

            return(featureValue);
        }
Beispiel #2
0
        public Task <int> Count(string search)
        {
            var totArticle = Task.FromResult(_dapperManager.Get <int>($"select COUNT(*) from [Books] WHERE BookName like '%{search}%'", null,
                                                                      commandType: CommandType.Text));

            return(totArticle);
        }
Beispiel #3
0
        public Task <ClientCategores> GetById(int id)
        {
            var article = Task.FromResult(_dapperManager.Get <ClientCategores>($"select * from [ClientCategores] where ClientCategoryId = {id}", null,
                                                                               commandType: CommandType.Text));

            return(article);
        }
        //ESTE OBTINE EL ID DEL LOGIN
        public Task <string> getloginID(string UserID, string passID)
        {
            var article = Task.FromResult(_dapperManager.Get <string>($"select ID_login from [login] where UserID = '{UserID}' and passID = '{passID}' ", null,
                                                                      commandType: CommandType.Text));

            return(article);
        }
Beispiel #5
0
        public Task <BookGenres> GetById(int id)
        {
            var article = Task.FromResult(_dapperManager.Get <BookGenres>($"select * from [BookGenres] where BookGenreId = {id}", null,
                                                                          commandType: CommandType.Text));

            return(article);
        }
Beispiel #6
0
        public Task <int> Create(Customer customer)
        {
            var productId = Task.FromResult(_dapperManager.Get <int>($"INSERT INTO [Customer](CustomerName,CustomerPhone,CustomerEmail,CustomerCompany,DELETED,UpdatedDateTime,UpdatedBy) OUTPUT Inserted.ID VALUES('{customer.CustomerName}','{customer.CustomerPhone}','{customer.CustomerEmail}','{customer.CustomerCompany}','{false}',CONVERT(datetime,'{customer.UpdatedDateTime}',103),'{customer.UpdatedBy}')", null,
                                                                     commandType: CommandType.Text));

            return(productId);
        }
Beispiel #7
0
        public Task <Authors> GetById(int id)
        {
            var article = Task.FromResult(_dapperManager.Get <Authors>($"select * from [Authors] where AuthorId = {id}", null,
                                                                       commandType: CommandType.Text));

            return(article);
        }
Beispiel #8
0
        public Task <int> Create(Stock stock)
        {
            var productId = Task.FromResult(_dapperManager.Get <int>($"INSERT INTO [Stock](ProductID,StockCost,StockQty,DELETED,UpdatedDateTime,UpdatedBy) OUTPUT Inserted.ID VALUES('{stock.ProductID}','{stock.StockCost}','{stock.StockQty}','{false}',CONVERT(datetime,'{stock.UpdatedDateTime}',103),'{stock.UpdatedBy}')", null,
                                                                     commandType: CommandType.Text));

            return(productId);
        }
Beispiel #9
0
        public Task <c_order> GetById(int id)
        {
            var article = Task.FromResult(_dapperManager.Get <c_order>($"select * from c_order where ID = {id}", null,
                                                                       commandType: CommandType.Text));

            return(article);
        }
Beispiel #10
0
        public Task <int> Create(SaleTxn saleTxn)
        {
            var dbPara = new DynamicParameters();

            var articleId = Task.FromResult(_dapperManager.Get <int>(
                                                $"INSERT INTO [SaleTxn](SaleTxnStatus, SaleTxnQty, SaleTxnSubTotal, SaleReceivedQty, SaleTxnProductID, SaleTxnOrderID ,DELETED, UpdatedDateTime, UpdatedBy) OUTPUT Inserted.ID VALUES('{saleTxn.SaleTxnStatus}','{saleTxn.SaleTxnQty}','{saleTxn.SaleSubTotal}', '{saleTxn.SaleReceivedQty}','{saleTxn.SaleProduct.ID}','{saleTxn.SaleTxnOrderID}' ,'{false}', CONVERT(datetime,'{saleTxn.UpdatedDateTime}',103), '{saleTxn.UpdatedBy}')",
                                                null,
                                                commandType: CommandType.Text));

            return(articleId);
        }
        public Task <int> Create(Article article)
        {
            var dbPara = new DynamicParameters();

            dbPara.Add("Title", article.Title, DbType.String);

            var articleId = Task.FromResult(_dapperManager.Get <int>($"INSERT INTO Article(Title) OUTPUT Inserted.ID VALUES('{article.Title}')", null,
                                                                     commandType: CommandType.Text));

            return(articleId);
        }
Beispiel #12
0
        public Task <int> GetVtype(string vtype)
        {
            var dbPara = new DynamicParameters();

            dbPara.Add("@Vtype", vtype, DbType.String);
            var Vouchertype = Task.FromResult(_dapperManager.Get <int>($"SELECT ID FROM VTypeTran WHERE VType=@Vtype", dbPara, commandType: CommandType.Text));

            return(Vouchertype);
            //($"SELECT * FROM [Article] WHERE Title like '%{search}%' ORDER BY {orderBy} {direction} OFFSET {skip} ROWS FETCH NEXT {take} ROWS ONLY; ", null, commandType: CommandType.Text));

            // return (int)idbopn.GetScalar("SELECT ID FROM VTypeTran WHERE VType='Sales POS'");
        }
Beispiel #13
0
        public Task <Clients> GetById(int id)
        {
            return(Task.Run(() =>
            {
                var article = _dapperManager.Get <Clients>($"select * from [Clients] where ClientId = {id}", null,
                                                           commandType: CommandType.Text);
                article.BookList = _dapperManager.GetAll <Books>($"select b.* From Books as b Inner join ClientBook as c on c.BookId = b.BookId where c.ClientId = {id}", null,
                                                                 commandType: CommandType.Text);

                return article;
            }));
        }
        public Task <int> Create(Product product)
        {
            var dictionary = new Dictionary <string, object>
            {
                { "@UpdatedDateTime", 1 }
            };
            var parameters = new DynamicParameters(dictionary);
            var productId  = Task.FromResult(_dapperManager.Get <int>($"INSERT INTO [Product](ProductName,ProductDetails,ProductOrigin,ProductPrice,DELETED,UpdatedDateTime,UpdatedBy) OUTPUT Inserted.ID VALUES('{product.ProductName}','{product.ProductDetails}','{product.ProductOrigin}','{product.ProductPrice}','{false}',@UpdatedDateTime,'{product.UpdatedBy}')", parameters,
                                                                      commandType: CommandType.Text));

            return(productId);
        }
        //public Task<int> GetLoginToken(User user)
        //{
        //    throw new System.NotImplementedException();
        //}

        public bool Verify(User user)
        {
            var dbPara = new DynamicParameters();

            //TODO: encrypt password
            dbPara.Add("@UserName", user.UserName, DbType.String);
            dbPara.Add("@PasswordHash", user.PasswordHash, DbType.String);

            var verified = Task.FromResult(_dapperManager.Get <int>
                                               ($"SELECT ID FROM [AuthUsers] WHERE UserName = @UserName and PasswordHash = @PasswordHash;", dbPara, commandType: CommandType.Text));

            return(verified != null?true:false);
        }
        //Metodo que obtiene el ID de un cliente determinado
        public Task <Clientes> GetById(int id, string Id_institucion)
        {
            var clientes = Task.FromResult(_dapperManager.Get <Clientes>($"select * from [Clientes] where ID = {id} AND ID_Institucion = '{Id_institucion}'", null,
                                                                         commandType: CommandType.Text));

            return(clientes);
        }
Beispiel #17
0
        public Task <Store> GetById(int Id)
        {
            var store = Task.FromResult(_dapperManager.Get <Store>($"select * from [Store] where ID = {Id}", null,
                                                                   commandType: CommandType.Text));

            return(store);
        }
Beispiel #18
0
        public Task <Vehiculos> GetById(int id, string Id_institucion)
        {
            var vehiculos = Task.FromResult(_dapperManager.Get <Vehiculos>($"select * from [Vehiculos] where ID = {id} AND ID_Institucion = '{Id_institucion}'", null,
                                                                           commandType: CommandType.Text));

            return(vehiculos);
        }
Beispiel #19
0
        public Task <int> Count(string search)
        {
            var totSchool = Task.FromResult(_dapperManager.Get <int>($"select COUNT(*) from [Schools] WHERE SchoolName like '%{search}%'", null,
                                                                     commandType: CommandType.Text));

            return(totSchool);
        }
        public Task <int> ValidadFecha(string fechaI, string FechaF, string idI, string VID)
        {
            var article = Task.FromResult(_dapperManager.Get <int>($"SELECT COUNT (*) FROM Reserva WHERE Fecha_inc BETWEEN '{fechaI}' AND '{FechaF}' AND ID_Institucion = '{idI}' AND ID_Vehiculo = '{VID}' OR  Fecha_Fin BETWEEN '{fechaI}' AND '{FechaF}' AND ID_Vehiculo = '{VID}' AND ID_Institucion = '{idI}' ", null,
                                                                   commandType: CommandType.Text));

            return(article);
        }
Beispiel #21
0
        public Task <int> Count()
        {
            var dbPara = new DynamicParameters();

            dbPara.Add("VType", 5, DbType.Int32);
            dbPara.Add("BranchId", 31, DbType.Int32);
            var totArticle = Task.FromResult(_dapperManager.Get <int>($"select COUNT(*) from [voucher] WHERE Vtype=@VType and branchid=@BranchId", dbPara,
                                                                      commandType: CommandType.Text));

            return(totArticle);
        }
        public async override Task <IResponseMessage <GeneralSettingsVM> > GetById(int?id)
        {
            var dbParams = new DynamicParameters();

            dbParams.Add("@Id", id, DbType.Int32);

            string sql    = $"select * from [dbo].[GeneralSettings] WHERE Id = @Id";
            var    Branch = await Task.FromResult(dapperManager.Get <GeneralSettingsVM>(sql, dbParams, CommandType.Text));

            return(new ResponseMessageBase <GeneralSettingsVM>()
            {
                MessageType = MessageTypes.Success, ResponseData = new[] { Branch }
            });
        }
Beispiel #23
0
        //public async Task<dtVoucher> GetVoucher(int vid)
        public async Task <dtInvVoucher> GetVoucher(long VId)
        {
            var dbPara = new DynamicParameters();

            dbPara.Add("VId", VId, DbType.Int32);
            dbPara.Add("Criteria", "Voucher", DbType.String);
            //dtInvVoucher voucher = new dtInvVoucher();
            var voucher = Task.FromResult(_dapperManager.Get <dtInvVoucher>
                                              ("[FINWEB_INVENTORYVoucherSP]", dbPara,
                                              commandType: CommandType.StoredProcedure));

            //($"SELECT * FROM [Article] WHERE Title like '%{search}%' ORDER BY {orderBy} {direction} OFFSET {skip} ROWS FETCH NEXT {take} ROWS ONLY; ", null, commandType: CommandType.Text));
            return(await voucher);
        }