Example #1
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (data.Id != 0)
     {
         if (!BLL.UserAccount.AllowDelete(FormName))
         {
             MessageBox.Show(string.Format(Message.PL.DenyDelete, FormName));
         }
         else
         {
             if (MessageBox.Show("Do you want to Delete this record?", "DELETE", MessageBoxButton.YesNo) != MessageBoxResult.No)
             {
                 if (data.Delete() == true)
                 {
                     MessageBox.Show("Deleted");
                     data.Clear();
                 }
                 ;
             }
         }
     }
     else
     {
         MessageBox.Show("No Records to Delete");
     }
 }
Example #2
0
        private void onClientEvents()
        {
            BLL.FMCGHubClient.FMCGHub.On <BLL.Staff>("Staff_Save", (prod) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    prod.Save(true);
                });
            });

            BLL.FMCGHubClient.FMCGHub.On("Staff_Delete", (Action <int>)((pk) =>
            {
                this.Dispatcher.Invoke((Action)(() =>
                {
                    BLL.Staff prod = new BLL.Staff();
                    prod.Find((int)pk);
                    prod.Delete((bool)true);
                }));
            }));
        }
Example #3
0
 private void btConfirm_Click(object sender, EventArgs e)
 {
     if (tbStaffID.Text.Trim() == "")
     {
         MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         if (tbStaffID.Text.Trim() != "离职")
         {
             Maticsoft.BLL.Staff sta = new BLL.Staff();
             string str1             = string.Format("staID = '{0}'", tbStaffID.Text.Trim());
             string string1          = string.Format("{0}", tbStaffID.Text.Trim());
             if (sta.GetRecordCount(str1) > 0)
             {
                 if (sta.Delete(string1) == true)
                 {
                     MessageBox.Show("删除成功!");
                     ((Main_Admin)this.Owner).StaffLoad();
                     this.DialogResult = DialogResult.OK;
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("删除失败!");
                 }
             }
             else
             {
                 MessageBox.Show("不存在此员工!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("离职备份不可删除!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }