public ActionResult DeleteEmployeeMethod()
        {
            try
            {
                var staffIDStr = Request["staffID"];///员工主键ID


                string creatPersonIDsStr = Session["id"] == null ? "" : Session["id"].ToString();
                int    staffID           = -1;
                int    createPersonID    = -1;
                if (int.TryParse(staffIDStr, out staffID) && int.TryParse(creatPersonIDsStr, out createPersonID))
                {
                    string errMsg = "";
                    if (EmployeeManage.DeleteEmployee(staffID, createPersonID, ref errMsg))
                    {
                        return(Content("ok"));
                    }
                    else
                    {
                        return(Content(errMsg));
                    }
                }
                else
                {
                    return(Content("请输入正确的Int类型!"));
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Exemple #2
0
        //删除
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定删除该数据!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                DataRowView dr = (DataRowView)(gridView1.GetFocusedRow());
                EmployeeManage.DeleteEmployee(dr[0].ToString());

                LoadEmployee();
                this.ShowMessage("删除成功!");
            }
        }