Пример #1
0
        public static int CaptureDetails(string surname, string firstNames, string contact, string date, int age
                                         , bool pizza, bool pasta, bool papWors, bool chickenStir, bool beefStir, bool others,
                                         int eatOut, int watchMovies, int watchTv, int radio)
        {
            DetailsModel data = new DetailsModel
            {
                Surname     = surname,
                FirstNames  = firstNames,
                Contact     = contact,
                Date        = date,
                Age         = age,
                Pizza       = pizza,
                Pasta       = pasta,
                PapWors     = papWors,
                ChickenStir = chickenStir,
                BeefStir    = beefStir,
                Other       = others,
                EatOut      = eatOut,
                WatchMovies = watchMovies,
                WatchTv     = watchMovies,
                Radio       = radio
            };

            string sql = @"insert into dbo.tbl_surveys ( Surname, FirstNames, Contact,  Date, Age
                            , Pizza, Pasta, PapWors, ChickenStir, BeefStir,  Other,
                                EatOut,  WatchMovies,  WatchTv, Radio)
                values ( @Surname, @FirstNames, @Contact,   @Date, @Age,
                    @Pizza, @Pasta, @PapWors, @ChickenStir, @BeefStir, @Other,
                    @EatOut,  @WatchMovies,  @WatchTv, @Radio);";

            return(SqlDataAccess.SaveData(sql, data));
        }
Пример #2
0
        public ActionResult Details(long?id)
        {
            if (id != null)
            {
                var message = _MessService.Get(id.Value);

                _MessService.ToRead(message.MessageID);
                long userid = SecurityHelper.GetUserId();

                int UnreadInbox   = _MessService.GetUnreadInboxMessages(userid);
                int UnreadDeleted = _MessService.GetUnreadDeletedMessages(userid);

                var model = new DetailsModel(UnreadInbox, UnreadDeleted, message);

                long?managerid = _manService.GetManageridByUserID(SecurityHelper.GetUserId());
                if (managerid != null)
                {
                    model.ManagerID = managerid.Value;
                }

                model.Messages = _MessService.GetAllMessagesByUserID(userid).ToPagedList(model.Page, model.PageSize);

                return(View(model));
            }
            return(RedirectToAction("Inbox", "Mail"));
        }
Пример #3
0
        internal void RemoveSelected(DetailsModel item)
        {
            lock (tempTemplateViewList)
            {
                if (item == null)
                {
                    return;
                }

                Xamarin.Forms.TemplatedView _view = null;
                foreach (Xamarin.Forms.TemplatedView items in this._spSelectedList.Children)
                {
                    if (items.BindingContext == item)
                    {
                        _view = items;
                        break;
                    }
                }

                if (null != _view)
                {
                    _view.BindingContext = null;
                    if (!tempTemplateViewList.Contains(_view))
                    {
                        tempTemplateViewList.Add(_view);
                    }
                    _view.IsVisible = false;
                }


                CurrentSelectedList.Remove(item);
            }
        }
Пример #4
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            LoanViewModel lvm = new LoanViewModel();

            lvm = await _loanService.GetLoan((int)id);

            if (lvm == null)
            {
                return(NotFound());
            }

            //var loanViewModel = await _context.Loans
            //    .Include(l => l.Book)
            //    .SingleOrDefaultAsync(m => m.ID == id);
            //if (loanViewModel == null)
            //{
            //    return NotFound();
            //}

            BookLoan.Views.Loan.DetailsModel detailsModel = new DetailsModel(_context);
            detailsModel.LoanViewModel = lvm; // loanViewModel;

            return(View(detailsModel));
        }
