示例#1
0
 public transactions()
 {
     adminServices = new AdminServices();
 }
示例#2
0
 public AdminController(AdminServices adminServices)
 {
     this.adminServices = adminServices;
 }
示例#3
0
        public static void Initialize(CoreContext context, AdminServices adminServ)
        {
            context.Database.EnsureCreated();
            if (!context.DrinkTypes.Any())
            {
                //setup drink types
                List <DrinkType> drinkList = new List <DrinkType>();
                drinkList.Add(new DrinkType
                {
                    Description = "Pepsi",
                    Price       = 1.25
                });
                drinkList.Add(new DrinkType
                {
                    Description = "Mist Twist",
                    Price       = 1
                });
                drinkList.Add(new DrinkType
                {
                    Description = "Mountain Dew",
                    Price       = 1.5
                });
                foreach (var type in drinkList)
                {
                    context.DrinkTypes.Add(type);
                }
                context.SaveChanges();
            }
            if (!context.Users.Any())
            {
                //setup users here
                List <User> users = new List <User>
                {
                    new User
                    {
                        Name = "Joshua Wetzel"
                    },
                    new User
                    {
                        Name = "Ryan Craft"
                    },
                    new User
                    {
                        Name = "Patrick Gandolfo"
                    },
                    new User
                    {
                        Name = "Joseph Schenck"
                    }
                };

                foreach (var user in users)
                {
                    context.Users.Add(user);
                }
                context.SaveChanges();
            }
            if (!context.DrinkOrders.Any())
            {
                //setup DrinkOrders
            }
            if (!context.Admins.Any())
            {
                adminServ.CreateAdmin(new Admin
                {
                    Password = "******",
                    Username = "******"
                });
                adminServ.CreateAdmin(new Admin()
                {
                    Password = "******",
                    Username = "******"
                });
            }
        }
 public CuratorListEffects(AdminServices admin, DatabaseListService dbListService)
 {
     _admin        = admin;
     DbListService = dbListService;
 }
 public provider_rights()
 {
     adminServices = new AdminServices();
 }
 public ExceptionTest()
 {
     _AdminServices    = new AdminServices(_session);
     _Customerservices = new CustomerServices(_session);
     _BranchServices   = new BranchServices(_session);
 }
示例#7
0
 public shipping()
 {
     adminServices = new AdminServices();
 }
 private void confirmBtn_Click(object sender, EventArgs e)
 {
     if (Admin1 != null)
     {
         if (textBox1.Text == "" || textBox4.Text == "")
         {
             MessageBox.Show("Plese Insert password first");
         }
         else
         {
             if (textBox4.Text.Equals(textBox1.Text))
             {
                 AdminServices adminservice = new AdminServices();
                 Admin1.Password = textBox1.Text;
                 adminservice.UpdatePass(Admin1);
                 MessageBox.Show("Password changed ");
             }
             else
             {
                 MessageBox.Show("Password did not match");
             }
         }
     }
     else if (Staff1 != null)
     {
         if (textBox1.Text == "" || textBox4.Text == "")
         {
             MessageBox.Show("Plese Insert password first");
         }
         else
         {
             if (textBox4.Text.Equals(textBox1.Text))
             {
                 StaffServices staffServices = new StaffServices();
                 Staff1.Password = textBox1.Text;
                 staffServices.UpdatePass(Staff1);
                 MessageBox.Show("Password changed ");
             }
             else
             {
                 MessageBox.Show("Password did not match");
             }
         }
     }
     else if (Doctor1 != null)
     {
         if (textBox1.Text == "" || textBox4.Text == "")
         {
             MessageBox.Show("Plese Insert password first");
         }
         else
         {
             if (textBox4.Text.Equals(textBox1.Text))
             {
                 DoctorService doctorService = new DoctorService();
                 Doctor1.Password = textBox1.Text;
                 doctorService.UpdatePass(Doctor1);
                 MessageBox.Show("Password changed ");
             }
             else
             {
                 MessageBox.Show("Password did not match");
             }
         }
     }
 }
示例#9
0
 public AdminTest()
 {
     _service = new AdminServices(_session);
 }
示例#10
0
 public AdminController(UnitOfWork unitOfWork)
 {
     this.data          = unitOfWork;
     this.signInManager = new SignInManager(this.data);
     this.service       = new AdminServices(this.data);
 }
