// ++++++++++++++++++++++++++++++++++++++++++++++++
        // Send company a notification that another company has bid on their quote request

        public void NotifyCompanyOfNewBidOnQuoteRequestItem(int bidId)
        {
            BidDomain bid = _BidService.BidGetById(bidId);

            CompanyDomain company   = _CompanyService.GetByIdCompany(bid.ReceivingCompanyId);
            CompanyDomain company2  = _CompanyService.GetByIdCompany(bid.SubmittingCompanyId);
            string        BidAmount = String.Format("{0:0.00}", bid.Amount);


            if (company != null)
            {
                try
                {
                    EmailRequest notification = new EmailRequest();

                    notification.UserEmail = company.Email;
                    notification.Subject   = "New Bid On Your Quote Request";
                    notification.Content   = "There was a new bid on your quote request: " + bid.QrName + ". " + company2.Name + " submitted a bid of $" + BidAmount + " on the quote request item " + bid.QriName +
                                             ". The provided shipping address was " + bid.Address1 + ", " + bid.City + ", " + bid.State + " " + bid.ZipCode + ". Log into your QuoteMule account(http://quotemule.dev/) to view and take action.";


                    _UserEmailService.SendEmail(notification);


                    NotificationInsertRequest notificationModel = new NotificationInsertRequest();

                    notificationModel.UserId   = company.OwnerId;
                    notificationModel.Category = "New Bid On Your Quote Request";
                    notificationModel.Message1 = company2.Name + " submitted a bid on your quote request: " + bid.QrName + ". Click ";
                    notificationModel.Link     = "/quoterequest/manage/" + bid.QuoteRequestId;
                    notificationModel.Message2 = "here";
                    notificationModel.Message3 = " to view it.";
                    notificationModel.Is_Read  = false;

                    NotificationInsert(notificationModel);


                    NotificationInsertRequest toastrModel = new NotificationInsertRequest();

                    toastrModel.UserId   = company.OwnerId;
                    toastrModel.Category = "New Bid On Your Quote Request";
                    toastrModel.Message1 = "<a href='/quoterequest/manage/" + bid.QuoteRequestId + "#/active'>" + company2.Name + " submitted a bid on your quote request: " + bid.QrName + ".</a>";
                    toastrModel.Is_Read  = false;


                    UserProfileService UserProfile = new UserProfileService();

                    List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(bid.ReceivingCompanyId);


                    NotifyAllCompanyUsers(toastrModel, notificationList);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Esempio n. 2
0
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        public List <CompanyDomain> GetAllSuppliers()
        {
            List <CompanyDomain> companyList = null;

            try
            {
                DataProvider.ExecuteCmd(GetConnection, "dbo.Company_GetAllSuppliers"
                                        , inputParamMapper : delegate(SqlParameterCollection paramCollection)
                                        { }
                                        , map : delegate(IDataReader reader, short set)
                {
                    CompanyDomain singleCompany = new CompanyDomain();
                    int startingIndex           = 0; //startingOrdinal

                    singleCompany.CompanyId    = reader.GetSafeInt32(startingIndex++);
                    singleCompany.OwnerId      = reader.GetSafeString(startingIndex++);
                    singleCompany.DateCreated  = reader.GetSafeDateTime(startingIndex++);
                    singleCompany.CompanyName  = reader.GetSafeString(startingIndex++);
                    singleCompany.TypeId       = reader.GetSafeInt32(startingIndex++);
                    singleCompany.Phone        = reader.GetSafeString(startingIndex++);
                    singleCompany.Fax          = reader.GetSafeString(startingIndex++);
                    singleCompany.Email        = reader.GetSafeString(startingIndex++);
                    singleCompany.MediaId      = reader.GetSafeInt32(startingIndex++);
                    singleCompany.Url          = reader.GetSafeString(startingIndex++);
                    singleCompany.MediaUrl     = reader.GetSafeString(startingIndex++);
                    singleCompany.Designations = reader.GetSafeInt32(startingIndex++);
                    singleCompany.AddressType  = reader.GetSafeInt32(startingIndex++);
                    singleCompany.Latitude     = reader.GetSafeDecimal(startingIndex++);
                    singleCompany.Longitude    = reader.GetSafeDecimal(startingIndex++);
                    singleCompany.Address1     = reader.GetSafeString(startingIndex++);
                    singleCompany.City         = reader.GetSafeString(startingIndex++);
                    singleCompany.State        = reader.GetSafeString(startingIndex++);
                    singleCompany.ZipCode      = reader.GetSafeString(startingIndex++);

                    if (companyList == null)
                    {
                        companyList = new List <CompanyDomain>();
                    }

                    companyList.Add(singleCompany);
                }
                                        );
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(companyList);
        }
Esempio n. 3
0
        public HttpResponseMessage CompanyGetById(int id)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            CompanyDomain company = _CompanyService.GetByIdCompany(id);

            var response = new ItemResponse <CompanyDomain> {
                Item = company
            };

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public bool NotifySellerCompanyOfAcceptedBid(int bidId)
        {
            bool Success = false;

            BidDomain bid            = _BidService.BidGetById(bidId);
            int       QuoteRequestId = bid.QuoteRequestId;

            CompanyDomain buyerCompany    = _CompanyService.GetByIdCompany(bid.ReceivingCompanyId);
            CompanyDomain supplierCompany = _CompanyService.GetByIdCompany(bid.SubmittingCompanyId);
            string        link            = "/quoterequest/manage/" + QuoteRequestId;

            try
            {
                NotificationInsertRequest model = new NotificationInsertRequest();

                model.UserId   = supplierCompany.OwnerId;
                model.Category = "Bid Accepted";
                model.Message1 = buyerCompany.Name + " has accepted your bid! ";
                model.Link     = link;
                model.Message2 = "here";
                model.Message3 = " to convert to quote.";
                model.Is_Read  = false;

                NotificationInsert(model);


                NotificationInsertRequest toastrModel = new NotificationInsertRequest();

                toastrModel.UserId   = supplierCompany.OwnerId;
                toastrModel.Category = "Bid Accepted";
                toastrModel.Message1 = "<a href='/quoterequest/manage/" + bid.QuoteRequestId + "#/pending'><div>" + buyerCompany.Name + " has accepted your bid! Click here!</div></a>";

                UserProfileService UserProfile = new UserProfileService();

                List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(bid.SubmittingCompanyId);

                NotifyAllCompanyUsers(toastrModel, notificationList);

                Success = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Success);
        }
        public bool NotifyBuyerCompanyOfSubmittedQuote(int quoteId)
        {
            bool Success = false;

            QuoteDomain   quote         = _QuoteService.QuoteGetByQuoteId(quoteId);
            CompanyDomain buyerCompany  = _CompanyService.GetByIdCompany(quote.BuyerCompanyId);
            CompanyDomain sellerCompany = _CompanyService.GetByIdCompany(quote.SellerCompanyId);
            string        link          = "/quote/manage/" + quote.QuoteId;

            try
            {
                NotificationInsertRequest model = new NotificationInsertRequest();

                model.UserId   = buyerCompany.OwnerId;
                model.Category = "Quote Submitted";
                model.Message1 = sellerCompany.Name + " submitted a quote. Click ";
                model.Link     = link;
                model.Message2 = "here";
                model.Message3 = " to review.";
                model.Is_Read  = false;

                NotificationInsert(model);


                NotificationInsertRequest toastrModel = new NotificationInsertRequest();

                toastrModel.UserId   = buyerCompany.OwnerId;
                toastrModel.Category = "Quote Submitted";
                toastrModel.Message1 = "<a href='/quote/manage/" + quote.QuoteId + "'><div>" + sellerCompany.Name + " has submitted a quote! Click here!</div></a>";

                UserProfileService UserProfile = new UserProfileService();

                List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(quote.BuyerCompanyId);

                NotifyAllCompanyUsers(toastrModel, notificationList);


                Success = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Success);
        }
Esempio n. 6
0
 public EntityResult<Company> Delete(Company company)
 {
     EntityResult<Company> entityResult = new EntityResult<Company>();
     try
     {
         CompanyDomain companyDomain = new CompanyDomain(1, ATSCommon.Enums.LanguagesEnum.Arabic);
         companyDomain.Delete(company);
         if (companyDomain.ActionState.Status != ATSCommon.Enums.ActionStatusEnum.NoError)
         {
             entityResult.Message = companyDomain.ActionState.Result;
         }
     }
     catch (Exception ex)
     {
         entityResult.Message = ex.Message;
     }
     return entityResult;
 }
Esempio n. 7
0
        public EntityListResult<Company> FindAll()
        {
            CompanyDomain companyDomain = new CompanyDomain(1, ATSCommon.Enums.LanguagesEnum.Arabic);
            EntityListResult<Company> entityListResult = new EntityListResult<Company>();
            try
            {
                entityListResult.ReturnedEntities = companyDomain.FindAll();
                if (companyDomain.ActionState.Status != ATSCommon.Enums.ActionStatusEnum.NoError)
                {
                    entityListResult.Message = companyDomain.ActionState.Result;
                }

            }
            catch (Exception ex)
            {
                entityListResult.Message = ex.Message;
            }
            return entityListResult;
        }
        public bool NotifyBuyerCompanyOfApprovedContract(int quoteId)
        {
            bool Success = false;

            QuoteDomain   quote         = _QuoteService.QuoteGetByQuoteId(quoteId);
            CompanyDomain buyerCompany  = _CompanyService.GetByIdCompany(quote.BuyerCompanyId);
            CompanyDomain sellerCompany = _CompanyService.GetByIdCompany(quote.SellerCompanyId);

            try
            {
                NotificationInsertRequest model = new NotificationInsertRequest();

                model.UserId   = buyerCompany.OwnerId;
                model.Category = "Quote Completed";
                model.Message1 = sellerCompany.Name + " accepted the contract. Quote is completed!";
                model.Is_Read  = false;

                NotificationInsert(model);


                NotificationInsertRequest toastrModel = new NotificationInsertRequest();

                toastrModel.UserId   = buyerCompany.OwnerId;
                toastrModel.Category = "Contract Approved";
                toastrModel.Message1 = sellerCompany.Name + " has accepted the contract. Quote is completed!</div></a>";

                UserProfileService UserProfile = new UserProfileService();

                List <CompanyEmployeeDomain> notificationList = UserProfile.GetAllEmployees(quote.BuyerCompanyId);

                NotifyAllCompanyUsers(toastrModel, notificationList);



                Success = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Success);
        }
Esempio n. 9
0
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        public CompanyDomain GetByIdCompany(int id)
        {
            CompanyDomain singleCompany = null;

            try
            {
                DataProvider.ExecuteCmd(GetConnection, "dbo.Company_GetById"
                                        , inputParamMapper : delegate(SqlParameterCollection paramCollection)
                {
                    paramCollection.AddWithValue("@id", id);
                }, map : delegate(IDataReader reader, short set)
                {
                    singleCompany     = new CompanyDomain();
                    int startingIndex = 0;               //startingOrdinal

                    singleCompany.CompanyId    = reader.GetSafeInt32(startingIndex++);
                    singleCompany.OwnerId      = reader.GetSafeString(startingIndex++);
                    singleCompany.DateCreated  = reader.GetSafeDateTime(startingIndex++);
                    singleCompany.Name         = reader.GetSafeString(startingIndex++);
                    singleCompany.TypeId       = reader.GetSafeInt32(startingIndex++);
                    singleCompany.Phone        = reader.GetSafeString(startingIndex++);
                    singleCompany.Fax          = reader.GetSafeString(startingIndex++);
                    singleCompany.Email        = reader.GetSafeString(startingIndex++);
                    singleCompany.MediaId      = reader.GetSafeInt32(startingIndex++);
                    singleCompany.Url          = reader.GetSafeString(startingIndex++);
                    singleCompany.MediaUrl     = reader.GetSafeString(startingIndex++);
                    singleCompany.Designations = reader.GetSafeInt32(startingIndex++);
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(singleCompany);
        }
Esempio n. 10
0
        private static void ComInit()
        {
            if (_companyDetails != null) return;

            lock (_ComObj)
            {
                if (_companyDetails != null) return;

                var r = YunClient.Instance.Execute(new GetCompanyRequest() { 
                    Id = InitiatedCompanyId 
                }).Company;
                _companyDetails = r;
            }
        }
 public HomeController()
 {
     _companyDomain = new CompanyDomain();
 }
Esempio n. 12
0
        static void Main(string[] args)
        {
            bool           carryon = true;
            char           ch;
            int            i;
            OrderDomain    orderDomain    = new OrderDomain();
            CustomerDomain customerDomain = new CustomerDomain();
            CompanyDomain  companyDomain  = new CompanyDomain();

            Console.WriteLine("----------------Welcome in ToySelling Application-------------");
            while (carryon)
            {
                Console.WriteLine("\n1. Customer Registration\t2.Company Registration\n3. Add Toy In Production\t 4. View Toys\n5. View Customers \n6 . Add Shipping Address\t7. Show Address \n 8. Add Order In Cart\t9. View Cart Order  \n10. Place Order \t 11. View Invoice\n\nEnter Your Choice : ");
                int choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    Customer customer = new Customer();
                    Console.WriteLine("\nEnter Name :");
                    customer.Name = Console.ReadLine();
                    Console.WriteLine("\nEnter Mobile No :");
                    customer.MobileNo = Convert.ToInt32(Console.ReadLine()).ToString();
                    Console.WriteLine("\nEnter City :");
                    customer.City = Console.ReadLine();

                    customerDomain.AddCustomer(customer);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 2:
                    Company company = new Company();
                    Console.WriteLine("\nEnter Name :");
                    company.CompanyName = Console.ReadLine();
                    Console.WriteLine("\nEnter City :");
                    company.City = Console.ReadLine();

                    companyDomain.AddCompany(company);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 3:
                    ToyProduction toyProduction = new ToyProduction();
                    Console.WriteLine("\nEnter Toy Id :");
                    toyProduction.ToyId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter CompanyId :");
                    toyProduction.CompanyId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Price :");
                    toyProduction.Price = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Quantity :");
                    toyProduction.Quantity = Convert.ToInt32(Console.ReadLine());
                    CompanyDomain companyDomain1 = new CompanyDomain();
                    companyDomain1.AddToyProduction(toyProduction);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 4:
                    CompanyDomain cd = new CompanyDomain();
                    i = 1;
                    foreach (ToyProduction toy in cd.GetToyProduction())
                    {
                        Console.WriteLine("Toy - " + i);
                        Console.WriteLine("ToyProductionId : " + toy.ProductionId);
                        Console.WriteLine("ToyId : " + toy.ToyId);
                        Console.WriteLine("CompanyId : " + toy.CompanyId);
                        Console.WriteLine("Price : " + toy.Price);
                        Console.WriteLine("Total Toy : " + toy.Quantity);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 5:
                    foreach (Customer customer1 in customerDomain.GetCustomers())
                    {
                        Console.WriteLine("Customer Id : " + customer1.CustomerId);
                        Console.WriteLine("Name : " + customer1.Name);
                        Console.WriteLine("Mobile No : " + customer1.MobileNo);
                        Console.WriteLine("Ciry : " + customer1.City);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 6:
                    CustomerAddress customerAddress = new CustomerAddress();
                    Console.WriteLine("\nEnter Address :");
                    customerAddress.Address = Console.ReadLine();
                    Console.WriteLine("\nEnter Custermer Id :");
                    customerAddress.CustomerId = Convert.ToInt32(Console.ReadLine());
                    CustomerDomain cust = new CustomerDomain();
                    cust.AddAddress(customerAddress);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 7:
                    CustomerAddress ca = new CustomerAddress();
                    Console.WriteLine("Enter Customer Id :");
                    ca.CustomerId = Convert.ToInt32(Console.ReadLine());
                    foreach (CustomerAddress customer1 in customerDomain.GetCustomerAddresses(ca))
                    {
                        Console.WriteLine("Customer Id : " + customer1.CustomerId);
                        Console.WriteLine("Address Id : " + customer1.AddressId);
                        Console.WriteLine("Address : " + customer1.Address);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 8:
                    Order order = new Order();
                    Console.WriteLine("\nEnter Custermer Id :");
                    order.CustomerId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter ToyProduction Id :");
                    order.ProductionId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Quantity :");
                    order.Quantity = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Shipping Address Id :");
                    order.AddressId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("\nEnter Order Date :");
                    order.OrderDate = Convert.ToDateTime(Console.ReadLine());

                    orderDomain.AddOrder(order);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 9:
                    foreach (Order orders in orderDomain.GetOrders())
                    {
                        Console.WriteLine("Order Id : " + orders.OderId);
                        Console.WriteLine("ToyId : " + orders.CustomerId);
                        Console.WriteLine("ToyId : " + orders.ProductionId);
                        Console.WriteLine("AddressId : " + orders.AddressId);
                        Console.WriteLine("------------------------------------------------");
                    }
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }

                    break;

                case 10:
                    orderDomain.GetOrderById();
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                case 11:
                    Invoice invoice = new Invoice();
                    invoice = orderDomain.GetInvoiceById();
                    Console.WriteLine("Invoice Id :" + invoice.InvoiceId);
                    Console.WriteLine("Order Id :" + invoice.OrderId);
                    Console.WriteLine("Price :" + invoice.Price);
                    Console.WriteLine("Offer Id :" + invoice.OfferId);
                    Console.WriteLine("Final Price :" + invoice.FinalPrice);
                    Console.WriteLine("\nDo you want to continue? Press y for yes");
                    ch = Convert.ToChar(Console.ReadLine());
                    if (ch.Equals('y') || ch.Equals('Y'))
                    {
                        carryon = true;
                    }
                    else
                    {
                        carryon = false;
                    }
                    break;

                default:
                    carryon = false;
                    break;
                }
            }
        }