Пример #5
0
        internal void ReloadList()
        {
            List <DetailsModel> items = CurrentSelectedList.ToList();

            CurrentSelectedList.Clear();
            CurrentSelectedList = new ObservableCollection <DetailsModel>();


            foreach (var item in items)
            {
                DetailsModel model = new DetailsModel();
                model.OrderDetail = item.OrderDetail;
                model.Product     = item.Product;
                model.AddTime     = item.AddTime;


                model.IsNew = item.IsNew;

                model.IsTakeout = item.IsTakeout;
                model.NewPrice  = item.NewPrice;
                model.No        = item.No;
                model.Operate   = item.Operate;

                CurrentSelectedList.Add(model);
            }


            items = null;
        }
 //提交审核
 protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
 {
     if (this.Label2.Text == "保存成功!")
     {
         DetailsModel dm = new DetailsModel();
         //筹集天数
         int day = (int)Session["day"];
         //发起时间
         dm.Release_date = DateTime.Now;
         //结束时间
         dm.Closing_date = DateTime.Now.AddDays(day);
         //喜欢人数
         dm.Like_number = 0;
         //众筹进度
         dm.Financing_state = "众筹中";
         //已筹集金额
         dm.Raised_amount = 0;
         //项目编号
         dm.ProjectID = (int)Session["ProjectID"];
         //筹集情况
         dm.Operation = "进行中";
         if (ReturnBLL.InProjectDetails(dm))
         {
             Response.Redirect("/over.aspx");
         }
         else
         {
             this.Label2.Text = "数据错误!";
         }
     }
     else
     {
         this.Label2.Text = "请先保存!";
     }
 }
        public DetailsModel ProcessConversion(DetailsModel dataModel)
        {
            result.Name    = dataModel.Name;
            result.Numbers = dataModel.Numbers;

            //with decimal points
            if (dataModel.Numbers % 1 > 0)
            {
                string[] number = dataModel.Numbers.ToString().Split('.');

                string wholeNumberValue = string.Format("{0} DOLLARS", ConvertNumberToWords(Convert.ToInt32(number[0])).Words);
                result.Words = string.Empty;
                string decimalValue = string.Format(" AND {0} CENTS", ConvertNumberToWords(Convert.ToInt32(number[1])).Words);

                result.Words = wholeNumberValue + decimalValue;
            }
            //whole number only
            else
            {
                result       = ConvertNumberToWords(Convert.ToInt32(dataModel.Numbers));
                result.Words = string.Format("{0} DOLLARS", result.Words);
            }

            return(result);
        }
