async private void setUp()
        {
            Controllers.Inspection inspection = new Controllers.Inspection();
            await inspection.GetInsuranceCompanies();

            insuranceCompanyCbo.ItemsSource = ServiceLayer.getInstance().InsuranceCompaniesList;
        }
Пример #2
0
        async private void getLookups()
        {
            if ((ErrorMessage = await new ServiceLayer().GetAllInsuranceCompanyNames()) != null)
            {
                return;
            }

            InsuranceCompanies = new ObservableCollection <DTO_InsuranceCompany>(ServiceLayer.InsuranceCompaniesList);

            if ((ErrorMessage = await ServiceLayer.buildLUs()) != null)
            {
                IsBusyLoading = false;
            }

            while (IsBusyLoading)
            {
                if (ServiceLayer.VendorTypes != null)
                {
                    IsBusyLoading = false;

                    CurrentPage = new LoginView();

                    loadBaseModelLookUps();
                }
            }
        }
Пример #3
0
        public void FillGrid()
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            grdPurchase.DataSource = serviceLayer.GetPurchaseDetails();
            grdPurchase.DataBind();
        }
Пример #4
0
        public void setUp()
        {
            service = ServiceLayer.getInstance(false);
            idOwner = service.initUser();
            DBtransactions db = DBtransactions.getInstance(true);

            db.isTest(true);
            ownerUser    = "******";
            passwordUser = "******";
            service.register(ownerUser, passwordUser, idOwner);
            service.signIn(ownerUser, passwordUser);

            idManager       = service.initUser();
            managerUser     = "******";
            managerPassword = "******";
            service.register(managerUser, managerPassword, idManager);
            permissions = new List <String>()
            {
                "AddDiscountPolicy"
            };


            service.openStore("adidas", ownerUser);

            idGuest   = service.initUser();
            guestUser = "******";
            password  = "******";
        }
Пример #5
0
        // GET: Home

        public ActionResult getEmp()
        {
            ServiceLayer    service = new ServiceLayer();
            List <Employee> emplist = service.GetPerson().ToList();
            //ViewBag.li = emplist;
            List <EmployeeVM> empvm = new List <EmployeeVM>();

            foreach (var empobj in emplist)
            {
                EmployeeVM eobj = new EmployeeVM();
                eobj.name = empobj.name;

                eobj.position = empobj.position;
                eobj.salary   = empobj.salary;
                eobj.age      = empobj.age;
                if (empobj.salary < 20000)
                {
                    eobj.salaryCol = "red";
                }
                else
                {
                    eobj.salaryCol = "green";
                }
                empvm.Add(eobj);
            }

            ViewBag.li = empvm;

            return(View());
        }
        public ActionResult DeleteCart(int id)
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            serviceLayer.DeleteCart(id);
            return(RedirectToAction("ViewCart", new { id = GetUserId() }));
        }
