Пример #1
0
 private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     try
     {
         DataTable Tmp = (DataTable)(gvSupplier.DataSource);
         for (int i = 0; i < Tmp.Rows.Count; i++)
         {
             DataRow dr = Tmp.Rows[i];
             if (isModifedRow(dr))
             {
                 Update(dr);
             }
             if (isNewRow(dr))
             {
                 Insert(dr);
             }
             if (isDeletedRow(dr))
             {
                 SupplierDao.Delete(_ConfigItem, (int)GetOriginalItemData(dr, "Id"));
             }
         }
         BidingGrid();
     }
     catch (Exception ex)
     {
         AppDebug(ex);
     }
 }
Пример #2
0
        private void gridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData.Equals(System.Windows.Forms.Keys.Delete))
            {
                try
                {
                    int[]     _IndexRowSelected = gridView1.GetSelectedRows();
                    int       _CurIndexRow      = _IndexRowSelected[0];
                    DataTable tmp = (DataTable)gvSupplier.DataSource;

                    object[] obj = new object[1];
                    obj[0] = tmp.Rows[_CurIndexRow]["Name"];
                    if (ShowMessageBox("FRMADDSUPPLIER_C_002", COREBASE.COMMAND.MessageUtils.MessageType.CONFIRM, obj) == System.Windows.Forms.DialogResult.Yes)
                    {
                        SupplierDao.Delete(_ConfigItem, CnvToInt32(tmp.Rows[_CurIndexRow]["Id"]));
                        BidingGrid();
                    }
                }
                catch (Exception ex)
                {
                    //TODO: Ghi log tai day nhe
                    throw ex;
                }
            }
        }
Пример #3
0
        public JsonResult DeleteSupplier(int id)
        {
            var  dao  = new SupplierDao();
            bool temp = dao.Delete(id);

            return(Json(new
            {
                status = temp
            }));
        }
Пример #4
0
 public ActionResult Delete(string id)
 {
     if (dao.Delete(id))
     {
         SetAlert("Supplier deleted", "success");
         return(RedirectToAction("Index"));
     }
     else
     {
         SetAlert("Delete failed", "error");
     }
     return(RedirectToAction("Index"));
 }
Пример #5
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                SupplierDao bdDao = new SupplierDao();

                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }