Esempio n. 1
0
 protected override void OnUserDeletingRow(System.Windows.Forms.DataGridViewRowCancelEventArgs e)
 {
     base.OnUserDeletingRow(e);
     //Oranikle.Studio.Controls.IMsysBusinessBase iarchonBusinessBase = e.Row.DataBoundItem as Oranikle.Studio.Controls.IMsysBusinessBase;
     //if ((iarchonBusinessBase != null) && !iarchonBusinessBase.CanDeleteObject())
     //    e.Cancel = true;
 }
        private void dgvRoom_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            int id = 0;
            if (int.TryParse(e.Row.Cells[0].Value.ToString(), out id))
            {
                IEnumerable<int> roomQuery = (from rQ in new LINQDataContext().Classroom_Times
                                              where rQ.Room_ID == id
                                              select rQ.Class_ID);
                var aryRQ = roomQuery.ToArray();
                if (aryRQ.Length>0)
                {
                    string class_ID_List = "";
                    foreach (var anyClass in aryRQ)
                    {
                        class_ID_List += anyClass.ToString() + " and ";
                    }
                    class_ID_List = class_ID_List.Substring(0, class_ID_List.Length - 5);

                    e.Cancel = true;

                    MessageBox.Show("Information Classes with class numbers " +
                        class_ID_List + "is related to Room " +
                        e.Row.Cells[1].Value.ToString() +
                        ".\n First, this information can change classes.", "Delete Row Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
                }
                else
                {
                    new LINQDataContext().RoomDelete(id);
                }
            }
        }
        private void DGProduct_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (countDeleting == 1)
            {
                dialogResult = MessageBox.Show("Esta seguro que desea eliminar los productos seleccionados?\r\n" + DGProduct.SelectedRows.Count + " productos seran eliminados!", "Eliminar productos", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                countSelectedRows = DGProduct.SelectedRows.Count;
            }

            if (countDeleting == countSelectedRows)
            {
                countDeleting = 1;
                countSelectedRows = 0;
            }
            else
                countDeleting++;

            if (dialogResult == DialogResult.Cancel)
                e.Cancel = true;
            else
            {
                try {
                    int id = Int32.Parse(e.Row.Cells["Id"].Value.ToString());
                    Product prod = stock.Product.First(i => i.id == id);
                    prod.deleted_at = DateTime.Now;
                    stock.SaveChanges();

                }catch(Exception exc)
                {
                    Console.WriteLine(exc);
                }
                finally {
                    e.Cancel = false;
                }
            }
        }
Esempio n. 4
0
 private void GVMake_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (MessageBox.Show(Classes.Messages.MSG_RequestDel, Classes.Messages.TTLDefault, MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         control.DeleteRow(Convert.ToInt32(e.Row.Cells["cmid"].Value));
         GVMake.DataSource = control.GetMakeType();
     }
 }
 private void dgvChiTiet_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc chắn xóa không?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.No)
     {
         e.Cancel = true;
         return;
     }
 }
Esempio n. 6
0
        private void dataGridViewX1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (MsgBox.Show("確定要刪除這筆資料?", "注意!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != System.Windows.Forms.DialogResult.Yes)
                return;

            SHDepartmentRecord dept = (SHDepartmentRecord)e.Row.Tag ;
            if (dept != null)
                this.deletedDepts.Add (dept);
        }
Esempio n. 7
0
 private void dgCourses_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (!e.Row.IsNewRow)
     {
         if ((MessageBox.Show("All assignments and associated grades for this course will be lost.",  "Are you sure you want to delete this course?", MessageBoxButtons.OKCancel) == DialogResult.Cancel))
         {
             e.Cancel = true;
         }
     }
 }
        private void itemsDataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (MessageBox.Show("Do you want to delete SKU \"" + e.Row.Cells[1].Value + "\"?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) ==
                DialogResult.Yes) {
                //TODO: Add Erase code
                e.Cancel = true;
            }

            e.Cancel = true;
        }