Пример #7
0
        void InitilizePage()
        {
            DateTime     currentTime       = DateTime.Now;
            DateTime     previousMonthDate = currentTime.AddDays(-30);
            ServiceLayer serviceLayer      = new ServiceLayer();

            radFromDate.SelectedDate = previousMonthDate;
            radToDate.SelectedDate   = currentTime;
            DataTable sellsDetailsdt    = serviceLayer.GetSellsDetails(radToDate.SelectedDate.Value, radFromDate.SelectedDate.Value);
            DataTable purchaseDetailsdt = serviceLayer.GetPurchaseDetails(radToDate.SelectedDate.Value, radFromDate.SelectedDate.Value);
            DataTable expenseDetailsdt  = serviceLayer.GetExpenseDetails(radToDate.SelectedDate.Value, radFromDate.SelectedDate.Value);

            grdPurchase.DataSource = purchaseDetailsdt;
            grdPurchase.DataBind();

            grdSells.DataSource = sellsDetailsdt;
            grdSells.DataBind();

            grdExpense.DataSource = expenseDetailsdt;
            grdExpense.DataBind();

            Int64 totalPurchase = Convert.ToInt64(purchaseDetailsdt.Compute("Sum(StockAmount)", string.Empty));

            lblTotalPurchase.Text = Convert.ToString(totalPurchase) + " ₹";
            Int64 totalSells = Convert.ToInt64(sellsDetailsdt.Compute("Sum(Amount)", string.Empty));

            lblSells.Text = Convert.ToString(totalSells) + " ₹";
            Int64 totalExpense = Convert.ToInt64(expenseDetailsdt.Compute("Sum(ExpenceCost)", string.Empty));

            lblExpense.Text     = Convert.ToString(totalExpense) + " ₹";
            lblTotalProfit.Text = (totalSells * 6.5 / 100).ToString() + " ₹";
        }
        public ActionResult EditCart(int id, int Quantity)
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            serviceLayer.UpdateCart(id, Quantity);
            return(RedirectToAction("ViewCart", new { id = GetUserId() }));
        }
        public void setUp()
        {
            DBtransactions db = DBtransactions.getInstance(true);

            service = ServiceLayer.getInstance(false);
            db.isTest(true);
            idOwner      = service.initUser();
            ownerUser    = "******";
            passwordUser = "******";
            service.register(ownerUser, passwordUser, idOwner);
            service.signIn(ownerUser, passwordUser);

            idUser   = service.initUser();
            tmpUser  = "******";
            passUser = "******";
            service.register(tmpUser, passUser, idUser);

            service.openStore("adidas", ownerUser);
            service.createNewProductInStore("milk", "milk", "none", 10, "adidas", ownerUser);
            products = new List <KeyValuePair <String, int> >();
            products.Add(new KeyValuePair <string, int>("milk", 7));
            service.addProductsInStore(products, "adidas", ownerUser);

            productsInCart = new List <String>();
            productsInCart.Add("milk");
        }
Пример #10
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            LoginUser login = new LoginUser();

            login.userName = txtUserName.Text;
            login.Password = txtPassword.Text;
            ServiceLayer services = new ServiceLayer();

            if (services.CheckIsUserValid(login))
            {
                SessionIDManager manager    = new SessionIDManager();
                string           newID      = manager.CreateSessionID(Context);
                bool             redirected = false;
                bool             isAdded    = false;
                manager.SaveSessionID(Context, newID, out redirected, out isAdded);
                if (isAdded)
                {
                    Session["IsValidUser"] = newID;
                    Response.Redirect("DashBoard.aspx");
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
Пример #11
0
        public void InitilizePage()
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            grdExpences.DataSource = serviceLayer.GetExpenceDetails();
            grdExpences.DataBind();
        }
Пример #12
0
        private void GetSellsDetails()
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            grdSells.DataSource = serviceLayer.GetSellsDetails();
            grdSells.DataBind();
        }
Пример #13
0
        public void ServiceLayer_DeleteDomainTopic_DataLayerException_ShouldRethrow(bool getClientThrowsException, bool deleteThrowsException)
        {
            // Setup
            _eventGridManager.ThrowExceptionOnGetClient = getClientThrowsException;
            _eventGridManager.ThrowExceptionOnDelete    = deleteThrowsException;

            ServiceLayer serviceLayer = new ServiceLayer(
                _eventGridManager,
                _queueManager,
                _tableManager,
                _log);

            DataCleanupParameters parameters = TestValues.GetDataCleanupParameters();

            parameters.DomainTopicName = "domaintopicname";
            Func <Task> act = async() => await serviceLayer.DeleteDomainTopic(parameters);

            // Act
            act.Should().Throw <RequestFailedException>().WithMessage(_eventGridManager.ExceptionMessage);

            // Verify
            _log.Messages.Should().HaveCount(2);
            _log.Messages[0].Message.Should().Be($"Deleting domain topic {parameters.DomainTopicName}");
            _log.Messages[1].Message.Should().Be("Exception encountered in DeleteDomainTopic method.");
        }