Пример #8
0
        public void Put(int id, DetailsModel model)
        {
            using (var connection = new SqlConnection(connectionString))
            {
                var commandText = "updateDetail";
                var command     = new SqlCommand(commandText, connection);

                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@id", model.id);
                command.Parameters.AddWithValue("@title", String.IsNullOrEmpty(model.title) ? "" : model.title);
                command.Parameters.AddWithValue("@image", String.IsNullOrEmpty(model.image) ? "" : model.image);
                command.Parameters.AddWithValue("@subTitle", String.IsNullOrEmpty(model.subTitle) ? "" : model.subTitle);
                command.Parameters.AddWithValue("@date", String.IsNullOrEmpty(model.date) ? "" : model.date);
                command.Parameters.AddWithValue("@hour", String.IsNullOrEmpty(model.hour) ? "" : model.hour);
                command.Parameters.AddWithValue("@place", String.IsNullOrEmpty(model.place) ? "" : model.place);
                command.Parameters.AddWithValue("@description", String.IsNullOrEmpty(model.description) ? "" : model.description);
                command.Parameters.AddWithValue("@tags", String.IsNullOrEmpty(model.tags) ? "" : model.tags);
                command.Parameters.AddWithValue("@youtube", String.IsNullOrEmpty(model.youtube) ? "" : model.youtube);
                command.Parameters.AddWithValue("@organizer", String.IsNullOrEmpty(model.organizer) ? "" : model.organizer);
                command.Parameters.AddWithValue("@phone", String.IsNullOrEmpty(model.phone) ? "" : model.phone);
                command.Parameters.AddWithValue("@categoryId", model.categoryId);

                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Пример #9
0
        public async Task OnGetAsync_PopulatesThePageModel_WithARole(int roleId)
        {
            // Arrange
            var optionsBuilder = new DbContextOptionsBuilder <ClippyContext>()
                                 .UseInMemoryDatabase("InMemoryDb");
            var mockContext  = new Mock <ClippyContext>(optionsBuilder.Options);
            var expectedRole = DatabaseInitializer.GetSeedingRoles().Single(r => r.Id == roleId);

            mockContext.Setup(
                db => db.GetRoleAsync(roleId)).Returns(Task.FromResult(expectedRole));
                var httpContext = new DefaultHttpContext();
            var     tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());
            var     pageModel   = new DetailsModel(mockContext.Object)
            {
                TempData = tempData    
            };

            // Act
            await pageModel.OnGetAsync(roleId);

            // Assert
            var actualRole = Assert.IsAssignableFrom <Role>(pageModel.Role);

            Assert.Equal(expectedRole.Name, actualRole.Name);
        }
Пример #10
0
        //Get the Vendor's only.
        public IActionResult Vendors()
        {
            var model = new DetailsModel();

            model.users = _userData.GetVendor();
            return(View(model));
        }
Пример #11
0
        //Get the Vendor's only.
        public IActionResult Client()
        {
            var model = new DetailsModel();

            model.users = _userData.GetClient();
            return(View(model));
        }
Пример #12
0
 public DetailsModel Login([FromBody] LoginClient loginClient)
 {
     try
     {
         if (_loginService.Login(loginClient.Name, loginClient.PhoneNumber) != null)
         {
             Client       client       = _loginService.Login(loginClient.Name, loginClient.PhoneNumber);
             DetailsModel detailsModel = new DetailsModel()
             {
                 CurrentClient = client,
                 ClientLines   = _detailService.GetClientLines(client.Id)
             };
             detailsModel.LineList(detailsModel.ClientLines);
             return(detailsModel);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         Common.EnvironmentService.Services.WriteExceptionsToLogger(ex);
         throw new HttpResponseException(HttpStatusCode.BadRequest);
     }
 }
Пример #13
0
        // GET: InputFileHandler
        public ActionResult Index()
        {
            //return DoTask(_ =>
            //{
            var fileReaderService = new FileReaderService();

            fileReaderService.PopulateCSVToEntity();
            var model = new DetailsModel();

            return(View(model));
            //});

            //Task.Factory.StartNew(context =>
            //{
            //    try
            //    {
            //        var fileReaderService = new FileReaderService();
            //        fileReaderService.PopulateCSVToEntity();
            //        var model = new DetailsModel();
            //        return View(model);
            //    }
            //    catch (Exception ex)
            //    {
            //        // log and return an error response rather than hitting the application's
            //        // error handler - we've dealt with it here.
            //        //_logger.Error(ex, errorMessage, args);
            //        //return new (500 /*server error*/);
            //    }
            //});
        }
Пример #14
0
        /// <summary>
        /// 初始化需求
        /// </summary>
        internal void InitialRequest(DetailsModel model)
        {
            this.model = model;
            resultRequestList.Clear();
            this.RequestList.Children.Clear();

            List <Request> lists = Resources.GetRes().Requests.Where(x => x.IsEnable == 1).OrderByDescending(x => x.Order).ThenByDescending(x => x.RequestId).ToList();



            foreach (var item in lists)
            {
                RequestModel request = new RequestModel()
                {
                    IsSelected = false, Request = item
                };

                if (!string.IsNullOrWhiteSpace(model.OrderDetail.Request))
                {
                    if (model.OrderDetail.Request.Split(',').Contains(item.RequestId.ToString()))
                    {
                        request.IsSelected = true;
                    }
                }

                resultRequestList.Add(request);
            }


            foreach (var item in resultRequestList)
            {
                AddRequestsItem(item);
            }
        }
Пример #15
0
        public async Task <DetailsModel> ProcessInput(DetailsModel details)
        {
            if (details != null)
            {
                Task <DetailsModel> restTask = this.PostDetails(details);

                if (details.Id == 0)
                {
                    var id = this.StoreDetails(details);
                    details    = await restTask;
                    details.Id = id;
                }
                else
                {
                    details = await restTask;
                }

                if (details.Id != 0 && details.Result != null)
                {
                    this.StoreResult(details.Id, details.Result);
                }
            }
            else
            {
                details = new DetailsModel();
            }

            return(details);
        }
Пример #16
0
        public DetailsBrowserView(DetailsBrowserFilter detailsBrowserFilter, DetailsModel detailsModel, DocumentTemplate <Metadata> detailsTemplate, DocumentTemplate <Metadata> downloadTemplate, DocumentTemplate <Metadata> detailsPreloadTemplate
                                  , GalleryDownloader galleryDownloader
                                  , PageDownloader pageDownloader
                                  , CoverDownloader coverDownloader
                                  , MetadataKeywordLists metadataKeywordLists
                                  , Configuration.ConfigDetailsBrowserView detailsBrowserSettings
                                  , ISearchResultCache searchResultCache
                                  , ICacheFileSystem cacheFileSystem)
        {
            InitializeComponent();

            DetailsBrowserFilter   = detailsBrowserFilter;
            DetailsModel           = detailsModel;
            DetailsTemplate        = detailsTemplate;
            DownloadTemplate       = downloadTemplate;
            DetailsPreloadTemplate = detailsPreloadTemplate;
            GalleryDownloader      = galleryDownloader;
            PageDownloader         = pageDownloader;
            CoverDownloader        = coverDownloader;
            MetadataKeywordLists   = metadataKeywordLists;
            DetailsBrowserSettings = detailsBrowserSettings;
            SearchResultCache      = searchResultCache;
            CacheFileSystem        = cacheFileSystem;

            webBrowser = new WebBrowserEx();

            SuspendLayout();

            webBrowser.AllowWebBrowserDrop = false;
            webBrowser.Dock = DockStyle.Fill;
            webBrowser.Name = "detailsWwebBrowser";
            webBrowser.BeforeDocumentCompleted += WebBrowser_BeforeDocumentCompleted;
            webBrowser.DocumentCompleted       += WebBrowser_DocumentCompleted;

            GalleryDownloader.GalleryDownloadReportProgress += GalleryDownloader_GalleryDownloadReportProgress;
            GalleryDownloader.GalleryDownloadStarted        += GalleryDownloader_GalleryDownloadStarted;
            GalleryDownloader.GalleryDownloadCancelled      += GalleryDownloader_GalleryDownloadCancelled;
            GalleryDownloader.GalleryDownloadCompleted      += GalleryDownloader_GalleryDownloadCompleted;

            PageDownloader.PageDownloadReportProgress += PageDownloader_PageDownloadReportProgress;
            PageDownloader.PagesDownloadStarted       += PageDownloader_PagesDownloadStarted;
            PageDownloader.PagesDownloadCancelled     += PageDownloader_PagesDownloadCancelled;
            PageDownloader.PagesDownloadCompleted     += PageDownloader_PagesDownloadCompleted;

            CoverDownloader.CoverDownloadReportProgress += CoverDownloader_CoverDownloadReportProgress;
            CoverDownloader.CoversDownloadStarted       += CoverDownloader_CoversDownloadStarted;
            CoverDownloader.CoversDownloadCancelled     += CoverDownloader_CoversDownloadCancelled;
            CoverDownloader.CoversDownloadCompleted     += CoverDownloader_CoversDownloadCompleted;

            MetadataKeywordLists.WhitelistChanged  += Form_WhiteListChanged;
            MetadataKeywordLists.BlacklistChanged  += Form_BlackListChanged;
            MetadataKeywordLists.IgnorelistChanged += Form_IgnoreListChanged;
            MetadataKeywordLists.HidelistChanged   += Form_HideListChanged;

            DetailsModel.MetadataChanged += DetailsModel_MetadataChanged;

            Controls.Add(webBrowser);

            ResumeLayout(false);
        }
Пример #17
0
        /// <summary>
        /// 数量和数据
        /// </summary>
        /// <returns></returns>
        public static List <DetailsModel> Shuliang()
        {
            string              sql  = string.Format(@"select s.Like_number,o.ProjectID ,o.Project_cover ,o.Project_Name ,o.Raise_day  ,
 o.Project_Money  ,s.Financing_state ,s.Raised_amount,s.Closing_date ,s.Release_date  
 from ProjectDetails s  ,ProjectInfo  o where s.ProjectID =o.ProjectID ");
            DataTable           dt   = DBHelper.Select(sql);
            List <DetailsModel> list = new List <DetailsModel>();

            if (dt.Rows.Count > 0 && dt != null)
            {
                foreach (DataRow item in dt.Rows)
                {
                    DetailsModel DM = new DetailsModel();
                    //点赞数
                    DM.Like_number = int.Parse(item["Like_number"].ToString());
                    //封面路径
                    DM.Project_cover = item["Project_cover"].ToString();
                    //项目名称
                    DM.Project_Name = item["Project_Name"].ToString();
                    //目标筹集天数
                    DM.Raise_day = int.Parse(item["Raise_day"].ToString());
                    //预计筹集金额
                    DM.Project_Money = double.Parse(item["Project_Money"].ToString());
                    //筹集进度
                    DM.Financing_state = item["Financing_state"].ToString();
                    //已获得经资
                    DM.Raised_amount = double.Parse(item["Raised_amount"].ToString());
                    //项目ID
                    DM.ProjectID = int.Parse(item["ProjectID"].ToString());
                    //筹集百分比
                    double nu = DM.Raised_amount / DM.Project_Money * 100;
                    DM.chouji = double.Parse(nu.ToString("F2"));
                    //DM.chouji = (int)DM.Raised_amount / (int)DM.Project_Money * 100;
                    //结束日期
                    DM.Closing_date = DateTime.Parse(item["Closing_date"].ToString());
                    //DM.Release_date = DateTime.Parse(item["Release_date"].ToString());
                    //剩余天数
                    DM.shengyutime = DM.Closing_date.DayOfYear - DateTime.Now.DayOfYear;
                    if (DM.Closing_date <= DateTime.Now)
                    {
                        DM.shengyutime = 0;
                        if (DM.Project_Money == DM.Raised_amount)
                        {
                            DM.Financing_state = "已完成";
                        }
                        else
                        {
                            DM.Financing_state = "已结束";
                        }
                        DM.shuliang = dt.Rows.Count;
                    }
                    list.Add(DM);
                }
                return(list);
            }
            else
            {
                return(null);
            }
        }
Пример #18
0
        public async Task OnGetAsync_PopulatesThePageModel_WithABookmark(int bookmarkId)
        {
            // Arrange
            var optionsBuilder = new DbContextOptionsBuilder <ClippyContext>()
                                 .UseInMemoryDatabase("InMemoryDb");
            var mockContext      = new Mock <ClippyContext>(optionsBuilder.Options);
            var expectedBookmark = DatabaseInitializer.GetSeedingBookmarks().Single(b => b.Id == bookmarkId);

            mockContext.Setup(
                db => db.GetBookmarkAsync(bookmarkId)).Returns(Task.FromResult(expectedBookmark));
                var httpContext = new DefaultHttpContext();
            var     tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());
            var     pageModel   = new DetailsModel(mockContext.Object)
            {
                TempData = tempData    
            };

            // Act
            await pageModel.OnGetAsync(bookmarkId);

            // Assert
            var actualBookmark = Assert.IsAssignableFrom <Bookmark>(pageModel.Bookmark);

            Assert.Equal(expectedBookmark.Id, actualBookmark.Id);
        }
Пример #19
0
        // GET: MemberArea/Blogs/Details/5
        public ActionResult Details(int?id, DetailsModel detailsModel)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Blog blog = _uow.GetRepository <IBlogRepository>().GetById(id);

            if (blog == null)
            {
                return(HttpNotFound());
            }

            int    totalItemCount;
            string realSortProperty;

            // if not set, set base values
            detailsModel.PageNumber = detailsModel.PageNumber ?? 1;
            detailsModel.PageSize   = detailsModel.PageSize ?? 25;
            detailsModel.HeadLine   = blog.HeadLine;
            detailsModel.BlogId     = blog.BlogId;
            detailsModel.Name       = blog.Name;

            var res = _uow.GetRepository <IBlogPostRepository>().GetAllByBlogId(id.Value, detailsModel.SortProperty, detailsModel.PageNumber.Value - 1, detailsModel.PageSize.Value, out totalItemCount, out realSortProperty);

            detailsModel.SortProperty = realSortProperty;

            // https://github.com/kpi-ua/X.PagedList
            detailsModel.BlogPosts = new StaticPagedList <BlogPost>(res, detailsModel.PageNumber.Value, detailsModel.PageSize.Value, totalItemCount);

            return(View(detailsModel));
        }
Пример #20
0
        public async Task OnPostDeleteAsync_ReturnsARedirectToPageWhenUserDoesntExist(int userId)
        {
            // Arrange
            var optionsBuilder = new DbContextOptionsBuilder <ClippyContext>()
                                 .UseInMemoryDatabase("InMemoryDb");
            var mockContext = new Mock <ClippyContext>(optionsBuilder.Options);
            var mockLogger  = new Mock <ILogger <DetailsModel> >();

            mockContext.Setup(
                db => db.GetUserAsync(userId)).Returns(Task.FromResult((User)null));
                var httpContext = new DefaultHttpContext();
            var     tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());
            var     pageModel   = new DetailsModel(mockContext.Object, mockLogger.Object)
            {
                TempData = tempData    
            };

            pageModel.UnitTesting = true;

            // Act
            var result = await pageModel.OnPostDeleteAsync(userId);

            // Assert
            Assert.IsType <RedirectToPageResult>(result);
        }
Пример #21
0
 public SearchHandler(
     LibraryModel libraryModel
     , TabControlEx mainViewTabControl
     , TabPage libraryBrowserViewTabPage
     , TabPage galleryBrowserViewTabPage
     , Configuration.ConfigCache cacheSettings
     , ISearchResultCache searchResultCache
     , ILogger logger
     , BrowsingModel browsingModel
     , IPathFormatter pathFormatter
     , HttpClient httpClient
     , IQueryParser queryParser
     , GalleryModel galleryModel
     , DetailsModel detailsModel
     , GalleryDownloader galleryDownloader)
 {
     LibraryModel              = libraryModel;
     MainViewTabControl        = mainViewTabControl;
     LibraryBrowserViewTabPage = libraryBrowserViewTabPage;
     GalleryBrowserViewTabPage = galleryBrowserViewTabPage;
     CacheSettings             = cacheSettings;
     SearchResultCache         = searchResultCache;
     Logger            = logger;
     BrowsingModel     = browsingModel;
     PathFormatter     = pathFormatter;
     HttpClient        = httpClient;
     QueryParser       = queryParser;
     GalleryModel      = galleryModel;
     DetailsModel      = detailsModel;
     GalleryDownloader = galleryDownloader;
 }
        public async Task <ActionResult> ProcessInput(DetailsModel model)
        {
            string partialView;

            if (model != null)
            {
                Task <DetailsModel> task = this.detailsService.ProcessInput(model);
                this.details = await task;

                if (model.Result.ToUpper() == "ACCEPTED")
                {
                    partialView = "AcceptedPartial";
                }
                else if (model.Result.ToUpper() == "DECLINED")
                {
                    partialView = "DeclinedPartial";
                }
                else
                {
                    partialView = "NoDecisionPartial";
                }
            }
            else
            {
                partialView = "ErrorPartial";
            }

            return(this.PartialView(partialView, model));
        }
Пример #23
0
        public async Task OnGetAsync_PopulatesThePageModel_WithAUser(int userId)
        {
            // Arrange
            var optionsBuilder = new DbContextOptionsBuilder <ClippyContext>()
                                 .UseInMemoryDatabase("InMemoryDb");
            var mockContext  = new Mock <ClippyContext>(optionsBuilder.Options);
            var mockLogger   = new Mock <ILogger <DetailsModel> >();
            var expectedUser = DatabaseInitializer.GetSeedingUsers().Single(u => u.Id == userId);

            mockContext.Setup(
                db => db.GetUserAsync(userId)).Returns(Task.FromResult(expectedUser));
                var httpContext = new DefaultHttpContext();
            var     tempData    = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());
            var     pageModel   = new DetailsModel(mockContext.Object, mockLogger.Object)
            {
                TempData = tempData    
            };

            // Act
            await pageModel.OnGetAsync(userId);

            // Assert
            var actualUser = Assert.IsAssignableFrom <User>(pageModel.UserEntity);

            Assert.Equal(expectedUser.Username, actualUser.Username);
        }
Пример #24
0
        /// <summary>
        /// 加载所有产品
        /// </summary>
        internal void RefreshProduct(List <Product> products)
        {
            ProductList.Clear();

            foreach (var item in products)
            {
                ProductStateModel newProductStateModel = new ProductStateModel()
                {
                    Product = item, DetectProductIsSelected = DetectProductIsSelected, ProductChange = ProductChange, Operate = Operate
                };

                DetailsModel model = DetectProductIsSelected(newProductStateModel.Product);
                if (null != model)
                {
                    newProductStateModel.IsSelected   = true;
                    newProductStateModel.DetailsModel = model;
                }
                else
                {
                    newProductStateModel.IsSelected   = false;
                    newProductStateModel.DetailsModel = null;
                }


                ProductList.Add(newProductStateModel);
            }

            ResetPage();
        }