Esempio n. 9
0
 private void Borrar(object sender, DataGridViewRowCancelEventArgs e)
 {
     string valorIdentity = e.Row.Cells[0].Value.ToString();
     string id_Transaccion = e.Row.Cells[1].Value.ToString();
     b.EndEdit();
     if (valorIdentity != "")
     {
         d.BorrarInversion(valorIdentity, id_Transaccion);
     }
 }
Esempio n. 10
0
 private void AssignmentGrid_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (!e.Row.IsNewRow)
     {
         if ((MessageBox.Show("All student grades for this assignment will be lost.", "Are you sure you want to delete this assignment?", MessageBoxButtons.OKCancel) == DialogResult.Cancel))
         {
             e.Cancel = true;
         }
     }
 }
Esempio n. 11
0
 private void delete_row(object sender, DataGridViewRowCancelEventArgs e)
 {
     int Index = (Int32)dataGridView1.CurrentRow.Cells[0].Value;
     DialogResult del = MetroFramework.MetroMessageBox.Show(this, "Delete App?",
          "Add app to device", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
     if(del == DialogResult.Yes)
     {
         dba.delete_software(u_id, Index);
         load_table();
     }
 }
Esempio n. 12
0
 private void Borrar(object sender, DataGridViewRowCancelEventArgs e)
 {
     string valorIdentity = e.Row.Cells[0].Value.ToString();
     string id_Transaccion = "0";
     b.EndEdit();
     if (valorIdentity != "")
     {
         d.BorrarEmpresa(valorIdentity, id_Transaccion);
         RefrescarProveedor();
     }
 }
 private void dgData_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         DLL.SmartQuery.NonQuery("DELETE FROM ussDateExceptions WHERE ExceptionID = '" + e.Row.Cells["ExceptionID"].Value.ToString() + "'");
     }
     else
     {
         GetData();
     }
 }
 private void dgUSSUsers_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         DLL.SmartQuery.NonQuery("DELETE FROM dtsAuthorizedUsers WHERE Username = '******'", true);
     }
     else
     {
         GetUsers();
     }
 }
Esempio n. 15
0
        /// <summary>
        /// Reconfigure the private key internal structure when a row have been deleted in the dgvDomainConfiguration DataGridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvDomainConfiguration_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e)
        {
            int total    = attachments.Count;
            int rowIndex = dgvDomainConfiguration.SelectedCells[0].RowIndex;

            attachments.Remove(rowIndex);
            for (int i = rowIndex + 1; i < total; i++)
            {
                byte[] value = attachments[i];
                attachments.Remove(i);
                attachments[i - 1] = value;
            }
        }
Esempio n. 16
0
 private void dgvAssessments_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     DataGridViewRow row = e.Row;
     if (!Database.DeleteAssessment((int)row.Cells[0].Value))
     {
         MessageBox.Show("Error: that assessment must have been taken.");
         e.Cancel = true;
     }
     else
     {
         dgvAssessments.Refresh();
     }
 }
Esempio n. 17
0
        private void dataGridView1_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e)
        {
            if (e.Row.Index < this.customers.Count)
            {
                // If the user has deleted an existing row, remove the
                // corresponding Customer object from the data store.
                this.customers.RemoveAt(e.Row.Index);
            }

            if (e.Row.Index == this.rowInEdit)
            {
                // If the user has deleted a newly created row, release
                // the corresponding Customer object.
                this.rowInEdit      = -1;
                this.customerInEdit = null;
            }
        }
        private void dictionaryDataGrid_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete to selected row?", "Delete Row?", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                //Todo delete the row and update the DataSet + DataGrid
                LanguageData dataLayer = new LanguageData();
                int i = dataLayer.daDictionary.DeleteByID((int)e.Row.Cells[0].Value);

                if (i > 0)
                {
                    if (DataChanged != null)
                        DataChanged(this, new EventArgs());
                }
            }
            else
            {
                e.Cancel = true;
            }
        }
