コード例 #1
0
 /// <summary>
 /// Open then Drawer
 /// </summary>
 /// <param name="OpenDrawer"></param>
 private void OpenDrawer(PublisherApiModel publisherModel)
 {
     IsOpen    = true;
     Publisher = new PublisherInfo {
         PublisherModel = publisherModel
     };
 }
コード例 #2
0
ファイル: AddBook.aspx.cs プロジェクト: wwwLu/Lu-winner
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            //图书图片是否上传
            bool fileOK = false;
            //定义上传图书图片路径
            string BookPath = Server.MapPath("~/Images/");
            //实例化图书/出版社实体类
            BookInfo      book       = new BookInfo();
            PublisherInfo Publishers = new PublisherInfo();

            //是否已经上传图书(HasFile  布尔类型 获取一个布尔值,用于表示FileUpload控件是否已经包含一个文件)
            if (FileUpload1.HasFile)
            {
                string   fileExtension     = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                string[] AllowedExtensions = { ".gif", ".png", ".bmp", ".jpg" };
                for (int i = 0; i < AllowedExtensions.Length; i++)
                {
                    if (fileExtension == AllowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }
            if (fileOK)
            {
                try
                {
                    FileUpload1.SaveAs(BookPath + FileUpload1.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("图片上传不成功!");
                }
            }
            else
            {
                MessageBox.Show("只能够上传图片文件!");
            }

            book.Title              = txtTitle.Text;
            book.Author             = txtAuthor.Text;
            book.Category           = PbId.Text;
            book.Publisher          = PublisherName.Text;
            book.ISBN               = TxtISBN.Text;
            book.PublishDate        = DateTime.Parse(TxtTime.Text);
            book.UnitPrice          = Convert.ToInt32(TxtUnitPrice.Text);
            book.WordsCount         = Convert.ToInt32(TxtWordsCount.Text);
            book.ContentDescription = TxtContentDescription.Text;
            book.ImgUrl             = BookPath.ToString();

            BookManager.AddBook(book);
        }
コード例 #3
0
 /// <summary>
 /// Update publisher
 /// </summary>
 /// <param name="discoverer"></param>
 /// <param name="config"></param>
 /// <returns></returns>
 public async Task <string> UpdatePublisherAsync(PublisherInfo publisher)
 {
     try {
         await _registryService.UpdatePublisherAsync(publisher.PublisherModel.Id, new PublisherUpdateApiModel {
             Configuration = publisher.PublisherModel.Configuration
         });
     }
     catch (UnauthorizedAccessException) {
         return("Unauthorized access: Bad User Access Denied.");
     }
     catch (Exception exception) {
         _logger.Error(exception, "Failed to update publisher");
         var errorMessageTrace = string.Concat(exception.Message,
                                               exception.InnerException?.Message ?? "--", exception?.StackTrace ?? "--");
         return(errorMessageTrace);
     }
     return(null);
 }
コード例 #4
0
ファイル: CategoryService.cs プロジェクト: wwwLu/Lu-winner
        public static List <PublisherInfo> GetPublishers()
        {
            List <PublisherInfo> list = new List <PublisherInfo>();
            string strConn            = ConfigurationManager.ConnectionStrings["BookshopConnectionString"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                string         strsql = "select top 15 Id,Name from Publishers order by Name desc";
                DataSet        da     = new DataSet();
                SqlDataAdapter sa     = new SqlDataAdapter(strsql, conn);
                sa.Fill(da);
                foreach (DataRow row in da.Tables[0].Rows)
                {
                    PublisherInfo publisherInfo = new PublisherInfo();
                    publisherInfo.Id   = Convert.ToInt32(row["Id"]);
                    publisherInfo.Name = row["Name"].ToString();

                    list.Add(publisherInfo);
                }
                return(list);
            }
        }
コード例 #5
0
        protected override void Seed(BooksLibraryContext context)
        {
            base.Seed(context);

            AuthorIndentity authorIndentity = new AuthorIndentity()
            {
                Login = "******", Password = "******"
            };

            AuthorInfo author = new AuthorInfo()
            {
                AuthorIndentity = authorIndentity,
                LastName        = "Richter",
            };

            PublisherInfo publisher = new PublisherInfo()
            {
                Name = "Grn LLC"
            };

            BookInfo book = new BookInfo()
            {
                Title         = "CLR via C#",
                Date          = new DateTime(2018, 10, 10),
                Price         = 5000,
                PublisherInfo = publisher
            };

            book.Authors = new List <AuthorInfo>()
            {
                author
            };

            context.Books.Add(book);
            context.SaveChanges();
        }
        public static PSSecurityAdaptiveApplicationControlsPublisherInfo ConvertToPSType(this PublisherInfo value)
        {
            if (value != null)
            {
                return(new PSSecurityAdaptiveApplicationControlsPublisherInfo()
                {
                    PublisherName = value.PublisherName,
                    ProductName = value.ProductName,
                    BinaryName = value.BinaryName,
                    Version = value.Version
                });
            }

            return(null);
        }
コード例 #7
0
ファイル: UserLoginEventArgs.cs プロジェクト: q2een/InvEx
 public UserLoginEventArgs(PublisherInfo publisherData, string login, string password)
 {
     PublisherData = publisherData;
     Login         = login;
     Password      = password;
 }