コード例 #1
0
        public IActionResult GetAuthors()
        // public IEnumerable<Author> Get()
        {
            var authors = Mapper.Map <IEnumerable <AuthorDto> >(Respository.GetAuthorList());

            return(Ok(authors));
        }
コード例 #2
0
ファイル: Fragment2.cs プロジェクト: Lijun-Mud/MyAndroid
        //public override void OnActivityCreated(Bundle savedInstanceState)
        //{
        //    base.OnActivityCreated(savedInstanceState);
        //    DoWork();
        //}

        private async void DoWork()
        {
            var pr = new Android.App.ProgressDialog(globalContext);

            pr.SetMessage("Loading data");
            pr.SetCancelable(false);
            pr.Show();

            var repository = new Respository();
            //var channel = await await Task.Factory.StartNew(async() =>await repository.ReadPsi());//repository.ReadPsi();
            //var channel = await await await Task.Factory.StartNew(() =>repository.ReadPsi().ContinueWith<Task<Channel>>(t=>t,TaskContinuationOptions.OnlyOnFaulted));
            await Task.Factory.StartNew(() => BigLongImportantMethodAsync());

            var channel      = _channelResult;
            var psiInfo      = PsiInformation.Parse(channel);
            var view         = globalView;
            var foundTextbox = view.FindViewById <TextView>(Resource.Id.textViewUpdateTime);

            foundTextbox.Text = psiInfo.DisplayUpdateTime;
            foundTextbox      = view.FindViewById <TextView>(Resource.Id.textView3hrPsi);
            foundTextbox.Text = psiInfo.Psi3Hour;
            foundTextbox      = view.FindViewById <TextView>(Resource.Id.textView24hrPsi);
            foundTextbox.Text = psiInfo.Psi24Hour;

            var root = view.FindViewById <LinearLayout>(Resource.Id.linearLayoutRoot);

            root.Visibility = ViewStates.Visible;

            pr.Hide();
        }
コード例 #3
0
        public void should_retrieve_existing_user()
        {
            User savedUser;

            using (var context = new DigitalHiveContext(_options))
            {
                var repository = new Respository(context);

                User user = new User()
                {
                    Username = "******",
                    Password = "******",
                    Role     = "Manager"
                };

                savedUser = repository.RegisterUser(user);
            }

            using (var context = new DigitalHiveContext(_options))
            {
                var repository = new Respository(context);
                var result     = repository.GetUser("existinguser");
                Assert.AreEqual(result.ID, savedUser.ID, "Users do not match as expected");
            }
        }
コード例 #4
0
 public AttributesController()
 {
     _attr = new Respository <Attributes>();
     _atty = new Respository <AttributeType>();
     _pro  = new Respository <Product>();
     _prat = new Respository <ProductAttr>();
 }
コード例 #5
0
 public CartController()
 {
     _products   = new Respository <Product>();
     _attributes = new Respository <Project.Net.Models.DataModel.Attributes>();
     _orders     = new Respository <Order>();
     _proAttr    = new Respository <ProductAttr>();
 }
コード例 #6
0
ファイル: CNEController.cs プロジェクト: radtek/ThomRe
        public JsonTable GetSdLocalRefineryCompany(bool isEnglish, out string defaultCode)
        {
            var result = Respository.GetSdLocalRefineryCompany(isEnglish);

            defaultCode = result.Rows[0][0].ToString();
            return(BuidJsonTable(result));
        }
コード例 #7
0
 public GroupController()
 {
     _group     = new Respository <Group>();
     _business  = new Respository <Business>();
     _role      = new Respository <Role>();
     _groupRole = new Respository <GroupRoles>();
 }
コード例 #8
0
 public OrderController()
 {
     _odr          = new Respository <Order>();
     _products     = new Respository <Product>();
     _orderDetails = new Respository <OrderDetails>();
     _attributes   = new Respository <Attributes>();
 }
コード例 #9
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            // check đăng nhập
            if (HttpContext.Current.Session["User"] == null)
            {
                return(false);
            }
            if (String.IsNullOrEmpty(this.Roles))
            {
                return(true);
            }
            // lấy controller hiện tại
            var controller = HttpContext.Current.Request.RequestContext.RouteData.GetRequiredString("controller");
            // lấy quyền người dùng
            Respository <GroupRoles> _groupRole = new Respository <GroupRoles>();
            var _user       = HttpContext.Current.Session["User"] as User;
            var _groupRoles = _groupRole.GetBy(x => x.GroupId == _user.GroupId);

            // check xem trong đó có quyền yêu cầu hay không
            if (!_groupRoles.Any(x => x.BusinessId == controller && x.RoleId == this.Roles))
            {
                return(false);
            }
            return(true);
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: IvoJovanovic/MusicApp
        static void Main(string[] args)
        {
            var respository = new Respository();

            respository.GetAllPersons(1);

            respository.GetAllSongs();
        }
コード例 #11
0
ファイル: SysRoleServices.cs プロジェクト: VR-Tian/MY7W
        public bool InertModel(SysRoleDto model)
        {
            model.CreateTime = DateTime.Now;
            model.Id         = Guid.NewGuid();
            var temp = Mapper.Map <SysRoleDto, SysRole>(model);

            return(Respository.Insert(temp) > 0 ? true : false);
        }
コード例 #12
0
ファイル: CNEController.cs プロジェクト: radtek/ThomRe
        public ActionResult ExportOutputChartData()
        {
            var data      = Respository.GetSDLocalRefinerExcelData();
            var index     = Respository.GetSDLocalRefineryExcelIndex();
            var valuation = Respository.GetSDLocalRefineryExcelValuation();
            var stock     = Respository.GetSDLocalRefineryExcelStock();

            return(new SDLRChartExcelResult(data, index, valuation, stock));
        }
コード例 #13
0
        public IActionResult BlockAuthorAdd(int id)
        {
            if (Respository.AuthorExists(id))
            {
                return(new StatusCodeResult(StatusCodes.Status409Conflict));
            }

            return(NotFound());
        }
コード例 #14
0
    public void ShouldCrateDynamicQuery()
    {
        var query           = "SELECT Id, DateOfBirth from Customer";
        var rs              = new Respository().Query(query);
        var sumId           = rs.Select(x => (Int32)x.Id).Sum();
        var birthDateOfType = rs.All(x => x.DateOfBirth is string);

        Assert.True(birthDateOfType);
    }
コード例 #15
0
 public ProductsController()
 {
     _product = new Respository <Product>();
     _cat     = new Respository <Category>();
     _sup     = new Respository <Supplier>();
     _attr    = new Respository <AttributeType>();
     _prAttr  = new Respository <ProductAttr>();
     _note    = new Respository <Note>();
     _proNote = new Respository <ProductNote>();
     _od      = new Respository <OrderDetails>();
 }
コード例 #16
0
 public ViewResult RsvpForm(GuestResponse guestResponse)
 {
     if (ModelState.IsValid)
     {
         Respository.AddResponse(guestResponse);
         return(View("Thanks", guestResponse));
     }
     else
     {
         return(View());
     }
 }
