Exemplo n.º 1
0
        protected override object GetItemFromInput()
        {
            StackInSheet sheet = UpdatingItem as StackInSheet;

            if (sheet == null)
            {
                sheet = new StackInSheet();
                if (txtSheetNo.Text == "自动创建")
                {
                    sheet.ID = string.Empty;
                }
                sheet.ClassID = StackInSheetType.InventorySheet;
            }
            else
            {
                sheet.ID = this.txtSheetNo.Text;
            }
            sheet.SupplierID  = Supplier != null ? Supplier.ID : null;
            sheet.WareHouseID = WareHouse != null ? WareHouse.ID : null;
            sheet.SheetDate   = dtSheetDate.Value;
            sheet.Memo        = txtMemo.Text;
            sheet.Items       = new List <StackInItem>();
            foreach (DataGridViewRow row in ItemsGrid.Rows)
            {
                if (row.Tag != null)
                {
                    StackInItem item = row.Tag as StackInItem;
                    item.SheetNo = sheet.ID;
                    sheet.Items.Add(item);
                }
            }
            return(sheet);
        }
        protected override void ShowItemInGridViewRow(DataGridViewRow row, object item)
        {
            StackInSheet sheet = item as StackInSheet;

            row.Cells["colSheetNo"].Value = sheet.ID;
            row.Cells["colClass"].Value   = sheet.DocumentType;
            CompanyInfo supplier = supplierTree1.GetSupplier(sheet.SupplierID);

            row.Cells["colSupplier"].Value = supplier != null ? supplier.Name : string.Empty;
            WareHouse ws = (_Warehouses != null && _Warehouses.Count > 0) ? _Warehouses.SingleOrDefault(it => it.ID == sheet.WareHouseID) : null;

            row.Cells["colWareHouse"].Value     = ws != null ? ws.Name : string.Empty;
            row.Cells["colState"].Value         = SheetStateDescription.GetDescription(sheet.State);
            row.Cells["colInventoryDate"].Value = sheet.State == SheetState.Inventory ? sheet.LastActiveDate.ToString("yyyy-MM-dd") : null;
            //row.Cells["colAmount"].Value = sheet.Amount.Trim();
            row.Cells["colMemo"].Value = sheet.Memo;
            if (sheet.State == SheetState.Canceled)
            {
                row.DefaultCellStyle.ForeColor = Color.Red;
                row.DefaultCellStyle.Font      = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            }
            if (!_Sheets.Exists(it => it.ID == sheet.ID))
            {
                _Sheets.Add(sheet);
            }
        }
Exemplo n.º 3
0
        private void mnu_AttachmentAdd_Click(object sender, EventArgs e)
        {
            StackInSheet item = UpdatingItem as StackInSheet;

            if (item != null)
            {
                PerformAddAttach(item.ID, item.DocumentType, gridAttachment);
            }
        }
Exemplo n.º 4
0
        protected override void ItemShowing()
        {
            StackInSheet item = UpdatingItem as StackInSheet;

            if (item != null)
            {
                this.txtSheetNo.Text    = item.ID;
                this.txtSheetNo.Enabled = false;
                Supplier = (new CompanyBLL(AppSettings.Current.ConnStr)).GetByID(item.SupplierID).QueryObject;
                this.txtSupplier.Text  = Supplier != null ? Supplier.Name : string.Empty;
                WareHouse              = (new WareHouseBLL(AppSettings.Current.ConnStr)).GetByID(item.WareHouseID).QueryObject;
                this.txtWareHouse.Text = WareHouse != null ? WareHouse.Name : string.Empty;
                dtSheetDate.Value      = item.SheetDate;
                this.txtMemo.Text      = item.Memo;
                ShowSheetItemsOnGrid(item.Items);
                ShowOperations(item.ID, item.DocumentType, dataGridView1);
                ShowAttachmentHeaders(item.ID, item.DocumentType, this.gridAttachment);
            }
        }