コード例 #1
0
        private void deleteEmployee()
        {
            string       templateFileName = Server.MapPath("/RailExamBao/RandomExam/ProgressBar.htm");
            StreamReader reader           = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312"));
            string       html             = reader.ReadToEnd();

            reader.Close();
            Response.Write(html);
            Response.Flush();
            System.Threading.Thread.Sleep(200);

            SystemUserBLL systemUserBll = new SystemUserBLL();
            EmployeeBLL   objBll        = new EmployeeBLL();

            IList <Employee> objList = objBll.GetEmployeeByWhereClause("GetStationOrgID(Org_ID)=" + Request.QueryString.Get("OrgID"));

            string jsBlock;
            int    NowCount = 0;

            foreach (Employee employee in objList)
            {
                IList <SystemUser> systemUser = systemUserBll.GetUsersByEmployeeID(employee.EmployeeID);
                if (systemUser.Count > 0)
                {
                    if (systemUser[0].RoleID != 123 && systemUser[0].RoleID != 1 && systemUser[0].RoleID != 2)
                    {
                        systemUserBll.DeleteUser(systemUserBll.GetUserByEmployeeID(employee.EmployeeID));
                        objBll.DeleteEmployee(employee.EmployeeID);
                    }
                }
                else
                {
                    objBll.DeleteEmployee(employee.EmployeeID);
                }

                NowCount = NowCount + 1;

                System.Threading.Thread.Sleep(10);
                jsBlock = "<script>SetPorgressBar('删除员工','" + ((double)(NowCount * 100) / ((double)objList.Count)).ToString("0.00") + "'); </script>";
                Response.Write(jsBlock);
                Response.Flush();
            }

            jsBlock = "<script>SetCompleted('处理完成。'); </script>";
            Response.Write(jsBlock);
            Response.Flush();

            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
コード例 #2
0
        private async void DisplayDeleteFileDialog()
        {
            ContentDialog deleteFileDialog = new ContentDialog
            {
                Title             = $"Delete employee",
                Content           = "Delete this employee FOREVER?",
                PrimaryButtonText = "Delete",
                CloseButtonText   = "Cancel"
            };

            ContentDialogResult result = await deleteFileDialog.ShowAsync();

            // Delete the file if the user clicked the primary button.
            /// Otherwise, do nothing.
            if (result == ContentDialogResult.Primary)
            {
                employeeBLL.DeleteEmployee(GetFieldInfo());
                this.Frame.Navigate(typeof(EmployeeInfoPage));
            }
            else
            {
                // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button.
                // Do nothing.
            }
        }
コード例 #3
0
        private void tspbtnDelete_Click(object sender, EventArgs e)
        {
            if (dgvEmployee.CurrentRow != null)
            {
                int    id   = (int)dgvEmployee.CurrentRow.Cells[0].Value;
                string name = dgvEmployee.CurrentRow.Cells[1].Value.ToString();

                DialogResult choice = MessageBox.Show("确定要删除员工【" + name + "】吗?", "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (choice == System.Windows.Forms.DialogResult.Yes)
                {
                    try
                    {
                        if (empbll.DeleteEmployee(id))
                        {
                            MessageBox.Show("删除成功!");
                            LoadAllEmployee();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("请先选中需要删除的行");
            }
        }
コード例 #4
0
        private void btnDeleteEmployee_Click(object sender, EventArgs e)
        {
            int ID = (int)grvEmployee.GetDataRow(grvEmployee.GetSelectedRows()[0]).ItemArray[0];

            employeeBLL.DeleteEmployee(ID);
            load();
        }
コード例 #5
0
        private void Delete(object obj)
        {
            var ep = obj as Employee;
            MessageBoxResult confirmToDel = MessageBox.Show("确认要删除员工" + ep.Ename + "吗?", "删除提示", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (confirmToDel == MessageBoxResult.Yes)
            {
                if (faceBLL.DeleteUser(ep.Eid))
                {
                    MessageBox.Show("人脸删除成功!");
                }
                else
                {
                    MessageBox.Show("人脸删除失败!");
                }
                if (employeeBLL.DeleteEmployee(ep))
                {
                    EmployeeModelList.Remove(ep);
                    MessageBox.Show("用户信息删除成功!");
                }
                else
                {
                    MessageBox.Show("用户信息删除失败!");
                }
                MsgHelper.RefreshDataGrid();
            }
        }
コード例 #6
0
        /*private void dgvEmployee_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
         * {
         *
         * }*/

        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            bool         result = true;
            DialogResult dialog = MessageBox.Show("Are you sure you want to delete?", "Cancel Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (dialog == DialogResult.OK)
            {
                foreach (DataGridViewRow item in this.dgvEmployee.SelectedRows)
                {
                    // Delete Datagridview
                    //dgvTable.Rows.RemoveAt(item.Index);
                    var itemToDelete = (Employee)item.DataBoundItem;
                    if (employeeBLL.DeleteEmployee(itemToDelete.EmployeeID) == false)
                    {
                        result = false;
                        break;
                    }
                }

                if (result == false)
                {
                    MessageBox.Show("Cannot save. Please try again!");
                }
                else
                {
                    MessageBox.Show("Saved successfully!");
                    mainform.loadUCEmployee();
                }
            }
        }
コード例 #7
0
 public ActionResult Delete(int[] employeeIDs)
 {
     if (employeeIDs != null)
     {
         EmployeeBLL.DeleteEmployee(employeeIDs);
     }
     return(RedirectToAction("Index"));
 }
コード例 #8
0
        protected void EmployeeList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int         EmployeeID = Convert.ToInt32(EmployeeList.DataKeys[e.RowIndex].Value.ToString());
            EmployeeBLL EmployeeBL = new EmployeeBLL(connectionString);

            EmployeeBL.DeleteEmployee(EmployeeID);
            BindData();
            Response.Redirect("~/AllEmployees.aspx");
        }
コード例 #9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                EmployeeBLL.DeleteEmployee(detail.EmployeeID);
                MessageBox.Show("Employee deleted!");
                FillAllData();
                ClearFilters();
            }
        }
コード例 #10
0
        protected void EmployeeDataList_DeleteCommand(object source, DataListCommandEventArgs e)
        {
            bool flag = bll.DeleteEmployee(Convert.ToInt32(EmployeeDataList.DataKeys[e.Item.ItemIndex]));

            if (flag)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('刪除成功');</script>");
                Bind();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('刪除失败');</script>");
            }
        }
コード例 #11
0
        private void DeleteData(int nEmployeID)
        {
            EmployeeBLL employeeBLL = new EmployeeBLL();

            if (employeeBLL.CanDeleteEmployee(nEmployeID))
            {
                if (!PrjPub.IsWuhan())
                {
                    EmployeeDetailBLL objBll = new EmployeeDetailBLL();
                    objBll.DeleteEmployeeDetail(nEmployeID);
                }
                else
                {
                    employeeBLL.DeleteEmployee(nEmployeID);
                }
            }
            else
            {
                SessionSet.PageMessage = "该员工已参加考试,不能删除!";
                return;
            }
        }
コード例 #12
0
ファイル: FrmAdmin.cs プロジェクト: krmckmz/restaurantProject
 //Employee DELETE
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         int silinecek = (int)dgvEmployee.CurrentRow.Cells["calisanID"].Value;
         var sonuc     = EmployeeBLL.DeleteEmployee(silinecek);
         if (sonuc)
         {
             MessageBox.Show("Çalışan silindi.");
             //Bağlantılı kullanıcıyı sildik!!
             EmployeeBLL.DeleteEmployeesUser(silinecek);
         }
         else
         {
             MessageBox.Show("Çalışan silinirken hata oluştu.");
         }
         ListEmployees(EmployeeBLL.GetEmployees());
     }
     catch (Exception)
     {
         MessageBox.Show("İçeride silinecek çalışan yoktur.");
     }
 }