Пример #14
0
        public void setUp()
        {
            service      = ServiceLayer.getInstance(false);
            idOwner      = service.initUser();
            ownerUser    = "******";
            passwordUser = "******";
            service.register(ownerUser, passwordUser, idOwner);
            service.signIn(ownerUser, passwordUser);

            idUser   = service.initUser();
            tmpUser  = "******";
            passUser = "******";
            service.register(tmpUser, passUser, idUser);

            service.openStore("adidas", ownerUser);
            service.createNewProductInStore("milk", "milk", "none", 10, "adidas", ownerUser);
            products = new List <KeyValuePair <String, int> >();
            products.Add(new KeyValuePair <string, int>("milk", 7));
            service.addProductsInStore(products, "adidas", ownerUser);

            productsInCart = new List <KeyValuePair <String, int> >();
            productsInCart.Add(new KeyValuePair <string, int>("milk", 10));

            purchaseId = service.addComplexPurchasePolicy("(0,milk,0,10,0)", "adidas", ownerUser);
        }
Пример #15
0
        public ActionResult DeleteProduct(int id)
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            serviceLayer.DeleteProduct(id);
            return(RedirectToAction("AddProduct"));
        }
Пример #16
0
        public ActionResult UpdateProduct(ProductDetails productDetails)
        {
            ServiceLayer serviceLayer = new ServiceLayer();

            serviceLayer.UpdateProduct(productDetails);
            return(RedirectToAction("AddProduct"));
        }
        public ActionResult View(int id)
        {
            ServiceLayer   serviceLayer   = new ServiceLayer();
            ProductDetails productDetails = serviceLayer.productDetails.Single(x => x.ProductId == id);

            return(View(productDetails));
        }
Пример #18
0
        public ActionResult Delete(int Id)
        {
            ServiceLayer service = new ServiceLayer();

            service.Delete(Id);

            return(RedirectToAction("submit", new { Message = "Deleted Successfully" }));
        }
        public int GetUserId()
        {
            string       Email        = User.Identity.Name;
            ServiceLayer serviceLayer = new ServiceLayer();
            int          Userid       = serviceLayer.GetUserId(Email);

            return(Userid);
        }
Пример #20
0
        protected override void OnStart(string[] args)
        {
            XmlConfigurator.Configure();

            SpiderPrincipal.Login("SYSTEM", "SYS");

            ServiceLayer.Start();
        }