Пример #25
0
        public async Task <IActionResult> Details(int id)
        {
            var model = new DetailsModel(_context);
            await model.OnGetAsync(id);

            return(View(model));
        }
Пример #26
0
        public DownloadBrowserView(DetailsModel detailsModel, DocumentTemplate <Metadata> downloadTemplate, PageDownloader pageDownloader, Configuration.ConfigDetailsBrowserView downloadBrowserSettings)
        {
            InitializeComponent();

            DetailsModel            = detailsModel;
            DownloadTemplate        = downloadTemplate;
            PageDownloader          = pageDownloader;
            DownloadBrowserSettings = downloadBrowserSettings;

            webBrowser = new WebBrowserEx();

            SuspendLayout();

            webBrowser.AllowWebBrowserDrop = false;
            webBrowser.Dock = DockStyle.Fill;
            webBrowser.Name = "downloadWwebBrowser";
            webBrowser.BeforeDocumentCompleted += WebBrowser_BeforeDocumentCompleted;

            PageDownloader.PageDownloadReportProgress += PageDownloader_PageDownloadReportProgress;
            PageDownloader.PagesDownloadStarted       += PageDownloader_PagesDownloadStarted;
            PageDownloader.PagesDownloadCancelled     += PageDownloader_PagesDownloadCancelled;
            PageDownloader.PagesDownloadCompleted     += PageDownloader_PagesDownloadCompleted;

            DetailsModel.MetadataChanged += DetailsModel_MetadataChanged;

            Controls.Add(webBrowser);

            ResumeLayout(false);
        }
Пример #27
0
        /// <summary>
        /// 加载所有产品
        /// </summary>
        internal void RefreshProduct(List <Product> products)
        {
            // 产品类型全部取消选中
            foreach (var item in resultListType)
            {
                item.IsSelected = false;
            }


            ProductList.Clear();

            foreach (var item in products)
            {
                ProductStateModel newProductStateModel = new ProductStateModel()
                {
                    IsImport = IsImport, Product = item, DetectProductIsSelected = DetectProductIsSelected, ProductChange = ProductChange, Operate = Operate
                };

                DetailsModel model = DetectProductIsSelected(newProductStateModel.Product);
                if (null != model)
                {
                    newProductStateModel.IsSelected   = true;
                    newProductStateModel.DetailsModel = model;
                }
                else
                {
                    newProductStateModel.IsSelected   = false;
                    newProductStateModel.DetailsModel = null;
                }


                ProductList.Add(newProductStateModel);
            }
        }
Пример #28
0
        /// <summary>
        /// 产品修改
        /// </summary>
        /// <param name="IsSelected"></param>
        /// <param name="productId"></param>
        private DetailsModel ProductChange(bool IsSelected, long productId, double count)
        {
            DetailsModel model   = null;
            Product      product = Resources.GetRes().Products.Where(x => x.ProductId == productId).FirstOrDefault();

            if (!IsSelected)
            {
                Selected.CurrentSelectedList.Remove(Selected.CurrentSelectedList.Where(x => x.IsNew && x.Product == product).FirstOrDefault());
            }
            else
            {
                model = new DetailsModel()
                {
                    _element = _lbSelectedList, IsNew = true, AddTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"), Product = product, OrderDetail = new OrderDetail()
                    {
                        OrderDetailId = -1, ProductId = product.ProductId, Count = count, AddTime = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")), Price = product.Price, State = 0, TotalPrice = product.Price
                    }, Operate = OperateDetails
                };
                Selected.CurrentSelectedList.Insert(0, model);
            }

            RefreshState();

            return(model);
        }