コード例 #13
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //get position number
            DTO.position c    = (DTO.position)cboPosition.SelectedItem;
            string       macv = c.PositionNumber.ToString();
            //image
            MemoryStream mem = new MemoryStream();

            try
            {
                if (txtImagelink.Text.Length == 0)
                {
                    Image ima = picImage.BackgroundImage;
                    ima.Save(mem, ImageFormat.Jpeg);
                }
                else
                {
                    Image ima = Image.FromFile(txtImagelink.Text);
                    ima.Save(mem, ImageFormat.Jpeg);
                }
            }
            catch { };
            try
            {
                string KeyToSelect = txtEmployeeID.Text;
                employeeBLL.DeleteEmployee(txtEmployeeID.Text, txtEmployeeName.Text, cboSex.Text, txtNumberID.Text, txtPhone.Text, dtmBirthDay.Value.ToString(), txtAddress.Text,
                                           txtPlaceBrith.Text, txtAge.Text, macv, txtSalary.Text, dtmDayWorking.Value.ToString(), mem, txtPassword.Text, cboStatus.Text);
                DisplayNotify("Xoa thành công", 1);
                dgvData.DataSource = employeeBLL.GetAllEmployee();
                SelectRow(dgvData, KeyToSelect);
            }
            catch
            {
                DisplayNotify("Lỗi xóa trong CSDL", -1);
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (PrjPub.CurrentLoginUser == null)
            {
                Response.Redirect("../Common/Error.aspx?error=Session过期请重新登录本系统!");
                return;
            }

            if (!IsPostBack)
            {
                hfLoginID.Value = PrjPub.CurrentLoginUser.EmployeeID.ToString();
                if (PrjPub.HasEditRight("职员管理") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("职员管理") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }


                string strQuery = Request.QueryString.Get("strQuery");
                if (!string.IsNullOrEmpty(strQuery))
                {
                    string[] str = strQuery.Split('|');
                    txtName.Text            = str[0];
                    ddlSex.SelectedValue    = str[1];
                    ddlStatus.SelectedValue = str[2];
                    txtPinYin.Text          = str[3];
                    txtTechnicalCode.Text   = str[4];
                    hfPostID.Value          = str[5];
                }

                gridBind();
            }

            string strRefresh = Request.Form.Get("Refresh");

            if (!string.IsNullOrEmpty(strRefresh))
            {
                gridBind();
            }

            string strUpdate = Request.Form.Get("UpdatePsw");

            if (!string.IsNullOrEmpty(strUpdate))
            {
                SystemUserBLL objBll = new SystemUserBLL();
                SystemUser    obj    = objBll.GetUserByEmployeeID(Convert.ToInt32(strUpdate));
                if (obj != null)
                {
                    obj.Password = "******";
                    if (PrjPub.IsServerCenter)
                    {
                        objBll.UpdateUser(obj);
                    }
                    else
                    {
                        objBll.UpdateUserPsw(obj.UserID, "111111");
                    }
                    SessionSet.PageMessage = "初始化密码成功!";
                }
                else
                {
                    SessionSet.PageMessage = "该员工登录帐户不存在,初始化密码失败!";
                }

                gridBind();
            }

            string strDelete = Request.Form.Get("Delete");

            if (!string.IsNullOrEmpty(strDelete))
            {
                try
                {
                    OracleAccess db = new OracleAccess();
                    if (PrjPub.CurrentLoginUser.EmployeeID != 0)
                    {
                        //判断该员工是否参加过考试
                        string strIsArrange =
                            string.Format(
                                "select count(1) from random_exam_arrange where  ','||user_ids||','  like '%,{0},%'",
                                strDelete);
                        if (Convert.ToInt32(db.RunSqlDataSet(strIsArrange).Tables[0].Rows[0][0]) > 0)
                        {
                            ClientScript.RegisterStartupScript(GetType(), "NO", "alert('该员工已参加考试,不能删除!');", true);
                            return;
                        }

                        string strSql = "delete from Employee where Employee_ID=" + strDelete;
                        db.ExecuteNonQuery(strSql);
                    }
                    else
                    {
                        string  strSql = "select * from Employee where Employee_ID=" + strDelete;
                        DataRow dr     = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                        EmployeeBLL employeebll = new EmployeeBLL();
                        employeebll.DeleteEmployee(Convert.ToInt32(strDelete));

                        SystemLogBLL systemLogBLL = new SystemLogBLL();
                        systemLogBLL.WriteLog("删除员工:" + dr["Employee_Name"] + "(" + dr["Work_No"] + ")基本信息");
                    }
                    gridBind();
                }
                catch
                {
                    SessionSet.PageMessage = "该员工已被引用,不能删除!";
                }
            }

            if (!string.IsNullOrEmpty(hfPostID.Value))
            {
                PostBLL post = new PostBLL();
                txtPost.Text = post.GetPost(Convert.ToInt32(hfPostID.Value)).PostName;
            }
        }