示例#11
0
        /// <summary>
        /// Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.
        /// </summary>
        /// <param name="request">The HTTP request message to send to the server.</param>
        /// <param name="cancellationToken">A cancellation token to cancel operation.</param>
        /// <returns>
        /// Returns <see cref="T:System.Threading.Tasks.Task`1" />. The task object representing the asynchronous operation.
        /// </returns>
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            const string APP_KEY    = "X-AppKey";
            const string APP_SECRET = "X-Token";
            const string SYS_APP    = "X-SYSAPP";
            const string MTOKEN     = "MGMTOKEN";
            const string MSEC       = "MGMSEC";


            string MGM_TOKEN  = CloudConfigurationManager.GetSetting("MGMToken");
            string MGM_SECRET = CloudConfigurationManager.GetSetting("MGMSecret");


            if (request.Headers.Contains(MTOKEN) && request.Headers.Contains(MSEC))
            {
                string Token  = request.Headers.GetValues(MTOKEN).First();
                string Secret = request.Headers.GetValues(MSEC).First();

                if (!(Token.Equals(MGM_TOKEN) && Secret.Equals(MGM_SECRET)))
                {
                    HttpResponseMessage reply = request.CreateErrorResponse(HttpStatusCode.Forbidden, "Access denied.");
                    return(await Task.FromResult(reply));
                }
            }
            else
            {
                if (request.Headers.Contains(APP_KEY) && request.Headers.Contains(APP_SECRET))
                {
                    string appKey    = Uri.UnescapeDataString(request.Headers.GetValues(APP_KEY).First());
                    string appSecret = Uri.UnescapeDataString(request.Headers.GetValues(APP_SECRET).First());

                    string sysApp = string.Empty;

                    var services = new AdminServices();

                    var calledService = request.RequestUri.AbsoluteUri.Substring(request.RequestUri.AbsoluteUri.LastIndexOf("/") + 1);

                    if (!String.IsNullOrEmpty(calledService))
                    {
                        //Check, if we have a admin service here
                        if (services.AdminServiceIdentifiers.Contains(calledService))
                        {
                            if (request.Headers.Contains(SYS_APP))
                            {
                                sysApp = request.Headers.GetValues(SYS_APP).First();
                            }
                            else
                            {
                                HttpResponseMessage reply = request.CreateErrorResponse(HttpStatusCode.Forbidden, "Access denied.");
                                return(await Task.FromResult(reply));
                            }
                        }
                    }


                    #region CheckParameters
                    if (String.IsNullOrEmpty(appKey))
                    {
                        HttpResponseMessage reply = request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid app key.");
                        return(await Task.FromResult(reply));
                    }

                    if (String.IsNullOrEmpty(appSecret))
                    {
                        HttpResponseMessage reply = request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid app secret.");
                        return(await Task.FromResult(reply));
                    }
                    #endregion
                    //TODO, CREATE ANOTHER OVERLOAD
                    UserAppAuthenticationManager authManager = new UserAppAuthenticationManager();
                    bool tokenValid = false;

                    if (String.IsNullOrEmpty(sysApp))
                    {
                        tokenValid = await authManager.ValidateSystemAppToken(appKey, appSecret);
                    }
                    else
                    {
                        var mgmtSecret = CloudConfigurationManager.GetSetting("ManagementSecret");
                        if (sysApp.Equals(mgmtSecret))
                        {
                            tokenValid = await authManager.ValidateSystemAppToken(appKey, appSecret);
                        }
                        else
                        {
                            tokenValid = false;
                        }
                    }
                    if (!tokenValid)
                    {
                        HttpResponseMessage reply = request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Please check app and user data.");
                        return(await Task.FromResult(reply));
                    }
                }
                else
                {
                    HttpResponseMessage reply = request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Request is missing authorization data.");
                    return(await Task.FromResult(reply));
                }
            }
            return(await base.SendAsync(request, cancellationToken));
        }
 public AdmonController(AdminServices service)
 {
     _service = service;
 }
 public FunctionalTest()
 {
     _Adminservice = new AdminServices(_session);
     _Userservice  = new UserServices(_session);
 }
示例#14
0
 public bank_data()
 {
     adminServices = new AdminServices();
 }
 public ExceptionalTest()
 {
     _AdminServices      = new AdminServices(_session);
     _PoliticianServices = new PoliticianPartyServices(_session);
 }
示例#16
0
        private void btnAddProduct_Click(object sender, RoutedEventArgs e)
        {
            AdminServices adminServices = new AdminServices();

            adminServices.addProduct(txtProductName.Text, txtProductPrice.Text, txtDescripton.Text, txtSize.Text, txtType.Text);
        }
 public FunctionalTest()
 {
     _adminServices    = new AdminServices(_session);
     _customerServices = new CustomerServices(_session);
 }
 public BoundaryTest()
 {
     _AdminServices    = new AdminServices(_session);
     _CustomerServices = new CustomerServices(_session);
 }
示例#19
0
 public online()
 {
     adminServices = new AdminServices();
 }
示例#20
0
 public FunctionalTest()
 {
     _CustomerServices = new CustomerServices(_session);
     _BranchServices   = new BranchServices(_session);
     _AdminServices    = new AdminServices(_session);
 }
示例#21
0
 private void button7_Click(object sender, EventArgs e)
 {
     this.dataGridView2.DataSource = AdminServices.GetALLAdmin();
 }
 public ExceptionTest()
 {
     _CustomerServices = new CustomerServices(_session);
     _AdminServices    = new AdminServices(_session);
 }
 public ExceptionTest()
 {
     _ManegerServices = new ManegerServices(_session);
     _AdminServices   = new AdminServices(_session);
 }