Пример #21
0
 public void setUp()
 {
     service      = ServiceLayer.getInstance(false);
     idOwner      = service.initUser();
     ownerUser    = "******";
     passwordUser = "******";
     service.register(ownerUser, passwordUser, idOwner);
     service.signIn(ownerUser, passwordUser);
 }
        public ActionResult InsertCart(Cart cart)
        {
            cart.Userid   = GetUserId();
            cart.Quantity = 1;
            ServiceLayer serviceLayer = new ServiceLayer();

            serviceLayer.InsertCart(cart);
            return(RedirectToAction("ViewProduct"));
        }
        public NewInspection()
        {
            InitializeComponent();

            setUp();

            this.ridgeMaterialCbo.ItemsSource = ServiceLayer.getInstance().RidgeMaterialTypes;
            this.shingleTypeCbo.ItemsSource   = ServiceLayer.getInstance().ShingleTypes;
        }
        async private void saveAppointment(AppointmentEditorClosedEventArgs e)
        {
            if (e.EditedAppointment != null && e.Action == Syncfusion.UI.Xaml.Schedule.EditorClosedAction.Save)
            {
                MappedAppointment appt = e.EditedAppointment as MappedAppointment;

                if (e.IsNew)
                {
                    ServiceLayer s = new ServiceLayer();
                    ServiceLayer.CalendarData = new DTO_CalendarData
                    {
                        AppointmentTypeID = Int32.Parse(appt.MappedSubject),
                        EmployeeID        = ServiceLayer.LoggedInEmployee.EmployeeID,
                        StartTime         = appt.MappedStartTime,
                        EndTime           = appt.MappedEndTime,
                        Note = appt.MappedNote
                    };

                    /// FIX THIS!!!!!!!!~!
                    //await new ServiceLayer().AddCalendarData(ServiceLayer.CalendarData);
                    await new ServiceLayer().AddCalendarData(ServiceLayer.CalendarData);

                    if (ServiceLayer.CalendarData.SuccessFlag)
                    {
                    }
                    else
                    {
                    }
                }
                else if (!e.OriginalAppointment.Equals(e.EditedAppointment))
                {
                    MappedAppointment original = e.OriginalAppointment as MappedAppointment;

                    appt.CalendarDataID = original.CalendarDataID;
                    appt.LeadID         = original.LeadID;


                    ServiceLayer s = new ServiceLayer();
                    ServiceLayer.CalendarData           = ServiceLayer.CalendarDataList.Find(c => c.EntryID == appt.CalendarDataID);
                    ServiceLayer.CalendarData.StartTime = appt.MappedStartTime;
                    ServiceLayer.CalendarData.EndTime   = appt.MappedEndTime;
                    ServiceLayer.CalendarData.Note      = appt.MappedNote;

                    await new ServiceLayer().UpdateCalendarData(ServiceLayer.CalendarData);

                    if (ServiceLayer.CalendarData.SuccessFlag)
                    {
                        //MessageBox.Show(s.CalendarData.SuccessFlag.ToString(), "Success", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    else
                    {
                        //MessageBox.Show(s.CalendarData.SuccessFlag.ToString(), "Failure", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
            }
        }
Пример #25
0
        static void Main(string[] args)
        {
            // start log4net
            XmlConfigurator.Configure();

            ServiceLayer.Start();
            Console.WriteLine("Press any key");
            Console.ReadLine();
            ServiceLayer.Stop();
        }
Пример #26
0
        public ActionResult Insert(ServiceLayer sl)
        {
            if (!sl.initialized)
            {
                sl.init();
                Session["sl"] = sl;
            }
            IEnumerable <QueryState> ts = sl.tableEnum;

            return(View(ts));
        }
Пример #27
0
 public void setUp()
 {
     service = ServiceLayer.getInstance(false);
     owner   = service.initUser();
     user    = service.initUser();
     service.register("owner", "123", owner);
     service.register("user", "123", user);
     service.signIn("owner", "123");
     service.signIn("user", "123");
     service.openStore("store", "owner");
 }
Пример #28
0
        public ActionResult Edit(int Id)
        {
            ServiceLayer service = new ServiceLayer();
            var          e       = service.getAEmployee(Id);
            var          emp     = new EmpEditVm {
                id = e.id, name = e.name, position = e.position, salary = e.salary, age = e.age
            };

            ViewBag.emp = emp;
            return(View());
        }
Пример #29
0
        static void Main(string[] args)
        {
            // start log4net
            XmlConfigurator.Configure();

            SpiderPrincipal.Login("SYSTEM", "SYS");

            ServiceLayer.Start();
            Console.WriteLine("Press any key");
            Console.ReadLine();
            ServiceLayer.Stop();
        }
Пример #30
0
        public void Setup()
        {
            repoLayer    = new RepositoryLayer();
            serviceLayer = new ServiceLayer("Listeners.s3db", repoLayer);

            // Insert some data.
            repoLayer.ClearAllData(serviceLayer.GetConnection());
            InsertListeners();
            InsertCollectors();
            InsertWeeklyStats();
            InsertYearStats();
        }
 /// <summary>
 /// This method exposes the internal ServicLayer.CurrentContext setter.  This method may be used when a ServiceLayer-derived object is manually instantiated 
 /// outside of the normal framework mechanism (eg when testing via NUnit) to manually set the PersistenceContext.  Allows for a mock PersistenceContext to be 
 /// used, which in turn allows mock EntityBroker objects to be used to return test data.
 /// </summary>
 /// <example>
 /// <code>
 ///    _mocks = new Mockery();
 ///    _mockPersistanceContext = _mocks.NewMock&lt;IPersistenceContext&gt;();
 ///    _service= new ServiceLayer();
 ///    ServiceLayerTestHelper.SetServiceLayerPersistenceContext(
 ///        _service, _mockPersistanceContext);
 /// </code>
 /// </example>
 /// <see>ClearCanvas.Ris.Services.Tests.AdtServiceTest</see>
 /// <param name="serviceLayer"></param>
 /// <param name="context"></param>
 public static void SetServiceLayerPersistenceContext(ServiceLayer serviceLayer, IPersistenceContext context)
 {
     serviceLayer.CurrentContext = context;
 }