示例#1
0
 private void OpenFile()
 {
     if (dsEx1.Tables[0].Rows.Count > 0)
     {
         AccountsToBeImported = new BLLService().Get_AccountsToBeReceipted(dsEx1);
     } 
 }
        public override void OnAuthorization(HttpActionContext actionContext)
        {
            var x = actionContext.Request.Headers.GetValues("Authorization").First();

            if (actionContext.Request.Headers.GetValues("Authorization").First() != null)
            {
                // get value from header
                int authenticateUserID = Convert.ToInt32(
                    actionContext.Request.Headers.GetValues("Authorization").FirstOrDefault());

                BLLService bllService = new BLLService();
                var        roleID     = bllService.GetUserbyID(authenticateUserID).roleID;
                if (roleID != 1)
                {
                    HttpContext.Current.Response.AddHeader("authenticationToken", authenticateUserID + "");
                    HttpContext.Current.Response.AddHeader("AuthenticationStatus", "NotAuthorized");
                    actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Forbidden);
                    return;
                }
                HttpContext.Current.Response.AddHeader("authenticationToken", authenticateUserID + "");
                HttpContext.Current.Response.AddHeader("AuthenticationStatus", "Authorized");
                return;
            }
            actionContext.Response =
                actionContext.Request.CreateResponse(HttpStatusCode.ExpectationFailed);
            actionContext.Response.ReasonPhrase = "Please provide valid inputs";
        }
示例#3
0
        private void ButLogin_Clicked(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(txtAccount.Text))
            {
                this.DisplayAlert("提示", "帳號未輸入", "確定");
                return;
            }
            if (string.IsNullOrEmpty(txtPwd.Text))
            {
                this.DisplayAlert("提示", "密碼未輸入", "確定");
                return;
            }

            if (this.swRember.IsToggled)
            {
                Settings.Account    = this.txtAccount.Text;
                Settings.isRemember = this.swRember.IsToggled;
            }
            BLLService BLL = new BLLService();

            bool result = BLL.Login(txtAccount.Text, txtPwd.Text);

            if (result)
            {
                App.Current.MainPage = new MasterDetail();
            }
            else
            {
                this.DisplayAlert("提示", "帳號密碼錯誤", "確定");
                return;
            }
        }
        static void Main(string[] args)
        {
            //Class1 cl = new Class1();
            ////    var x = cl.mymethod();

            UserService us = new UserService();

            //us.GetHistory(2);
            //us.GetTestLogs(4);
            //us.GetSubCategoryName(1);
            //us.GetSubCatName(2);
            //us.MarksCalculate(2);
            //us.GetUserResult(2);
            //us.UpdateTestLog(2);
            //us.GetUserTestResult(2);
            us.Reports(4, 2);
            //us.GetSubcategoriesByUser(4, 2);

            //category cat01 = new category { categoryName = "Java" };
            //subcategory subcat01 = new subcategory { subcategoryName = "Java01" };

            BLLService _bllService = new BLLService();
            //_bllService.GetUserTestResult(2);
            AdminService ads = new AdminService();
            //ads.AddCategory(cat01);
            //ads.AddSubCategory(subcat01);
            //ads.GetQuestionsBySubcategory(2);
            //ads.RemoveTest(3);
            // _bllService.AddExcelToDb(new test { testID = 1 }, "D:\\Major Project 01\\BackEnd\\OnlineAssessmentSystem\\OnlineAssessmentSystem\\Uploads\\SampleNew.xlsx");
            // _bllService.UpdateTestLog(2);
            // var data = _bllService.GetSubcategoryByCategory(2).ToList();
            //var data = _bllService.GetUserTest(1, 1);
        }
示例#5
0
 public SBRoleProvider()
 {
     this._service=new BLLService();
 }
示例#6
0
 public SBMembershipProvider()
 {
     this._service = new BLLService();
 }