Exemplo n.º 1
0
 public DataRow InitCopyRow(DictionaryDataSet.InventoryItemDataTable table, DictionaryDataSet.InventoryItemRow row)
 {
     DictionaryDataSet.InventoryItemRow drNewRow = table.NewInventoryItemRow();
     drNewRow.InventoryItemID   = Guid.NewGuid();
     drNewRow.InventoryItemCode = row.InventoryItemCode;
     drNewRow.InventoryItemName = row.InventoryItemName;
     drNewRow.InventoryItemType = row.InventoryItemType;
     if (row.IsInventoryItemCategoryIDNull())
     {
         drNewRow.SetInventoryItemCategoryIDNull();
     }
     else
     {
         drNewRow.InventoryItemCategoryID = row.InventoryItemCategoryID;
     }
     if (row.IsUnitIDNull())
     {
         drNewRow.SetUnitIDNull();
     }
     else
     {
         drNewRow.UnitID = row.UnitID;
     }
     drNewRow.Description = row.Description;
     if (row.IsFileResourceNull())
     {
         drNewRow.SetFileResourceNull();
     }
     else
     {
         drNewRow.FileResource = row.FileResource;
     }
     drNewRow.CourseType   = row.CourseType;
     drNewRow.UnitPrice    = row.IsUnitPriceNull() ? 0 : row.UnitPrice;
     drNewRow.Inactive     = row.Inactive;
     drNewRow.CreatedDate  = DateTime.Now;
     drNewRow.ModifiedDate = DateTime.Now;
     drNewRow.CreatedBy    = Session.UserLogin.DisplayName;
     drNewRow.ModifiedBy   = Session.UserLogin.DisplayName;
     drNewRow.OldIDs       = row.OldIDs;
     table.Rows.InsertAt(drNewRow, 0);
     return(drNewRow);
 }
Exemplo n.º 2
0
        protected override void BindingData()
        {
            base.BindingData();
            txtInventoryItemCode.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.InventoryItemCodeColumn.ColumnName, true));
            txtInventoryItemName.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.InventoryItemNameColumn.ColumnName, true));
            cboInventoryItemCategory.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.InventoryItemCategoryIDColumn.ColumnName, true));
            cboUnit.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.UnitIDColumn.ColumnName, true));
            cboInventoryItemType.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.InventoryItemTypeColumn.ColumnName, true));
            cboCourseType.DataBindings.Add(new Binding("Value", BsDetail, DsDictionary.InventoryItem.CourseTypeColumn.ColumnName, true));
            txtUnitPrice.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.UnitPriceColumn.ColumnName, true));
            txtDescription.DataBindings.Add(new Binding("Text", BsDetail, DsDictionary.InventoryItem.DescriptionColumn.ColumnName, true));
            imgFileResource.DataBindings.Add(new Binding("Image", BsDetail, DsDictionary.InventoryItem.FileResourceColumn.ColumnName, true));

            DictionaryDataSet.InventoryItemRow dr = (DictionaryDataSet.InventoryItemRow)CurrentRow;
            if (dr != null && !dr.IsFileResourceNull())
            {
                MemoryStream mem = new MemoryStream(dr.FileResource);
                imgFileResource.Image = Image.FromStream(mem);
            }
        }