コード例 #17
0
ファイル: CNEController.cs プロジェクト: radtek/ThomRe
        public ActionResult GetSDLocalRefineryChartData(DateTime start, DateTime end, bool isHTML = false)
        {
            var    result = Respository.GetSDLocalRefineryChartData();
            string defaultCode;
            var    companyList = GetSdLocalRefineryCompany(CultureHelper.IsEnglishCulture(), out defaultCode);
            string reDate;
            var    dailyOutputTable = ConvertToDicForOutput(start, end, defaultCode, out reDate);
            var    deviceInfoTable  = ConvertToDicForDevice(CultureHelper.IsEnglishCulture(), defaultCode, reDate);
            var    data             = new { chart = result, companyList, deviceInfoTable, dailyOutputTable, reDate };

            return(isHTML ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
        // public string Get(int id)
        // {
        //     return "value";
        // }
        public IActionResult GetAuthor(int id)
        {
            var author = Respository.GetAuthor(id);

            if (author == null)
            {
                return(NotFound());  // 404
            }
            var authorDto = Mapper.Map <AuthorDto>(author);

            return(Ok(authorDto));
        }
コード例 #19
0
        public AccountType(Respository repo)
        {
            Name = "Account";
            Description = "Account information of a person";

            Field(d => d.AccountId);
            Field(d => d.Address);
            Field(d => d.Name);
            Field(d => d.Country);
            Field(d => d.Email);
            Field(d => d.HomeBranchId);
            Field<BranchType>("BranchDetail", resolve: context => repo.GetBranchByBranchId(context.Source.HomeBranchId));
        }
コード例 #20
0
    public void ShoudCreateSchema()
    {
        var customer = new Customer {
            FirstName   = "wk",
            LastName    = "wk",
            DateOfBirth = DateTime.Now
        };

        var context = new Respository();
        var id      = context.SaveCustomers(customer);

        Assert.True(id > 0);
    }
コード例 #21
0
        public IActionResult GetBooksForAuthor(int authorId)
        {
            if (!Respository.AuthorExists(authorId))
            {
                return(NotFound());
            }

            var booksFromRepo = Respository.GetBookList(authorId);

            var booksForAuthor = Mapper.Map <IEnumerable <BookDto> >(booksFromRepo);

            return(Ok(booksForAuthor));
        }
コード例 #22
0
 public List <TaskDTO> GetTasks()
 {
     try
     {
         var tasks = Respository.Tasks();
         return(tasks);
     }
     catch (Exception exception)
     {
         //log Exception
     }
     return(new List <TaskDTO>());
 }
コード例 #23
0
        public BranchType(Respository repo)
        {
            Name        = "Branch";
            Description = "Branch related information";

            Field(d => d.BranchId);
            Field(d => d.Address);
            Field(d => d.BranchCode);
            Field(d => d.Country);
            Field <ListGraphType <AccountType> >(
                "AccountDetails",
                resolve: context => repo.GetAccountByBranchId(context.Source.BranchId));
        }
コード例 #24
0
ファイル: Fragment2.cs プロジェクト: Lijun-Mud/MyAndroid
        private async void BigLongImportantMethodAsync()
        {
            var repository = new Respository();

            try
            {
                _channelResult = await repository.ReadPsi();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #25
0
        public IActionResult GetAuthorCollection(string ids)
        // public IActionResult GetAuthorCollection(IEnumerable<int> ids)         // Custom Model Binder - Nah -- very complicated, see Demo - Working with Array Keys
        {
            var idList     = StringHelper.StringToIntegerList(ids);
            var authorList = Respository.GetAuthors(idList);

            if (idList.Count() != authorList.Count())
            {
                return(NotFound());
            }

            return(Ok(Mapper.Map <IEnumerable <AuthorDto> >(authorList)));
        }
コード例 #26
0
 public static List <Prestamos> GetList(Expression <Func <Prestamos, bool> > criterio)
 {
     using (var context = new Respository <Prestamos>())
     {
         try
         {
             return(context.GetList(criterio));
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
コード例 #27
0
 public static List <Prestamos> GetListAll()
 {
     using (var context = new Respository <Prestamos>())
     {
         try
         {
             return(context.GetListAll());
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
コード例 #28
0
 public static Productos Buscar(Expression <Func <Productos, bool> > criterio)
 {
     using (var context = new Respository <Productos>())
     {
         try
         {
             return(context.Buscar(criterio));
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
コード例 #29
0
 public static bool Eliminar(Prestamos prestamos)
 {
     using (var context = new Respository <Prestamos>())
     {
         try
         {
             return(context.Eliminar(prestamos));
         }
         catch (Exception)
         {
             throw;
         }
     }
 }
コード例 #30
0
 public static bool Modificar(Productos producto)
 {
     using (var context = new Respository <Productos>())
     {
         try
         {
             return(context.Modificar(producto));
         }
         catch (Exception)
         {
             throw;
         }
     }
 }