Example #1
0
 public async Task <List <BidEntity> > GetBidByHeaderId(int headerId)
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <BidEntity>(SpBid.GET_BY_HEADER, new
         {
             @HeaderId = headerId
         }));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #2
0
 public async Task <List <DetailEntity> > GetDetailByHeaderId(int headerId)
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <DetailEntity>(SpDetail.GET_BY_Header, new
         {
             @HeaderId = headerId
         }));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #3
0
        public async Task message_notification()
        {
            try
            {
                string rootPath = Directory.GetCurrentDirectory();
                if (!System.IO.Directory.Exists(Path.Combine(rootPath, "\\HTMLMessages")))
                {
                    Directory.CreateDirectory("HTMLMessages");
                }
                string htmlPath = Directory.GetCurrentDirectory() + "\\HTMLMessages\\";

                string html = "InvitationMessage.html";
                if (!System.IO.File.Exists(Path.Combine(htmlPath + html)))
                {
                    File.WriteAllText(htmlPath + html, "<b>Estimado [SupplierName]</b>" +
                                      "\r\n<br />" +
                                      "\r\n<br />" +
                                      "Usted ha sido invitado a participar en la licitación N°[DocumentNumber], la cual estará disponible desde [OpenDate] hasta [CloseDate]." +
                                      "\r\n<br />" +
                                      "\r\n<br />" +
                                      "Atentamente" +
                                      "\r\n<br />" +
                                      "\r\n<br />" +
                                      "[BuyerName]");
                }

                List <MessageEntity> listPending = await dapperHelper.ExecuteSP_Multiple <MessageEntity>(spMessage.GET_ALL_BYPENDING);

                foreach (MessageEntity item in listPending)
                {
                    string body = System.IO.File.ReadAllText(Path.Combine(htmlPath + html));
                    InvitationRfxEntity data = dapperHelper.ExecuteSP_Single <InvitationRfxEntity>(spMessage.GET_DATA_INVITATION_RFX, new { @messageId = item.MessageId }).Result;
                    body = body.Replace("[BuyerName]", data.BuyerName);
                    body = body.Replace("[SupplierName]", data.SupplierName);
                    body = body.Replace("[DocumentNumber]", data.DocumentNumber);
                    body = body.Replace("[OpenDate]", data.OpenDate.ToShortDateString());
                    body = body.Replace("[CloseDate]", data.CloseDate.ToShortDateString());

                    item.Subject     = "Invitación a licitación " + data.DocumentNumber;
                    item.MessageSent = body;

                    SendMail(item.MessageId, item.MessageTo, item.MessageToBCC, item.MessageSent, item.Subject);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #4
0
 public async Task <List <UserEntity> > GetAllUsers_ByCompanyId(int UserId, int CompanyId)
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <UserEntity>(User.GET_ALL_BY_COMPANY,
                                                                   new {
             @UserId = UserId,
             @CompanyId = CompanyId
         }
                                                                   ));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #5
0
        public async Task Update_status()
        {
            try
            {
                List <HeaderScheduler> headers = await dapperHelper.ExecuteSP_Multiple <HeaderScheduler>(Header.GET_ALL_BYSTATUS);

                DateTime Now = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                foreach (HeaderScheduler item in headers)//int i = 0; i < headers.Count; i++)
                {
                    //la fecha de cierre es menor a la de apertura
                    if (item.CloseDate < item.OpenDate)
                    {
                        await dapperHelper.ExecuteSP_Single <string>(Header.UPDATE_STATUS, new
                        {
                            @Status   = "ERROR",
                            @HeaderId = item.HeaderId
                        });
                    }
                    else
                    {
                        //fecha de apertura es menor o igual a la fecha actual
                        if (item.OpenDate <= Now)
                        {
                            //Si la fecha de cierre es mayor o igual  a la fecha actual y igual a la fecha de apertura el estado es "PROGRAMADO"
                            if (item.CloseDate >= Now && item.Status == "PROGRAMADO")
                            {
                                await dapperHelper.ExecuteSP_Single <string>(Header.RFX_OPEN, new
                                {
                                    @HeaderId = item.HeaderId
                                });

                                //Add pending RFx invitations to message table
                                await dapperHelper.ExecuteSP_Single <string>(spMessage.SET_DATA_INVITATION_RFX, new
                                {
                                    @HeaderId = item.HeaderId
                                });

                                //Send email to suppliers invited
                                await messageRepository.message_notification();
                            } //si la fecha de cierre es menor a la fecha actual
                            else if (item.CloseDate < Now && item.Status == "PUBLICADO")
                            {
                                await dapperHelper.ExecuteSP_Single <string>(Header.RFX_CLOSE, new
                                {
                                    @HeaderId = item.HeaderId
                                });
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public async Task <List <MeasuranceUnitEntity> > GetUnits()
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <MeasuranceUnitEntity>(MeasuranceUnit.SELECT_ALL));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #7
0
 public async Task <List <AttachmentEntity> > GetAttachmentByHeaderId(int headerId)
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <AttachmentEntity>(SpAttachment.GET_BY_HEADER_ID, new
         {
             @HeaderId = headerId
         }));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #8
0
 public async Task <List <WarehouseEntity> > GetByCompanyId(int companyId)
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <WarehouseEntity>(SpWarehouse.GET_BY_COMPANYID, new
         {
             @CompanyId = companyId
         }));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #9
0
        public async Task <List <CharacteristicEntity> > GetAllCharacteristics()
        {
            try
            {
                var dataCharacteristics = await dapperHelper.ExecuteSP_Multiple <CharacteristicEntity>(SpCharacteristic.GET_ALL);

                List <CharacteristicEntity> Characteristics = (List <CharacteristicEntity>)dataCharacteristics;

                return(Characteristics);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #10
0
        public async Task <List <CurrencyEntity> > GetAllCurrency()
        {
            try
            {
                var dataCurrency = await dapperHelper.ExecuteSP_Multiple <CurrencyEntity>(SpCurrency.GET_ALL);

                List <CurrencyEntity> currency = (List <CurrencyEntity>)dataCurrency;

                return(currency);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #11
0
        public async Task <List <CompanyEntity> > GetAllCompanySuppliers()
        {
            try
            {
                var dataCompanySuppliers = await dapperHelper.ExecuteSP_Multiple <CompanyEntity>(SpCompany.GET_ALL_SUPPLIERS);

                List <CompanyEntity> companySuppliers = (List <CompanyEntity>)dataCompanySuppliers;

                return(companySuppliers);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #12
0
        public async Task <List <CarrierEntity> > GetAllCarriers()
        {
            try
            {
                var dataCarriers = await dapperHelper.ExecuteSP_Multiple <CarrierEntity>(SpCarrier.florida_Carrier_all);

                List <CarrierEntity> carriers = (List <CarrierEntity>)dataCarriers;

                return(carriers);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #13
0
        public async Task <List <CategoryEntity> > GetAllCategories(int CompanyId)
        {
            try
            {
                var dataCategories = await dapperHelper.ExecuteSP_Multiple <CategoryEntity>(SpCategory.GET_ALL, new {
                    @CompanyId = CompanyId
                });

                List <CategoryEntity> categories = (List <CategoryEntity>)dataCategories;

                return(categories);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #14
0
        public async Task <List <RoleEntity> > GetAllRole_ByCompanyId(int userId, string companyType)
        {
            try
            {
                var dataRoleSuppliers = await dapperHelper.ExecuteSP_Multiple <RoleEntity>(SpRole.ALL, new
                {
                    @UserId      = userId,
                    @CompanyType = companyType
                });

                List <RoleEntity> roleSuppliers = (List <RoleEntity>)dataRoleSuppliers;

                return(roleSuppliers);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #15
0
 //Get Headers list for buyer _Widget
 public async Task <List <WidgetEntity> > GetByDocType_Widget(string docTypeCode, int companyId)
 {
     try
     {
         return(await dapperHelper.ExecuteSP_Multiple <WidgetEntity>(Header.GetAllRFXs_Widget, new
         {
             @DocTypeCode = docTypeCode,
             @CompanyId = companyId
         }));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #16
0
 public async Task <List <ProductEntity> > GetProducts()
 {
     return(await dapperHelper.ExecuteSP_Multiple <ProductEntity>(Product.SELECT));
 }