コード例 #1
0
 private void inventoryGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) //when item is pressed in inventory table, open item information
 {
     if (e.ColumnIndex == 13 || e.ColumnIndex == 0)
     {
         int indexRow = e.RowIndex;
         if (indexRow >= 0)
         {
             DataGridViewRow row  = this.inventoryGridView.Rows[e.RowIndex];
             var             item = new currentItem();
             item.ResourceType   = row.Cells["ResourceType"].Value.ToString();
             item.ResourceName   = row.Cells["ResourceName"].Value.ToString();
             item.MaxLoanPeriod  = (int)row.Cells["MaxLoanPeriod"].Value;
             item.Department     = row.Cells["Department"].Value.ToString();
             item.SerialNumber   = (long)row.Cells["SerialNumber"].Value;
             item.DateAdded      = row.Cells["DateAdded"].Value.ToString();
             item.SupplierSource = row.Cells["SupplierSource"].Value.ToString();
             item.PurchasePrice  = (decimal)row.Cells["PurchasePrice"].Value;
             item.Notes          = row.Cells["Notes"].Value.ToString();
             item.ItemID         = (int)row.Cells["ResourceID"].Value;
             item.AddedBy        = row.Cells["AddedBy"].Value.ToString();
             viewItem viewInfo = new viewItem(item.ResourceType, item.ResourceName, item.MaxLoanPeriod,
                                              item.Department, item.SerialNumber, item.DateAdded, item.SupplierSource,
                                              item.PurchasePrice, item.Notes, item.ItemID, item.AddedBy);
             viewInfo.Show();
         }
     }
 }
コード例 #2
0
 private void btnConfirmItems_Click(object sender, EventArgs e)
 {
     checkIfUserHasLoan();
     foreach (DataGridViewRow row in pickedItemsGridView.Rows)
     {   //string maxprd = row.Cells["MaxLoanPeriod"].Value.ToString();
         int maxprd       = 0;
         int resourceid   = 0;
         int quantity     = 0;
         int serialnumber = 0;
         Int32.TryParse(row.Cells["MaxLoanPeriod"].Value.ToString(), out maxprd);
         Int32.TryParse(row.Cells["ResourceID"].Value.ToString(), out resourceid);
         Int32.TryParse(row.Cells["Quantity"].Value.ToString(), out quantity);
         Int32.TryParse(row.Cells["SerialNumber"].Value.ToString(), out serialnumber);
         //MessageBox.Show(maxprd);
         var borrower = new currentBorrower();
         borrower.FirstName    = txtCurrentName.Text;
         borrower.Surname      = txtCurrentSurname.Text;
         borrower.ShuId        = txtCurrentId.Text;
         borrower.EmailAddress = txtCurrentEmail.Text;
         borrower.ScannableNum = txtScanID.Text;
         borrower.UserType     = txtUserType.Text;
         var item = new currentItem();
         item.ResourceType  = row.Cells["ResourceType"].Value.ToString();
         item.ResourceName  = row.Cells["ResourceName"].Value.ToString();
         item.MaxLoanPeriod = maxprd;
         item.Department    = row.Cells["Department"].Value.ToString();
         item.Quantity      = quantity;
         item.SerialNumber  = serialnumber;
         //item.SerialNumber = (long)row.Cells["SerialNumber"].Value;
         //item.DateAdded = row.Cells["DateAdded"].Value.ToString();
         //item.SupplierSource = row.Cells["SupplierSource"].Value.ToString();
         //item.PurchasePrice = (decimal)row.Cells["PurchasePrice"].Value;
         //item.Notes = row.Cells["Notes"].Value.ToString();
         item.ItemID = resourceid;
         LoanDurations loanInfo = new LoanDurations(item.ResourceType, item.ResourceName, item.MaxLoanPeriod,
                                                    item.Quantity, item.Department, item.ItemID, borrower.FirstName, borrower.Surname,
                                                    borrower.ShuId, borrower.EmailAddress, borrower.ScannableNum, borrower.UserType, item.SerialNumber);
         loanInfo.Show();
     }
     this.Close();
 }
コード例 #3
0
ファイル: disposeItem.cs プロジェクト: yoyoProjectGit/Project
 private void btnConfirmItems_Click(object sender, EventArgs e) //for each item chosen, creates a new item and sends to disposeselecteditem form
 {
     foreach (DataGridViewRow row in pickedItemsGridView.Rows)
     {   //string maxprd = row.Cells["MaxLoanPeriod"].Value.ToString();
         int maxprd     = 0;
         int resourceid = 0;
         int quantity   = 0;
         int total      = 0;
         Int32.TryParse(row.Cells["MaxLoanPeriod"].Value.ToString(), out maxprd);
         Int32.TryParse(row.Cells["ResourceID"].Value.ToString(), out resourceid);
         Int32.TryParse(row.Cells["InStock"].Value.ToString(), out quantity);
         Int32.TryParse(row.Cells["Total"].Value.ToString(), out total);
         long    SerialNo         = Convert.ToInt64(row.Cells["SerialNumber"].Value.ToString());
         long    PurchasePrice    = Convert.ToInt64(row.Cells["PurchasePrice"].Value.ToString());
         decimal decPurchasePrice = Convert.ToDecimal(PurchasePrice);
         //MessageBox.Show(maxprd);
         var item = new currentItem();
         item.ResourceType   = row.Cells["ResourceType"].Value.ToString();
         item.ResourceName   = row.Cells["ResourceName"].Value.ToString();
         item.MaxLoanPeriod  = maxprd;
         item.Department     = row.Cells["Department"].Value.ToString();
         item.Quantity       = quantity;
         item.SerialNumber   = SerialNo;
         item.DateAdded      = row.Cells["DateAdded"].Value.ToString();
         item.SupplierSource = row.Cells["SupplierSource"].Value.ToString();
         item.PurchasePrice  = decPurchasePrice;
         item.Notes          = row.Cells["Notes"].Value.ToString();
         item.ItemID         = resourceid;
         item.Total          = total;
         item.AddedBy        = row.Cells["AddedBy"].Value.ToString();
         DisposeChosenItems chosenItems = new DisposeChosenItems(item.ResourceType, item.ResourceName, item.MaxLoanPeriod,
                                                                 item.Quantity, item.Department, item.ItemID, item.Total, item.AddedBy, item.SerialNumber, item.DateAdded, item.SupplierSource, item.PurchasePrice,
                                                                 item.Notes);
         chosenItems.Show();
     }
     this.Close();
 }