public BedBLL() { _mTB_DormAreaDAL = new TB_DormAreaDAL(); _mTB_BuildingDAL = new TB_BuildingDAL(); _mTB_RoomDAL = new TB_RoomDAL(); _mTB_BedDAL = new TB_BedDAL(); _mTB_RoomTypeDAL = new TB_RoomTypeDAL(); }
public EmployeeCheckInBLL() { _mTB_EmployeeCheckInDAL = new TB_EmployeeCheckInDAL(); _mTB_EmployeeCheckOutDAL = new TB_EmployeeCheckOutDAL(); _mTB_BedDAL = new TB_BedDAL(); _mExcelHelper = new ExcelHelper(); _mTB_DormAreaDAL = new TB_DormAreaDAL(); _mTB_BuildingDAL = new TB_BuildingDAL(); _mTB_RoomDAL = new TB_RoomDAL(); _mTB_ChangeRoomRecordDAL = new TB_ChangeRoomRecordDAL(); }
/// <summary> /// 删除宿舍区 /// </summary> /// <param name="strID"></param> public void Remove(string strID) { int intSiteID = SessionHelper.Get(HttpContext.Current, TypeManager.User) != null ? ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).SiteID : ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).SiteID; TB_BuildingDAL mTB_BuildingDAL = new TB_BuildingDAL(); TB_UserConnectDormAreaDAL mTB_UserConnectDormArea = new TB_UserConnectDormAreaDAL(); DataTable dtBuilding = new DataTable(); string strBuildingID = string.Empty; DataRow[] drBuildingArr = null; Database db = DBO.GetInstance(); DbConnection connection = db.CreateConnection(); connection.Open(); DbTransaction tran = connection.BeginTransaction(); try { dtBuilding = mTB_BuildingDAL.GetTableBySiteID(intSiteID); foreach (string dormID in strID.Split(',')) { drBuildingArr = (from v in dtBuilding.Rows.Cast <DataRow>() where v["DormAreaID"].ToString().Equals(dormID) select v).ToArray(); foreach (DataRow dr in drBuildingArr) { if (string.IsNullOrEmpty(strBuildingID)) { strBuildingID = dr["ID"].ToString(); } else { strBuildingID += "," + dr["ID"]; } } } //删除楼栋 new BuildingBLL().Remove(strBuildingID, tran, db); //删除宿舍区与用户的关联关系 mTB_UserConnectDormArea.Delete(strID, tran, db); //删除宿舍区 _mTB_DormAreaDAL.Delete(strID, tran, db); //提交事务 tran.Commit(); } catch (Exception ex) { //回滚事务 tran.Rollback(); throw ex; } finally { //关闭连接 connection.Close(); } }
public BuildingBLL() { _mTB_BuildingDAL = new TB_BuildingDAL(); }