public ReadOnlyViewModel(ReadOnlyView employeeOpen)
        {
            employeee = employeeOpen;

            Service.Service s = new Service.Service();
            employed = s.GetAllEmployee().ToList();
        }
Esempio n. 2
0
        private void SetFormFieldData()
        {
            if (!IsNew)
            {
                Protocol biz = new Protocol();

                biz.Get(int.Parse(BaseProtocolId));

                foreach (string colName in biz.FieldNames)
                {
                    Label field = ReadOnlyView.FindControl(colName) as Label;
                    if (field != null)
                    {
                        if (field.ID == Protocol.ProjectId) // get Project Title and Num
                        {
                            field.Text = GetProjectInfo(biz[colName].ToString());
                        }
                        else
                        {
                            field.Text = biz[colName].ToString();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public void Stores()
        {
            var r = new ReadOnlyView(new MemoryStore());

            Assert.AreEqual(uint.MaxValue, r.BlockHashIndex.Get().Index);
            Assert.AreEqual(UInt256.Zero, r.BlockHashIndex.Get().Hash);
            Assert.AreEqual(uint.MaxValue, r.HeaderHashIndex.Get().Index);
            Assert.AreEqual(UInt256.Zero, r.HeaderHashIndex.Get().Hash);
            Assert.AreEqual(0, r.Blocks.Find().Count());
            Assert.AreEqual(0, r.Transactions.Find().Count());
            Assert.AreEqual(0, r.Storages.Find().Count());
            Assert.AreEqual(0, r.HeaderHashList.Find().Count());
        }
        /// <summary>
        /// Method for deciding which View will open according to logged in Employee credentials
        /// </summary>
        private void LoginExecute()
        {
            try
            {
                switch (loggedEmployee.Role)
                {
                case "Admin":
                    AdminView adminMenu = new AdminView();
                    adminMenu.ShowDialog();
                    loginView.Close();
                    break;

                case "Employee":
                    EmployeeView employeeView = new EmployeeView(loggedEmployee.ID);
                    employeeView.ShowDialog();
                    loginView.Close();
                    break;

                case "Manager":
                    tblManager manager = Services.LogInService.GetManagerById(loggedEmployee.ID);
                    if (manager.AccessLevel == "Modify")
                    {
                        ModifyView modify = new ModifyView();
                        modify.ShowDialog();
                        loginView.Close();
                    }
                    else
                    {
                        ReadOnlyView readOnly = new ReadOnlyView();
                        readOnly.ShowDialog();
                        loginView.Close();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 5
0
        private void LoginExecute()
        {
            try
            {
                switch (role.RoleName)
                {
                case "WPFadmin":
                    WPFadminView adminMenu = new WPFadminView();
                    adminMenu.ShowDialog();
                    break;

                case "Employee":
                    AddReportView addReport = new AddReportView();
                    addReport.ShowDialog();
                    break;

                case "Manager":
                    tblManager manager = Service.Service.GetManagerById(logged.EmployeeID);
                    if (manager.AccessLevel == "Modify")
                    {
                        ModifyView modify = new ModifyView();
                        modify.ShowDialog();
                    }
                    else
                    {
                        ReadOnlyView readOnly = new ReadOnlyView();
                        readOnly.ShowDialog();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 6
0
        public void CommitException()
        {
            var r = new ReadOnlyView(new MemoryStore());

            Assert.ThrowsException <NotSupportedException>(() => r.Commit());
        }
 public ReadOnlyViewModel(ReadOnlyView readOnlyOpen)
 {
     readOnly     = readOnlyOpen;
     service      = new Service();
     EmployeeList = service.GetAllEmployees().ToList();
 }
Esempio n. 8
0
 public void UniTest1()
 {
     var view = new ReadOnlyView<TestClass>();
 }