Exemplo n.º 1
0
        /// <summary>
        /// 删除项目
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteProject()
        {
            int projecId = Request.GetF("ProjectId").GetInt(0, false);

            if (projecId <= 0)
            {
                return(WriteJson(new {
                    Code = "102",
                    Msg = "参数错误!"
                }));
            }
            var deleteHanderSc = _bllProject.DeleteProject(projecId);

            if (!deleteHanderSc)
            {
                return(WriteJson(new {
                    Code = "103",
                    Msg = "删除失败!"
                }));
            }
            return(WriteJson(new {
                Code = "100",
                Msg = "删除成功!"
            }));
        }
Exemplo n.º 2
0
 private void gvDeleteProject_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgProjectSearch.GetFocusedRowCellValue("ProjectID") != null)
         {
             int IValue = 0;
             if (int.TryParse(Convert.ToString(dgProjectSearch.GetFocusedRowCellValue("ProjectID")), out IValue))
             {
                 var dlgResult = XtraMessageBox.Show("Sind Sie sicher, dass Sie dieses Projekt unwiderruflich löschen möchten?", "Frage", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (Convert.ToString(dlgResult) == "Yes")
                 {
                     string _PrNr = dgProjectSearch.GetFocusedDataRow()["ProjectNumber"].ToString();
                     if (ObjBProject == null)
                     {
                         ObjBProject = new BProject();
                     }
                     ObjBProject.DeleteProject(IValue);
                     dgProjectSearch.DeleteSelectedRows();
                     foreach (Form form in Application.OpenForms)
                     {
                         if (form.Text == _PrNr)
                         {
                             Utility.Isclose = true;
                             form.Close();
                             break;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }