123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using EMIS.Entities;
- using EMIS.ViewModel.CacheManage;
- namespace EMIS.ViewModel.TeachingMaterial
- {
- [Serializable]
- public class TeachingMaterialPoolView
- {
- /// <summary>
- /// 教材ID
- /// </summary>
- [DisplayName("教材ID")]
- public Guid TeachingMaterialPoolID { get; set; }
- /// <summary>
- /// 教材编号
- /// </summary>
- /// [Required]
- [DisplayName("教材编号")]
- [Required]
- public string TeachingMaterialCode { get; set; }
- /// <summary>
- /// 教材名称
- /// </summary>
- [DisplayName("教材名称")]
- [Required]
- public string TeachingMaterialName { get; set; }
- /// <summary>
- /// 教材名称
- /// </summary>
- [DisplayName("教材简称")]
- //[Required]
- public string TeachingMaterialShorName { get; set; }
- /// <summary>
- /// 课程ID
- /// </summary>
- [DisplayName("课程")]
- //[Required]
- public HashSet<EM_Coursematerial> CoursematerialEntityList { get; set; }
- /// <summary>
- /// 课程名称
- /// </summary>
- [DisplayName("课程名称")]
- //[Required]
- public string CoursematerialName
- {
- get
- {
- return string.Join(",", CoursematerialEntityList.Select(x => x.CourseName));
- }
- }
- /// <summary>
- /// 课程代码
- /// </summary>
- [DisplayName("课程代码")]
- //[Required]
- public string CoursematerialCode
- {
- get
- {
- return string.Join(",", CoursematerialEntityList.Select(x => x.CourseCode));
- }
- }
- /// <summary>
- /// ISBN
- /// </summary>
- [DisplayName("ISBN")]
- [Required]
- public string ISBN { get; set; }
- private string isbnPre1Field;
- [Required]
- [DisplayName("国家编号")]
- [StringLength(3, MinimumLength = 3, ErrorMessage = "请输入3位国家编号")]
- public string ISBNPre1
- {
- get
- {
- var trimISBN = (ISBN ?? "").Trim().Replace("-", "");
- if (trimISBN.Length >= 3)
- {
- return trimISBN.Substring(0, 3);
- }
- else if (trimISBN.Length > 0)
- {
- return trimISBN;
- }
- else
- {
- return "978";
- }
- }
- set
- {
- isbnPre1Field = value;
- ISBN = isbnPre1Field + "-" + isbnPre2Field + "-" + isbnPre3Field + "-" + isbnPre4Field + "-" + isbnPre5Field;
- }
- }
- private string isbnPre2Field;
- [Required]
- [DisplayName("国代号")]
- [StringLength(1, MinimumLength = 1, ErrorMessage = "请输入1位国代号")]
- public string ISBNPre2
- {
- get
- {
- var trimISBN = (ISBN ?? "").Trim().Replace("-", "");
- if (trimISBN.Length >= 4)
- {
- return trimISBN.Substring(3, 1);
- }
- else
- {
- return "7";
- }
- }
- set
- {
- isbnPre2Field = value;
- ISBN = isbnPre1Field + "-" + isbnPre2Field + "-" + isbnPre3Field + "-" + isbnPre4Field + "-" + isbnPre5Field;
- }
- }
- private string isbnPre3Field;
- [Required]
- [DisplayName("出版社代号")]
- [StringLength(6, MinimumLength = 2, ErrorMessage = "请输入2-6位出版社代号")]
- [TotalLength(8, "ISBNPre4", ErrorMessage = "出版社代号和出版序号加起来应该有8位")]
- public string ISBNPre3
- {
- get
- {
- var isbnGroup = ISBN.Split('-');
- var subString = "";
- if (isbnGroup.Length >= 3 && isbnGroup[2].Length >= 2 && isbnGroup[2].Length <= 6)
- {
- return isbnGroup[2];
- }
- if (isbnGroup.Length >= 3)
- {
- subString = isbnGroup[2];
- }
- else
- {
- var trimISBN = (ISBN ?? "").Trim().Replace("-", "");
- if (trimISBN.Length > 4)
- {
- subString = trimISBN.Substring(4);
- }
- else
- {
- subString = "";
- }
- }
- if (subString.Length >= 6)
- {
- return subString.Substring(0, 6);
- }
- else
- {
- return subString;
- }
- }
- set
- {
- isbnPre3Field = value;
- ISBN = isbnPre1Field + "-" + isbnPre2Field + "-" + isbnPre3Field + "-" + isbnPre4Field + "-" + isbnPre5Field;
- }
- }
- private string isbnPre4Field;
- [Required]
- [DisplayName("出版序号")]
- [StringLength(6, MinimumLength = 2, ErrorMessage = "请输入2-6位出版序号")]
- [TotalLength(8, "ISBNPre3", ErrorMessage = "出版社代号和出版序号加起来应该有8位")]
- public string ISBNPre4
- {
- get
- {
- var isbnGroup = ISBN.Split('-');
- var subString = "";
- if (isbnGroup.Length >= 4 && isbnGroup[3].Length >= 2 && isbnGroup[3].Length <= 6)
- {
- return isbnGroup[3];
- }
- if (isbnGroup.Length >= 4)
- {
- subString = isbnGroup[3];
- }
- else
- {
- var trimISBN = (ISBN ?? "").Trim().Replace("-", "");
- var pre3Length = this.ISBNPre3.Length;
- if (trimISBN.Length > (4 + pre3Length))
- {
- subString = trimISBN.Substring(4 + pre3Length);
- }
- else
- {
- subString = "";
- }
- }
- return subString;
- }
- set
- {
- isbnPre4Field = value;
- ISBN = isbnPre1Field + "-" + isbnPre2Field + "-" + isbnPre3Field + "-" + isbnPre4Field + "-" + isbnPre5Field;
- }
- }
- private string isbnPre5Field;
- [Required]
- [DisplayName("校验位")]
- [StringLength(1, MinimumLength = 1, ErrorMessage = "请输入1位校验位")]
- public string ISBNPre5
- {
- get
- {
- var isbnGroup = ISBN.Split('-');
- if (isbnGroup.Length >= 5)
- {
- return isbnGroup[4];
- }
- else
- {
- return "";
- }
- }
- set
- {
- isbnPre5Field = value;
- ISBN = isbnPre1Field + "-" + isbnPre2Field + "-" + isbnPre3Field + "-" + isbnPre4Field + "-" + isbnPre5Field;
- }
- }
- /// <summary>
- ///教材类型
- /// </summary>
- [DisplayName("教材类型")]
- [Required]
- public int? TeachingMaterialTypeID { get; set; }
- /// <summary>
- ///教材类型
- /// </summary>
- [DisplayName("教材类型")]
- public string TeachingMaterialTypeName
- {
- get
- {
- return IdNameExt.GetDictionaryItem(DictionaryItem.CF_TeachingMaterialType.ToString())
- .Where(x => x.Value == TeachingMaterialTypeID)
- .Select(x => x.Name).FirstOrDefault();
- }
- }
- /// <summary>
- /// 获奖级别
- /// </summary>
- [DisplayName("获奖级别")]
- public int? WnningLevel { get; set; }
- /// <summary>
- /// 获奖级别
- /// </summary>
- [DisplayName("获奖级别")]
- public string WnningLevelName { get; set; }
- /// <summary>
- /// 版本时间
- /// </summary>
- [DisplayName("版本时间")]
- //[Required]
- public string PublishTime { get; set; }
- /// <summary>
- /// 出版单位ID
- /// </summary>
- [DisplayName("出版单位ID")]
- [Required]
- public Guid? PublishID { get; set; }
- /// <summary>
- /// 出版单位
- /// </summary>
- [DisplayName("出版单位")]
- [Required]
- public string PublishName { get; set; }
- /// <summary>
- /// 作者
- /// </summary>
- [DisplayName("作者")]
- [Required]
- public string Author { get; set; }
- /// <summary>
- /// 单价
- /// </summary>
- [DisplayName("单价")]
- [Required]
- [RegularExpression(@"^\d+(\.\d{1,2})?$", ErrorMessage = "必须填写有效的价格")]
- public decimal? Price { get; set; }
- /// <summary>
- /// 折合价
- /// </summary>
- [DisplayName("折合价")]
- public decimal? DiscountPrice { get; set; }
- /// <summary>
- /// 是否过期
- /// </summary>
- [DisplayName("是否过期")]
- [Required]
- public bool IsLate { get; set; }
- /// <summary>
- /// 是否过期
- /// </summary>
- public string IsLateName { get; set; }
- /// <summary>
- /// 备注
- /// </summary>
- [DisplayName("备注")]
- public string Desc { get; set; }
- /// <summary>
- /// 错误信息
- /// </summary>
- [DisplayName("错误信息")]
- public string ErrorMessage { get; set; }
- /// <summary>
- /// 创建时间
- /// </summary>
- [DisplayName("创建时间")]
- public DateTime? CreateTime { get; set; }
- /// <summary>
- /// 创建人
- /// </summary>
- [DisplayName("创建人")]
- public string CreateUserName { get; set; }
- /// <summary>
- /// 修改时间
- /// </summary>
- [DisplayName("修改时间")]
- public DateTime? ModifyTime { get; set; }
- /// <summary>
- /// 修改人
- /// </summary>
- [DisplayName("修改人")]
- public string ModifyUserName { get; set; }
- /// <summary>
- /// 征订数量(用于教师征订)
- /// </summary>
- [DisplayName("征订数量")]
- public int? OrderQty { get; set; }
- /// <summary>
- /// 课程级别(用于学生征订)
- /// </summary>
- [DisplayName("课程级别")]
- public string CourseLevelName { get; set; }
- /// <summary>
- /// 课程科类(用于学生征订)
- /// </summary>
- [DisplayName("课程科类")]
- public string CourseScienceName { get; set; }
- /// <summary>
- /// 折扣率
- /// </summary>
- [DisplayName("折扣率")]
- public decimal? Discount { get; set; }
-
- /// <summary>
- /// 最小库存量
- /// </summary>
- [DisplayName("最小库存量")]
- [Required]
- [RegularExpression(@"^[1-9]\d*$", ErrorMessage = "必须填写正整数")]
- public int? MinInventory { get; set; }
- /// <summary>
- /// 当前库存量
- /// </summary>
- [DisplayName("当前库存量")]
- public int? PresentInventory { get; set; }
- /// <summary>
- /// 总价
- /// </summary>
- [DisplayName("总价")]
- public decimal? ZongJia { get; set; }
- /// <summary>
- /// 码洋
- /// </summary>
- [DisplayName("码洋")]
- public decimal? MaYang { get; set; }
- private bool _isExcelVaildateOK = true;
- /// <summary>
- /// Excel验证是否通过,默认为true
- /// <para>true:通过;false:不通过</para>
- /// </summary>
- public bool IsExcelVaildateOK
- {
- get { return _isExcelVaildateOK; }
- set { _isExcelVaildateOK = value; }
- }
- }
- }
|