Пример #29
0
        public async Task <ActionResult> Details(int id)
        {
            if (id == 0)
            {
                return(null);
            }
            BookStatusViewModel bvm = new BookStatusViewModel();
            var book = await _db.Books.Where(a => a.ID == id).SingleOrDefaultAsync();

            var loanStatus = await _loanservice.GetBookLoanStatus(id);

            if (book != null)
            {
                bvm.ID            = book.ID;
                bvm.Title         = book.Title;
                bvm.Author        = book.Author;
                bvm.Genre         = book.Genre;
                bvm.Location      = book.Location;
                bvm.YearPublished = book.YearPublished;
                bvm.Edition       = book.Edition;
                bvm.Genre         = book.Genre;
                bvm.DateCreated   = book.DateCreated;
                bvm.DateUpdated   = book.DateUpdated;

                bvm.Status     = loanStatus.Status.ToString().ToUpper();
                bvm.DateLoaned = loanStatus.DateLoaned;
                bvm.DateReturn = loanStatus.DateReturn;
            }
            BookLoan.Views.Book.DetailsModel detailsModel = new DetailsModel(_db);
            loanStatus.Status                = loanStatus.Status.ToUpper();
            detailsModel.BookViewModel       = bvm;
            detailsModel.BookStatusViewModel = loanStatus;

            return(View(detailsModel));
        }
Пример #30
0
        public virtual ActionResult GetTorrent(string hash)
        {
            var torrent = CurrentSession.Client.Torrents[hash];

            if (torrent == null)
            {
                return(JsonContract(new TorrentResult {
                    Ok = false, ErrorMessage = "Hittade ingen torrent med hash " + hash
                }));
            }

            var detailsModel = new DetailsModel(torrent);

            if (detailsModel.Files != null)
            {
                detailsModel.Files.Sort(new Comparison <UTorrentAPI.File>((f1, f2) =>
                {
                    double r1 = f1.DownloadedBytes / f1.SizeInBytes;
                    double r2 = f2.DownloadedBytes / f2.SizeInBytes;

                    if (r1 == r2 && f1.Path != null && f2.Path != null)
                    {
                        return(f1.Path.CompareTo(f2.Path));
                    }

                    return(r1.CompareTo(r2));
                }));
            }

            return(Json(detailsModel));
        }
Пример #31
0
 public DetailsWindow(Canvas canvas, Level level)
 {
     InitializeComponent();
     DataContext = new DetailsModel(level, canvas);
     mWidth = canvas.Width;
     mHeight = canvas.Height;
     mGravity = level.Gravity;
     mName = level.Name;
 }
Пример #32
0
		public ActionResult Details(DetailsModel model)
        {
			return View(model);
        }
Пример #33
0
 public ActionResult Details()
 {
     var model = new DetailsModel();
     return View(model);
 }