示例#1
0
        public JsonResult AddOrUpdateSalesPerson(SalesPerson salesPerson)
        {
            var  repo    = new SalesPersonRepository();
            bool success = repo.AddOrUpdateSalesPerson(salesPerson);

            return(new JsonResult {
                Data = success
            });
        }
        private void BindOpportunityToForm()
        {
            try
            {
                _opportunity.GetByKey(_opportunityNumber);
                EditText0.Value  = _opportunityNumber.ToString();
                EditText3.Value  = _opportunity.OpportunityName;
                EditText1.Value  = _opportunity.CardCode;
                EditText4.Value  = _opportunity.CustomerName;
                EditText12.Value = (_opportunity.WeightedSumLC - (double)InternalConverters.ConvertStringToDecimal(OpportunityRepository.GetOpportunityUsedAmount(_opportunityNumber).ToString())).ToString();
                EditText6.Value  = SalesPersonRepository.GetNameById(_opportunity.SalesPerson);
                EditText8.Value  = _opportunity.ClosingPercentage + "%";

                //  var businessPartners =
                //      (BusinessPartners) SapDiConnection.Instance.GetBusinessObject(BoObjectTypes
                //          .oBusinessPartners);
                //  businessPartners.GetByKey(_opportunity.CardCode);
                // // businessPartners.ContactEmployees.SetCurrentLine(_opportunity.ContactPerson - 1);
                ////  EditText5.Value = businessPartners.ContactEmployees.Name;

                EditText7.Value = _opportunity.StartDate.ToString("dd.MM.yy");


                //add items
                var items = OpportunityRepository.GetOpportunityItemsById(_opportunityNumber);
                var count = 1;
                foreach (var item in items)
                {
                    Matrix0.AddRow();
                    ((EditText)Matrix0.Columns.Item("#").Cells.Item(count).Specific).Value     = count.ToString();
                    ((EditText)Matrix0.Columns.Item("Col_0").Cells.Item(count).Specific).Value = item.Id;
                    ((EditText)Matrix0.Columns.Item("Col_1").Cells.Item(count).Specific).Value = item.Name;
                    count++;
                }

                //dates
                EditText9.Value  = DateTime.Today.ToString("yyyyMMdd");
                EditText10.Value = DateTime.Today.ToString("yyyyMMdd");
                EditText11.Value = DateTime.Today.ToString("yyyyMMdd");

                EditText16.Value = InternalConverters.StringToDateTypeEdittext(_opportunity.UserFields.Fields.Item("U_ctrctdateto").Value.ToString());
                EditText17.Value = InternalConverters.StringToDateTypeEdittext(_opportunity.UserFields.Fields.Item("U_cntrctdateFrom").Value.ToString());
                _distrule        = _opportunity.UserFields.Fields.Item("U_DistRule").Value.ToString();
                _contractMonths  = InternalConverters.EditTextToDateTime(EditText17.Value).Subtract(InternalConverters.EditTextToDateTime(EditText16.Value)).Days /
                                   (365.25 / 12);
                _contractMonths      = Math.Round(_contractMonths);
                StaticText25.Caption = _contractMonths + " months";
            }
            catch (Exception exception)
            {
                Application.SBO_Application.SetStatusBarMessage(exception.Message);
                UIAPIRawForm.Close();
            }
        }
        public async Task <IHttpActionResult> GetTopTenSalesPeople()
        {
            var repository = new SalesPersonRepository();
            var results    = await repository.GetTopTenSalesPeopleAsync();

            if (results == null)
            {
                return(NotFound());
            }
            return(Ok(results));
        }
示例#4
0
        // GET: Products
        public ActionResult Index()
        {
            ProductViewModel model = new ProductViewModel();
            var custRepo           = new CustomerRepository();

            model.Customers = custRepo.GetCustomers();
            var salesPersonRepo = new SalesPersonRepository();

            model.SalesPersons = salesPersonRepo.GetSalesPersons();

            return(View(model));
        }
示例#5
0
        public JsonResult SalesPersonList()
        {
            var repo            = new SalesPersonRepository();
            var salesPersonList = repo.GetSalesPersons();

            var pdto = new DTResponse
            {
                recordsTotal    = salesPersonList.Count(),
                recordsFiltered = salesPersonList.Count(),
                data            = salesPersonList,
                draw            = 0,
                error           = ""
            };

            return(new JsonResult {
                Data = pdto, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#6
0
 public AWUnitOfWork(AWContext context)
 {
     _context                = context;
     Address                 = new AddressRepository(context);
     BusinessEntity          = new BusinessEntityRepository(context);
     BusinessEntityAddress   = new BusinessEntityAddressRepository(context);
     PersonPhone             = new PersonPhoneRepository(context);
     StateProvince           = new StateProvinceRepository(context);
     Customer                = new CustomerRepository(context);
     SalesPerson             = new SalesPersonRepository(context);
     SalesOrderHeader        = new SalesOrderHeaderRepository(context);
     SalesOrderDetail        = new SalesOrderDetailRepository(context);
     ShoppingCartItem        = new ShoppingCartItemRepository(context);
     SalesTerritory          = new SalesTerritoryRepository(context);
     Product                 = new ProductRepository(context);
     ProductCategory         = new ProductCategoryRepository(context);
     ProductDescription      = new ProductDescriptionRepository(context);
     ProductInventory        = new ProductInventoryRepository(context);
     ProductListPriceHistory = new ProductListPriceHistoryRepository(context);
     ProductPhoto            = new ProductPhotoRepository(context);
     ProductProductPhoto     = new ProductProductPhotoRepository(context);
     Person = new PersonRepository(context);
 }