コード例 #1
0
        private void approveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((equipmentID != "") && (allocationID != "") && allocateToID != "")
                {
                    string query       = "UPDATE allocate_item SET allocation_date='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',om_approved='1' WHERE id='" + allocationID + "'";
                    string query2      = "UPDATE equipment_list SET current_Location='" + allocateToID + "' WHERE equipment_id='" + equipmentID + "'";
                    int    allocatedNo = Convert.ToInt32(DBManager.selectAllocatedNumber(requestID).Rows[0][0].ToString());
                    string query3      = "UPDATE allocation_request SET allocated_item_no=" + (allocatedNo + 1) + " WHERE id='" + requestID + "'";
                    if (DBManager.UpdateDatabaseQuery(query) && DBManager.UpdateDatabaseQuery(query2) && DBManager.UpdateDatabaseQuery(query3))
                    {
                        valuesC.Rows.Add(values.Rows[myGridSelectedIndex].ItemArray);
                        //approved_Items.Columns.Add(approve_allocation_request.)
                        myMessageBox mm = new myMessageBox("Approved Successfully", "Success", "OK", 0);
                        mm.ShowDialog();

                        //    MessageBox.Show("Approved Succefully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                        values = DBManager.selectForAllocationApproval();
                        approve_allocation_request.ItemsSource = values.AsDataView();
                        allocationID = "";
                        allocateToID = "";
                        equipmentID  = "";
                    }
                    else
                    {
                        myMessageBox mm = new myMessageBox("Error Occured", "Error", "OK", 1);
                        mm.ShowDialog();

                        // MessageBox.Show("Error Occured", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            catch
            {
            }
        }