Esempio n. 19
0
        private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            /*if ((e.RowIndex < 0) || (dataGridView1.Rows.Count == 0))
                return;
            e.*/

            /*String IDs = "(";
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (src.Contains(dataGridView1.Rows[i + 1]))
                {
                    IDs += dataGridView1.Rows[i].Cells[0].Value.ToString();
                    if (i + 1 != dataGridView1.Rows.Count)
                        IDs += ", ";
                }
                if (i + 1 == dataGridView1.Rows.Count)
                    IDs += ")";}*/
            if (e.Row.Cells[0].Value.ToString().Equals("-"))
            {
                MessageBox.Show("Это изделие сейчас выставлено на аукцион. Его нельзя удалить до завершения торгов.");
            } else
                try
                {

                    String sacrifice = e.Row.Cells[0].Value.ToString();
                    sda1.DeleteCommand = new SqlCommand("DELETE FROM Изделие WHERE ID_Изделия=" + sacrifice, sc1);

                    sc1.Open();
                    sda1.DeleteCommand.ExecuteNonQuery();

                    sc1.Close();
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Ошибка: " + exc, "Alarm!");
                    //Console.WriteLine(exc);
                }
                finally
                {
                    sc1.Close();
                }
        }
Esempio n. 20
0
 public static bool RemoveGridRow(DataGridView view, DataGridViewRowCancelEventArgs e)
 {
     string tableName = Library.Util.GetTableName(view);
     if (MessageBox.Show("你真的要删除么?", "确认删除",
         MessageBoxButtons.YesNo) == DialogResult.No)
     {
         e.Cancel = true;
     }
     else
     {
         int id = (int)e.Row.Cells[0].Value;
         string sql = "delete from [" + tableName + "] where id = @id";
         SqlCommand cmd = new SqlCommand(sql, Library.Connection.Instance());
         cmd.Parameters.AddWithValue("@id", id);
         if (cmd.ExecuteNonQuery() > 0)
             return true;
         else
             e.Cancel = true;
     }
     return false;
 }
        private void systemsDataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (MessageBox.Show("Do you want to delete System with Serial Number \"" + e.Row.Cells[3].Value + "\"?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) ==
                DialogResult.Yes)
            {
                var serial = (string)e.Row.Cells[3].Value;
                systemsTableAdapter.DeleteBySystemSerial(serial);

                var unitParts = new SystemsInventoryDataSetTableAdapters.UnitPartsTableAdapter();
                var movementRecords = new SystemsInventoryDataSetTableAdapters.MovementRecordsTableAdapter();
                var itemPurchaseOrders = new SystemsInventoryDataSetTableAdapters.ItemPurchaseOrdersTableAdapter();

                unitParts.DeleteBySystemSerial(serial);
                movementRecords.DeleteBySystemSerial(serial);
                itemPurchaseOrders.DeleteBySystemSerial(serial);

                return;
            }

            e.Cancel = true;
        }
 private void dgvGroup_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     int id = 0;
     if (int.TryParse(e.Row.Cells[0].Value.ToString(), out id))
     {
         var db = new LINQDataContext();
         // Define the query expression.
         var cquery = (from classs in db.Group_ID_Lists
                       where classs.Group_ID == id
                       select classs).ToArray();
         if (cquery != null)
         {
             string query = @"DELETE From dbo.Group_ID_List Where Group_ID = {0}";
             db.ExecuteQuery<object>(query, id);
         }
         else
         {
             db.New_GroupsPerClassDeleteByGroupID(id);
             db.GroupsDelete(id);
         }
         db.Dispose();
     }
 }
Esempio n. 23
0
        private void uMLStepFlowCollectionDataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            UMLStepFlow item = e.Row.DataBoundItem as UMLStepFlow;
            //if (item != null)
            //{
                //UMLStepFlow item = uMLStepFlowCollectionBindingSource.Current as UMLStepFlow;

                if (item != null)
                {
                    DialogResult result = MessageBox.Show(this, "Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    switch (result)
                    {
                        case DialogResult.Yes:
                            item.Delete();
                            //uMLStepFlowCollectionBindingSource.RemoveCurrent();
                            break;
                        default:
                            e.Cancel = true;
                            break;
                    }
                }
            //}
        }
