Example #1
0
 public Form_Item(BookInformation reff, BookEvaluaion value, int uid, string name, bool isNew = true)
 {
     InitializeComponent();
     ucl = name;
     __BookID = reff.BookID;
     __UserID = uid;
     __EvalID = Cipher.ModPositive(Guid.NewGuid().GetHashCode(), __MOD__);
     book = reff;
     isNewComer = isNew;
     if (isNewComer) 
         rank = new BookEvaluaion(__EvalID, __BookID, __UserID, new _Evaluaion());
     else rank = value;
     OnDisplay();
 }
Example #2
0
 public Form_Item(BookInformation reff, BookEvaluaion value, int uid, string name, bool isNew = true)
 {
     InitializeComponent();
     ucl        = name;
     __BookID   = reff.BookID;
     __UserID   = uid;
     __EvalID   = Cipher.ModPositive(Guid.NewGuid().GetHashCode(), __MOD__);
     book       = reff;
     isNewComer = isNew;
     if (isNewComer)
     {
         rank = new BookEvaluaion(__EvalID, __BookID, __UserID, new _Evaluaion());
     }
     else
     {
         rank = value;
     }
     OnDisplay();
 }
Example #3
0
        private void tSMI_Sendto_Click(object sender, EventArgs e)
        {
            BookEvaluaionList data = new BookEvaluaionList();

            for (int i = 0, sz = listView_Books.SelectedItems.Count; i < sz; i++)
            {
                string        id  = listView_Books.SelectedItems[i].SubItems[0].Text;
                BookEvaluaion tmp = new BookEvaluaion();
                BookEval.tryFind(int.Parse(id), out tmp);
                data.Add(tmp);
            }
            byte[] raw;
            ToBytes <BookEvaluaionList> .GetBytes(ref data, out raw);

            TcpClientP home = new TcpClientP();

            home.Connect(new IPEndPoint(serverIP, Port.TCP_BOOK_EVALUATION_PORT));
            home.Write(raw);
            home.Close();
            MessageBox.Show("发送成功", "提示", MessageBoxButtons.OK);
        }
Example #4
0
        private void BuildFinalList()
        {
            BookCosting costing = Cost;

            FinalList = new List <BookFinal>();
            foreach (var value in BookEval.Data)
            {
                BookEvaluaion rank = value;
                rank.Value.SetPrintingCount();
                int bid = rank.BookID, uid = rank.UserID;
                FindPerson(uid);
                BookDetail info;
                FindBookInfo(bid, out info);
                BookFinal item = new BookFinal(info, rank);
                FinalList.Add(item);
            }
            foreach (var item in FinalList)
            {
                item.getFinalValue(ref costing);
            }
        }
Example #5
0
        private void listViewBooks_DoubleClick(object sender, EventArgs e)
        {
            int             lineNumber = this.listView_Books.SelectedIndices[0];
            var             line       = this.listView_Books.Items[lineNumber];
            string          bid        = line.SubItems[0].Text;
            int             id         = int.Parse(bid);
            BookInformation book;

            if (!BookList.tryFind(id, out book))
            {
                return;
            }
            BookEvaluaion rank;
            bool          isNewComer = !BookEval.tryFind(id, out rank);
            Form_Item     item       = new Form_Item(book, rank, idNumeric, ucl, isNewComer);

            item.ReturnBook += (o, e1) =>
            {
                if (!e1.CanUpdate)
                {
                    return;
                }
                BookInformation info  = e1.Book;
                BookEvaluaion   value = e1.Rank;
                if (isNewComer)
                {
                    BookEval.Add(value);
                }
                else
                {
                    BookEval.ReplaceTo(id, value);
                }
                RefreshBookList(ref info, ref line);
            };
            item.ShowDialog();
        }
Example #6
0
 private void tSMI_Sendto_Click(object sender, EventArgs e)
 {
     BookEvaluaionList data = new BookEvaluaionList();
     for (int i = 0, sz = listView_Books.SelectedItems.Count; i < sz; i++)
     {
         string id = listView_Books.SelectedItems[i].SubItems[0].Text;
         BookEvaluaion tmp = new BookEvaluaion();
         BookEval.tryFind(int.Parse(id), out tmp);
         data.Add(tmp);
     }
     byte[] raw;
     ToBytes<BookEvaluaionList>.GetBytes(ref data, out raw);
     TcpClientP home = new TcpClientP();
     home.Connect(new IPEndPoint(serverIP, Port.TCP_BOOK_EVALUATION_PORT));
     home.Write(raw);
     home.Close();
     MessageBox.Show("发送成功", "提示", MessageBoxButtons.OK);
 }
Example #7
0
 /// <summary>
 /// 标准构造函数
 /// </summary>
 /// <param name="info">教材属性</param>
 /// <param name="value">教材评价</param>
 public BookFinal(BookDetail info, BookEvaluaion value)
 {
     MainInfo = info;
     MainValue = value;
 }