Example #1
0
        public FrmEditItem(string id, FrmInventory frmInventory)
        {
            InitializeComponent();
            this.id           = id;
            this.frmInventory = frmInventory;

            collection = MainForm.database.GetCollection <BsonDocument>("inventory");
            filter     = Builders <BsonDocument> .Filter.Eq("_id", ObjectId.Parse(id));

            var result = collection.Find(filter).First();

            txtItem.Text     = result["item"].ToString();
            txtQuantity.Text = result["quantity"].ToString();
        }
Example #2
0
        public FrmQuantity(string id, FrmInventory frmInventory, Operation operation)
        {
            InitializeComponent();
            this.frmInventory = frmInventory;
            this.id           = id;
            this.operation    = operation;
            collection        = MainForm.database.GetCollection <BsonDocument>("inventory");
            filter            = Builders <BsonDocument> .Filter.Eq("_id", ObjectId.Parse(id));

            result = collection.Find(filter).First();

            txtItem.Text     = result["item"].ToString();
            txtQuantity.Text = "0";
            txtQuantity.Focus();
            txtQuantity.SelectionStart  = 0;
            txtQuantity.SelectionLength = 1;
            if (operation.Equals(Operation.SUBTRACT))
            {
                btnUpdate.Text = "Subtract";
            }
        }