Esempio n. 24
0
        private void dgrWorkstation_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            DataGridViewRow balanRow = dgrWorkstation.Rows[0];

            // Check if the Starting Balance row is included in the selected rows
            if (dgrWorkstation.SelectedRows.Contains(balanRow))
            {
                // Do not allow the user to delete the Starting Balance row.
                if (e.Row.Equals(balanRow))
                {
                    // Cancel the deletion if the Starting Balance row is included.
                    e.Cancel = true;
                }
                else
                {
                    DataGridViewRow row = e.Row;
                }

            }
        }
        private void dataGridViewX1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (e.Row.IsNewRow) return;

            string offset_course = e.Row.Cells[10].Value + "";

            if (string.IsNullOrWhiteSpace(offset_course))
            {
                MessageBox.Show("非抵免課程僅可查詢,不可刪除!");
                return;
            }

            if (MessageBox.Show("您確定要移除這筆成績紀錄?", "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
            {
                e.Cancel = true;
                return;
            }
        }
Esempio n. 26
0
 private void dataGridViewDetalleDeIngreso_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (e.Row.Cells["Id"].Value.ToString() != "0")
     {
         detalleDeIngreso = new DetalleDeIngresoEnt();
         detalleDeIngreso.ID = Convert.ToInt32(e.Row.Cells["Id"].Value);
         detalleDeIngresolist.Add(detalleDeIngreso);
     }
 }
Esempio n. 27
0
 private void gridImages_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (!deleteImage(e.Row.Index))
     {
         e.Cancel = true;
     }
 }
 private void authorizationRulesDataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     using (var deleteForm = new DeleteForm(AuthorizationRuleDeleteMessage))
     {
         e.Cancel = deleteForm.ShowDialog() == DialogResult.Cancel;
     }
 }
Esempio n. 29
0
        private void DG_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            AddCIDToPosition(e.Row.Cells["CID"].Value.ToString(), "1", false);

            if (btnEmailStudent.Visible)
            {
                DataGridView s = (DataGridView)sender;
                if (s.Name == "dgTermA")
                    Changes.Add("Removed " + e.Row.Cells["Title"].Value.ToString() + " from " + lblTermA.Text.Substring(0, lblTermA.Text.IndexOf('(') - 1));
                if (s.Name == "dgTermB")
                    Changes.Add("Removed " + e.Row.Cells["Title"].Value.ToString() + " from " + lblTermB.Text.Substring(0, lblTermB.Text.IndexOf('(') - 1));
            }
        }
Esempio n. 30
0
 private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
 }
Esempio n. 31
0
 private void OnUserDeletingRow(object sender,DataGridViewRowCancelEventArgs e) {
     System.Diagnostics.Debug.WriteLine("OnUserDeletingRow()");
 }
 private void dgvItems_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     int codigo = ObterCodigo(lista, e.Row.Cells[0].Value.ToString());
     foreach (DeploymentSqlDst.DependeciRow row in lista.Dependeci.Select("Codigo = '" + codigo + "'"))
     {
         lista.Dependeci.RemoveDependeciRow(row);
     }
     lista.File.RemoveFileRow(ObterFileRow(lista, e.Row.Cells[0].Value.ToString()));
     AtuatlizarItems((DeploymentSqlDst.FileRow[])lista.File.Select());
     e.Cancel = true;
 }
Esempio n. 33
0
		void GridUserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
		{
			if (e.Row != null && !e.Cancel) {
				OnSettingsChanged(EventArgs.Empty);
			}
		}
 private void dgCourseListing_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to delete these rows? This action can not be undone!", "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         String CID = e.Row.Cells["CID"].Value.ToString();
         DLL.SmartQuery.NonQuery("DELETE FROM cp_Course_PreRequisite WHERE CID = '" + CID + "'");
         DLL.SmartQuery.NonQuery("DELETE FROM cp_Course_MajorTrack WHERE CID = '" + CID + "'");
         DLL.SmartQuery.NonQuery("DELETE FROM cpCourse WHERE CID = '" + CID + "'");
     }
 }
 private void gridDiveProfil_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e)
 {
     diving.RemoveSegment(e.Row.Index);
 }