public ChargingBLL() { _mTB_EmployeeCheckInDAL = new TB_EmployeeCheckInDAL(); _mTB_ChargingDAL = new TB_ChargingDAL(); _mExcelHelper = new ExcelHelper(); _mTB_BUDAL = new TB_BUDAL(); }
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> /// <param name="tran"></param> /// <param name="db"></param> internal void Remove(string strID, DbTransaction tran, Database db) { TB_AssignRoomDAL mTB_AssignRoomDAL = new TB_AssignRoomDAL(); TB_ChangeRoomRecordDAL mTB_ChangeRoomRecordDAL = new TB_ChangeRoomRecordDAL(); TB_EmployeeCheckInDAL mTB_EmployeeCheckInDAL = new TB_EmployeeCheckInDAL(); TB_EmployeeCheckOutDAL mTB_EmployeeCheckOutDAL = new TB_EmployeeCheckOutDAL(); mTB_AssignRoomDAL.DeleteByBedID(strID, tran, db); mTB_ChangeRoomRecordDAL.DeleteByBedID(strID, tran, db); mTB_EmployeeCheckInDAL.DeleteByBedID(strID, tran, db); mTB_EmployeeCheckOutDAL.DeleteByBedID(strID, tran, db); _mTB_BedDAL.Delete(strID, tran, db); }
/// <summary> /// 导入 /// </summary> /// <param name="filePath"></param> /// <returns>导入失败记录</returns> public DataTable Import(string filePath) { //读取Excel内容 DataTable dt = _mExcelHelper.GetDataFromExcel(filePath); dt.Columns.Add("BZ"); DataTable dtBU = new DataTable(); //SiteID 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; //操作用户账号 string currentUser = SessionHelper.Get(HttpContext.Current, TypeManager.User) != null ? ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ADAccount : ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).Account; //获取到整个site的所有入住人员信息 DataTable dtEmployeeCheckIn = new TB_EmployeeCheckInDAL().GetTableBySiteID(intSiteID); DataTable dtError = dt.Clone(); StringBuilder sbBedID = new StringBuilder();//用于保存床位ID foreach (DataRow dr in dt.Rows) { try { var sID = dr["身份证号码"] as string; var sEmployeeNo = dr["工号"] as string; var sCond = string.Empty; if (string.IsNullOrEmpty(sID)) { sCond = string.Format("EmployeeNo='{0}'", sEmployeeNo == null ? string.Empty : sEmployeeNo.Trim()); } else { sCond = string.Format("CardNo='{0}'", sID == null ? string.Empty : sID.Trim()); } DataRow[] drEmployeeCheckInArr = dtEmployeeCheckIn.Select(sCond); if (drEmployeeCheckInArr.Length > 0) { dr["BZ"] = "已有入住记录"; dtError.ImportRow(dr); } else { TB_AllowanceApply tB_AllowanceApply = new TB_AllowanceApply(); tB_AllowanceApply.EmployeeNo = dr["工号"].ToString(); tB_AllowanceApply.Name = dr["姓名"].ToString(); tB_AllowanceApply.CardNo = dr["身份证号码"].ToString(); tB_AllowanceApply.Sex = dr["性别"].ToString(); tB_AllowanceApply.Company = dr["公司"].ToString(); tB_AllowanceApply.BU = dr["事业部"].ToString(); int nGrade = 0; int.TryParse(dr["级别"].ToString(), out nGrade); tB_AllowanceApply.Grade = nGrade; tB_AllowanceApply.CheckOutDate = dr["退宿日期"].ToString(); tB_AllowanceApply.EmployeeTypeName = dr["用工类型"].ToString(); tB_AllowanceApply.CreateUser = currentUser; tB_AllowanceApply.CreateDate = System.DateTime.Now; tB_AllowanceApply.SiteID = intSiteID; tB_AllowanceApply.Hire_Date = Convert.ToDateTime(dr["入职日期"].ToString()); ADDAllowanceApply(tB_AllowanceApply); } } catch (Exception ex) { var smsg = ex.Message; if (smsg.IndexOf("PRIMARY KEY", StringComparison.InvariantCultureIgnoreCase) != -1) { smsg = "已经有相关记录了"; } dr["BZ"] = "申请记录失败:" + smsg; dtError.ImportRow(dr); } } return(dtError); }
public AssignRoomBLL() { _mTB_AssignRoomDAL = new TB_AssignRoomDAL(); _mTB_BedDAL = new TB_BedDAL(); _mTB_EmployeeCheckInDAL = new TB_EmployeeCheckInDAL(); }