Ejemplo n.º 1
0
 //Xóa Staff
 void DeleteStaff(string id)
 {
     if (StaffDAO.DeleteStaff(id))
     {
         MessageBox.Show("Xóa nhân viên thành công");
     }
     else
     {
         MessageBox.Show("Xóa nhân viên thất bại");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 删除员工
 /// </summary>
 /// <param name="nStaffId"></param>
 /// <param name="nOpStaffId">操作员工编码</param>
 /// <param name="strOpStaffName">操作员工姓名</param>
 /// <param name="strErrText">出错信息</param>
 /// <returns>成功返回True,否则返回False</returns>
 public bool DeleteStaff(long nStaffId, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     try
     {
         using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
         {
             using (StaffDAO dao = new StaffDAO())
             {
                 if (!dao.DeleteStaff(nStaffId, nOpStaffId, strOpStaffName, out strErrText))
                 {
                     return(false);
                 }
             }
             transScope.Complete();
         }
         return(true);
     }
     catch (Exception e)
     {
         strErrText = e.Message;
         return(false);
     }
 }