コード例 #1
0
ファイル: CheckOutDefine.aspx.cs プロジェクト: radtek/DMdm
        protected void btnExport_Click(object sender, EventArgs e)
        {
            TB_EmployeeCheckOut mTB_EmployeeCheckOut = new TB_EmployeeCheckOut();

            mTB_EmployeeCheckOut.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_EmployeeCheckOut.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_EmployeeCheckOut.Name       = this.txtName.Text.Trim();
            mTB_EmployeeCheckOut.CardNo     = this.txtScanCardNO.Text.Trim();

            mTB_EmployeeCheckOut.BUID   = Convert.ToInt32(Request.Form[this.ddlBuildingName.UniqueID.ToString()]);
            mTB_EmployeeCheckOut.RoomID = Convert.ToInt32(this.ddlRoomType.SelectedValue);
            mTB_EmployeeCheckOut.BU     = GetSelectedBu(); // this.txtBu.Text.Trim();
            DateTime dtVal = DateTime.Now;

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckOut.CheckOutDateBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckOut.CheckOutDateEnd = dtVal;
            }

            int    iDormAreaID = Convert.ToInt32(this.ddlDormArea.SelectedValue);
            string strFileName = new EmployeeCheckOutBLL().Export(mTB_EmployeeCheckOut, iDormAreaID);

            this.DownLoadFile(this.Request, this.Response, "退房记录.xls", File.ReadAllBytes(strFileName), 10240000);
            //File.Delete(strFileName);
        }
コード例 #2
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public int Create(TB_EmployeeCheckOut info)
 {
     try
     {
         Database db = DBO.CreateDatabase();
         return(this.Create(info, (DbTransaction)null, db));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
ファイル: EmployeeCheckInBLL.cs プロジェクト: radtek/DMdm
        /// <summary>
        /// 调房---退房记录
        /// </summary>
        /// <param name="intID"></param>
        public void AddCheckOut(int intID)
        {
            DataTable           dtCheckIn            = null; //入住信息
            TB_EmployeeCheckOut mTB_EmployeeCheckOut = null; //退房记录

            //启用事务
            _db         = DBO.CreateDatabase();
            _connection = _db.CreateConnection();
            _connection.Open();

            try
            {
                dtCheckIn = _mTB_EmployeeCheckInDAL.Get(intID);


                //添加退房记录
                mTB_EmployeeCheckOut                  = new TB_EmployeeCheckOut();
                mTB_EmployeeCheckOut.BedID            = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BedID]);
                mTB_EmployeeCheckOut.BU               = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BU] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BU].ToString();
                mTB_EmployeeCheckOut.BUID             = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BUID] is DBNull ? 0 : Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BUID]);
                mTB_EmployeeCheckOut.CardNo           = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CardNo] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CardNo].ToString();
                mTB_EmployeeCheckOut.CheckInDate      = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CheckInDate] is DBNull ? DateTime.Now : Convert.ToDateTime(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CheckInDate]);
                mTB_EmployeeCheckOut.CheckOutDate     = DateTime.Now;
                mTB_EmployeeCheckOut.Company          = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Company] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Company].ToString();
                mTB_EmployeeCheckOut.Creator          = SessionHelper.Get(HttpContext.Current, TypeManager.User) == null ? ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).Account : ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ADAccount;
                mTB_EmployeeCheckOut.EmployeeNo       = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeNo] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeNo].ToString();
                mTB_EmployeeCheckOut.IsSmoking        = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_IsSmoking] is DBNull ? false : Convert.ToBoolean(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_IsSmoking]);
                mTB_EmployeeCheckOut.Name             = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Name] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Name].ToString();
                mTB_EmployeeCheckOut.Province         = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Province] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Province].ToString();
                mTB_EmployeeCheckOut.RoomID           = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_RoomID]);
                mTB_EmployeeCheckOut.Sex              = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Sex] is DBNull ? 0 : Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Sex]);
                mTB_EmployeeCheckOut.SiteID           = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_SiteID]);
                mTB_EmployeeCheckOut.Telephone        = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Telephone] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Telephone].ToString();
                mTB_EmployeeCheckOut.Reason           = "换房";
                mTB_EmployeeCheckOut.Remark           = "换房产生";
                mTB_EmployeeCheckOut.EmployeeTypeName = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeTypeName].ToString();

                _mTB_EmployeeCheckOutDAL.Create(mTB_EmployeeCheckOut);

                //提交事务
            }
            catch (Exception ex)
            {
                //回滚事务
                _tran.Rollback();
                throw ex;
            }
            finally
            {
                //关闭连接
                _connection.Close();
            }
        }
コード例 #4
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="tb_EmployeeCheckOut"></param>
        /// <returns></returns>
        public string Export(TB_EmployeeCheckOut tb_EmployeeCheckOut, int iDormAreaID)
        {
            DataTable dt = _mTB_EmployeeCheckOutDAL.GetTable(tb_EmployeeCheckOut, iDormAreaID);

            dt.Columns.Remove("楼层");
            dt.Columns.Remove("单元");
            string strFilePath = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("..\\..\\"), "Report");

            if (!Directory.Exists(strFilePath))
            {
                Directory.CreateDirectory(strFilePath);
            }
            string strFileName = Path.Combine(strFilePath, DateTime.Now.ToString("yyMMddHHmmssms_") + "退房记录.xls");

            new ExcelHelper().RenderToExcel(dt, strFileName);
            return(strFileName);
        }
コード例 #5
0
        private string  GetCheckOutDate(string EmployeeID)
        {
            TB_EmployeeCheckOut mTB_EmployeeCheckOut = new TB_EmployeeCheckOut();
            EmployeeCheckOutBLL mEmployeeCheckOutBLL = new EmployeeCheckOutBLL();
            Pager     pager    = new Pager();
            DataTable dtSource = null;

            pager.CurrentPageIndex = 1;
            pager.srcOrder         = "  ID desc";

            mTB_EmployeeCheckOut.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_EmployeeCheckOut.EmployeeNo = EmployeeID;
            mTB_EmployeeCheckOut.Name       = "";
            mTB_EmployeeCheckOut.CardNo     = "";
            dtSource = mEmployeeCheckOutBLL.GetPagerData(mTB_EmployeeCheckOut, ref pager);

            return(dtSource.Rows.Count > 0 ? dtSource.Rows[0]["CheckOutDate"].ToString() : "未住宿舍");
        }
コード例 #6
0
ファイル: CheckOutDefine.aspx.cs プロジェクト: radtek/DMdm
        private void Bind(int intCurrentIndex)
        {
            TB_EmployeeCheckOut mTB_EmployeeCheckOut = new TB_EmployeeCheckOut();
            EmployeeCheckOutBLL mEmployeeCheckOutBLL = new EmployeeCheckOutBLL();
            Pager     pager    = new Pager();
            DataTable dtSource = null;

            pager.CurrentPageIndex = intCurrentIndex;
            pager.srcOrder         = "  ID desc";

            mTB_EmployeeCheckOut.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_EmployeeCheckOut.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_EmployeeCheckOut.Name       = this.txtName.Text.Trim();
            mTB_EmployeeCheckOut.CardNo     = this.txtScanCardNO.Text.Trim();

            mTB_EmployeeCheckOut.BUID = Convert.ToInt32(Request.Form[this.ddlBuildingName.UniqueID.ToString()]);
            mTB_EmployeeCheckOut.BU   = GetSelectedBu(); //this.txtBu.Text.Trim();

            DateTime dtVal = DateTime.Now;

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckOut.CheckOutDateBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckOut.CheckOutDateEnd = dtVal;
            }

            int    iDormAreaID = Convert.ToInt32(this.ddlDormArea.SelectedValue);
            int    iRoomTypeID = Convert.ToInt32(this.ddlRoomType.SelectedValue);
            string sRoomName   = this.txtRoom.Text.Trim();

            dtSource = mEmployeeCheckOutBLL.GetPagerData(mTB_EmployeeCheckOut, iDormAreaID, iRoomTypeID, sRoomName, ref pager);


            GridView1.DataSource = dtSource;
            GridView1.DataBind();

            this.Pager1.ItemCount    = pager.TotalRecord;
            this.Pager1.PageCount    = pager.TotalPage;
            this.Pager1.CurrentIndex = pager.CurrentPageIndex;
            this.Pager1.PageSize     = pager.PageSize;
        }
コード例 #7
0
        /// <summary>
        /// 获取退房记录, 用于EXCEL导出
        /// </summary>
        /// <param name="tb_EmployeeCheckOut"></param>
        /// <returns></returns>
        public DataTable GetTable(TB_EmployeeCheckOut tb_EmployeeCheckOut, int iDormAreaID)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"
SELECT A.[EmployeeNo] '工号'
      ,A.[Name] '姓名'
      ,A.[BU] '事业部'
      ,A.[Company] '公司'
      ,A.[CardNo] '身份证号码'
      ,A.[Telephone] '手机号码'
      ,Convert(varchar(12),A.[CheckInDate],111) as '入住日期'
	  ,Convert(varchar(12),A.[CheckOutDate],111) as '退房日期'
      ,A.[Reason] as '原因'
      ,A.[Remark] as '备注'
      ,case when (A.[CanLeave] IS NULL OR A.[CanLeave]>0) then '是' else '否' end AS '同步签退离职系统'
	  ,G.Name As '宿舍区'
	  ,F.Name As '楼栋'
	  ,E.Name As '单元'
	  ,D.Name As '楼层'
      ,C.Name AS '房间号'
	  ,B.Name AS '床位号' 
      ,J.Name as '房间类型'
FROM  [TB_EmployeeCheckOut] AS A
LEFT JOIN [TB_Bed] AS B
ON A.[BedID]=B.ID
LEFT JOIN [TB_Room] AS C
ON B.[RoomID]=C.ID
LEFT JOIN [TB_Floor] AS D
ON B.FloorID=D.ID
LEFT JOIN [TB_Unit] AS E
ON B.UnitID=E.ID
LEFT JOIN [TB_Building] AS F
on B.BuildingID=F.ID
LEFT JOIN [TB_DormArea] AS G
ON B.DormAreaID=G.ID
LEFT JOIN TB_BU AS I
ON A.BUID=I.ID 
LEFT JOIN TB_RoomType AS J
ON C.RoomType=J.ID
");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                if (null != SessionHelper.Get(HttpContext.Current, TypeManager.User))
                {
                    strBuilder.AppendLine(@" inner join [TB_UserConnectDormArea] AS H
                                            on G.ID=H.[DormAreaID]
                                            where 1=1");
                    strBuilder.AppendLine(" AND H.[UserID] = @UserID");
                    db.AddInParameter(dbCommandWrapper, "@UserID", DbType.Int32, ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ID);
                }
                else
                {
                    strBuilder.AppendLine(" where 1=1");
                }

                if (tb_EmployeeCheckOut.SiteID > 0)
                {
                    strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                    db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, tb_EmployeeCheckOut.SiteID);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.EmployeeNo))
                {
                    strBuilder.AppendLine(" AND A.EmployeeNo = @EmployeeNo");
                    db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, tb_EmployeeCheckOut.EmployeeNo);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.Name))
                {
                    strBuilder.AppendLine(" AND A.Name = @Name");
                    db.AddInParameter(dbCommandWrapper, "@Name", DbType.String, tb_EmployeeCheckOut.Name);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.CardNo))
                {
                    strBuilder.AppendLine(" AND A.CardNo = @CardNo");
                    db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, tb_EmployeeCheckOut.CardNo);
                }
                if (tb_EmployeeCheckOut.BUID > 0)
                {
                    strBuilder.AppendLine(" AND F.ID = @BUID");
                    db.AddInParameter(dbCommandWrapper, "@BUID", DbType.String, tb_EmployeeCheckOut.BUID);
                }
                if (iDormAreaID > 0)
                {
                    strBuilder.AppendLine(" AND G.ID = @DormAreaID");
                    db.AddInParameter(dbCommandWrapper, "@DormAreaID", DbType.Int32, iDormAreaID);
                }

                if (tb_EmployeeCheckOut.RoomID > 0)
                {
                    strBuilder.AppendLine(" AND J.ID = @iRoomTypeID");
                    db.AddInParameter(dbCommandWrapper, "@iRoomTypeID", DbType.Int32, tb_EmployeeCheckOut.RoomID);
                }

                if (!string.IsNullOrEmpty(tb_EmployeeCheckOut.BU))
                {
                    var spara = string.Format("%{0}%", tb_EmployeeCheckOut.BU);
                    strBuilder.AppendLine(" AND A.BU like @BU");
                    db.AddInParameter(dbCommandWrapper, "@BU", DbType.String, spara);
                }
                //if (tb_EmployeeCheckOut.CheckOutDate != default(DateTime))
                //{
                //    strBuilder.AppendLine(" AND CAST(CheckOutDate as Date)=@coDate");
                //    db.AddInParameter(dbCommandWrapper, "@coDate", DbType.String, tb_EmployeeCheckOut.CheckOutDate.ToString("yyyy-MM-dd"));
                //}
                if (tb_EmployeeCheckOut.CheckOutDateBegin != default(DateTime))
                {
                    strBuilder.AppendLine(" AND CAST(CheckOutDate as Date) between @CheckOutDateBegin and @CheckOutDateEnd");
                    db.AddInParameter(dbCommandWrapper, "@CheckOutDateBegin", DbType.String, tb_EmployeeCheckOut.CheckOutDateBegin.ToString("yyyy/MM/dd"));
                    db.AddInParameter(dbCommandWrapper, "@CheckOutDateEnd", DbType.String, tb_EmployeeCheckOut.CheckOutDateEnd.ToString("yyyy/MM/dd"));
                }

                dbCommandWrapper.CommandTimeout = 60; // Johnsing 2018-04-27 临时措施
                dbCommandWrapper.CommandText    = strBuilder.ToString();
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 事务添加
        /// </summary>
        /// <param name="info"></param>
        /// <param name="tran"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public int Create(TB_EmployeeCheckOut info, DbTransaction tran, Database db)
        {
            DbCommand dbCommandWrapper = null;
            int       intId;
            string    strInsertSql   = @"INSERT INTO TB_EmployeeCheckOut ([RoomID]
      ,[BedID]
      ,[EmployeeNo]
      ,[Name]
      ,[Sex]
      ,[BUID]
      ,[BU]
      ,[Company]
      ,[CardNo]
      ,[Telephone]
      ,[Province]
      ,[IsSmoking]
      ,[CheckInDate]
      ,[CheckOutDate]
      ,[Creator]
      ,[SiteID]
,[Reason]
,[Remark]
,[EmployeeTypeName])
                                    VALUES(@RoomID
      ,@BedID
      ,@EmployeeNo
      ,@Name
      ,@Sex
      ,@BUID
      ,@BU
      ,@Company
      ,@CardNo
      ,@Telephone
      ,@Province
      ,@IsSmoking
      ,@CheckInDate
      ,@CheckOutDate
      ,@Creator
      ,@SiteID
,@Reason
,@Remark
,@EmployeeTypeName) ";
            string    strSelectIdSql = ";SELECT SCOPE_IDENTITY()";

            try
            {
                dbCommandWrapper = db.GetSqlStringCommand(strInsertSql + strSelectIdSql);
                #region Add parameters
                db.AddInParameter(dbCommandWrapper, "@RoomID", DbType.Int32, info.RoomID);
                db.AddInParameter(dbCommandWrapper, "@BedID", DbType.Int32, info.BedID);
                db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, info.EmployeeNo);
                db.AddInParameter(dbCommandWrapper, "@Name", DbType.String, info.Name);
                db.AddInParameter(dbCommandWrapper, "@Sex", DbType.Int32, info.Sex);
                db.AddInParameter(dbCommandWrapper, "@BUID", DbType.Int32, info.BUID);
                db.AddInParameter(dbCommandWrapper, "@BU", DbType.String, info.BU);
                db.AddInParameter(dbCommandWrapper, "@Company", DbType.String, info.Company);
                db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, info.CardNo);
                db.AddInParameter(dbCommandWrapper, "@Telephone", DbType.String, info.Telephone);
                db.AddInParameter(dbCommandWrapper, "@Province", DbType.String, info.Province);
                db.AddInParameter(dbCommandWrapper, "@IsSmoking", DbType.Boolean, info.IsSmoking);
                db.AddInParameter(dbCommandWrapper, "@CheckInDate", DbType.DateTime, info.CheckInDate);
                db.AddInParameter(dbCommandWrapper, "@CheckOutDate", DbType.DateTime, info.CheckOutDate);
                db.AddInParameter(dbCommandWrapper, "@Creator", DbType.String, info.Creator);
                db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, info.SiteID);
                db.AddInParameter(dbCommandWrapper, "@Reason", DbType.String, info.Reason);
                db.AddInParameter(dbCommandWrapper, "@Remark", DbType.String, info.Remark);
                db.AddInParameter(dbCommandWrapper, "@EmployeeTypeName", DbType.String, info.EmployeeTypeName);

                #endregion
                if (tran == null)
                {
                    intId = Convert.ToInt32(db.ExecuteScalar(dbCommandWrapper));
                }
                else
                {
                    intId = Convert.ToInt32(db.ExecuteScalar(dbCommandWrapper, tran));
                }
                return(intId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// 获取退房记录分页数据
        /// </summary>
        /// <param name="tb_EmployeeCheckOut"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public DataTable GetTable(TB_EmployeeCheckOut tb_EmployeeCheckOut, int iDormAreaID, int iRoomTypeID, string sRoomName, ref Pager pager)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"
SELECT A.[ID]
      ,A.[EmployeeNo]
      ,A.[Sex]
      ,I.Name  [RoomType]
      ,A.[Company]
      ,A.EmployeeTypeName
      ,A.[BU]
      ,A.[CardNo]
      ,A.[Telephone]
      ,A.[Province]
      ,Convert(varchar(12),A.[CheckInDate],111) as CheckInDate
	  ,Convert(varchar(12),A.[CheckOutDate],111) as CheckOutDate
      ,A.[Name]
      ,A.[SiteID]
      ,A.[Reason]
      ,A.[Remark]
      ,case when A.[CanLeave] IS NULL then 1 else A.[CanLeave] end as CanLeave
	  ,B.Name AS BedName 
      ,C.Name AS RoomName
	  ,D.Name As FloorName
	  ,E.Name As UnitName
	  ,F.Name As BuildingName
	  ,G.Name As DormAreaName
FROM  [TB_EmployeeCheckOut] AS A
LEFT JOIN [TB_Bed] AS B
ON A.[BedID]=B.ID
LEFT JOIN [TB_Room] AS C
ON B.[RoomID]=C.ID
LEFT JOIN [TB_Floor] AS D
ON B.FloorID=D.ID
LEFT JOIN [TB_Unit] AS E
ON B.UnitID=E.ID
LEFT JOIN [TB_Building] AS F
on B.BuildingID=F.ID
LEFT JOIN [TB_DormArea] AS G
ON B.DormAreaID=G.ID
LEFT JOIN TB_RoomType AS I
ON C.RoomType=I.ID");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                if (null != SessionHelper.Get(HttpContext.Current, TypeManager.User))
                {
                    strBuilder.AppendLine(@" inner join [TB_UserConnectDormArea] AS H
on G.ID=H.[DormAreaID]
where 1=1");
                    strBuilder.AppendLine(" AND H.[UserID] = @UserID");
                    db.AddInParameter(dbCommandWrapper, "@UserID", DbType.Int32, ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ID);
                }
                else
                {
                    strBuilder.AppendLine(" where 1=1");
                }

                if (tb_EmployeeCheckOut.SiteID > 0)
                {
                    strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                    db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, tb_EmployeeCheckOut.SiteID);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.EmployeeNo))
                {
                    strBuilder.AppendLine(" AND A.EmployeeNo = @EmployeeNo");
                    db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, tb_EmployeeCheckOut.EmployeeNo);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.Name))
                {
                    strBuilder.AppendLine(" AND A.Name = @Name");
                    db.AddInParameter(dbCommandWrapper, "@Name", DbType.String, tb_EmployeeCheckOut.Name);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.CardNo))
                {
                    strBuilder.AppendLine(" AND A.CardNo = @CardNo");
                    db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, tb_EmployeeCheckOut.CardNo);
                }

                if (tb_EmployeeCheckOut.BUID > 0)
                {
                    strBuilder.AppendLine(" AND F.ID = @BUID");
                    db.AddInParameter(dbCommandWrapper, "@BUID", DbType.String, tb_EmployeeCheckOut.BUID);
                }
                if (iDormAreaID > 0)
                {
                    strBuilder.AppendLine(" AND G.ID = @DormAreaID");
                    db.AddInParameter(dbCommandWrapper, "@DormAreaID", DbType.Int32, iDormAreaID);
                }

                if (iRoomTypeID > 0)
                {
                    strBuilder.AppendLine(" AND I.ID = @iRoomTypeID");
                    db.AddInParameter(dbCommandWrapper, "@iRoomTypeID", DbType.Int32, iRoomTypeID);
                }
                if (!string.IsNullOrEmpty(sRoomName))
                {
                    strBuilder.AppendLine(" AND C.Name = @sRoomName");
                    db.AddInParameter(dbCommandWrapper, "@sRoomName", DbType.String, sRoomName);
                }
                if (!string.IsNullOrEmpty(tb_EmployeeCheckOut.BU))
                {
                    var spara = string.Format("%{0}%", tb_EmployeeCheckOut.BU);
                    strBuilder.AppendLine(" AND A.BU like @BU");
                    db.AddInParameter(dbCommandWrapper, "@BU", DbType.String, spara);
                }
                //if (tb_EmployeeCheckOut.CheckOutDate != default(DateTime))
                //{
                //    strBuilder.AppendLine(" AND CAST(CheckOutDate as Date)=@coDate");
                //    db.AddInParameter(dbCommandWrapper, "@coDate", DbType.String, tb_EmployeeCheckOut.CheckOutDate.ToString("yyyy-MM-dd"));
                //}
                if (tb_EmployeeCheckOut.CheckOutDateBegin != default(DateTime))
                {
                    strBuilder.AppendLine(" AND CAST(CheckOutDate as Date) between @CheckOutDateBegin and @CheckOutDateEnd");
                    db.AddInParameter(dbCommandWrapper, "@CheckOutDateBegin", DbType.String, tb_EmployeeCheckOut.CheckOutDateBegin.ToString("yyyy/MM/dd"));
                    db.AddInParameter(dbCommandWrapper, "@CheckOutDateEnd", DbType.String, tb_EmployeeCheckOut.CheckOutDateEnd.ToString("yyyy/MM/dd"));
                }

                if (pager != null && !pager.IsNull)
                {
                    dbCommandWrapper.CommandText = pager.GetPagerSql4Count(strBuilder.ToString());
                    dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                    pager.TotalRecord            = Convert.ToInt32(dt.Rows[0][0]);
                    dbCommandWrapper.CommandText = pager.GetPagerSql4Data(strBuilder.ToString(), DataBaseTypeEnum.sqlserver);
                }
                else
                {
                    dbCommandWrapper.CommandText = strBuilder.ToString();
                }
                dbCommandWrapper.CommandTimeout = 60; // Johnsing 2018-04-27 临时措施
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                LogManager.GetInstance().ErrorLog("TB_EmployeeCheckOutDAL::GetTable", ex);
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// 获取退房记录分页数据
        /// </summary>
        /// <param name="tb_EmployeeCheckOut"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public DataTable GetTable(TB_EmployeeCheckOut tb_EmployeeCheckOut, ref Pager pager)
        {
            DataTable dt = null;
            DbCommand dbCommandWrapper = null;

            try
            {
                StringBuilder strBuilder = new StringBuilder(@"
SELECT A.[ID]
      ,A.[EmployeeNo]
      ,A.[Sex]
      ,I.Name  [RoomType]
      ,A.[Company]
      ,A.EmployeeTypeName
      ,A.[BU]
      ,A.[CardNo]
      ,A.[Telephone]
      ,A.[Province]
      ,Convert(varchar(12),A.[CheckInDate],111) as CheckInDate
	  ,Convert(varchar(12),A.[CheckOutDate],111) as CheckOutDate
      ,A.[Name]
      ,A.[SiteID]
      ,A.[Reason]
      ,A.[Remark]
	  ,B.Name AS BedName 
      ,C.Name AS RoomName
	  ,D.Name As FloorName
	  ,E.Name As UnitName
	  ,F.Name As BuildingName
	  ,G.Name As DormAreaName
FROM  [TB_EmployeeCheckOut] AS A
LEFT JOIN [TB_Bed] AS B
ON A.[BedID]=B.ID
LEFT JOIN [TB_Room] AS C
ON B.[RoomID]=C.ID
LEFT JOIN [TB_Floor] AS D
ON B.FloorID=D.ID
LEFT JOIN [TB_Unit] AS E
ON B.UnitID=E.ID
LEFT JOIN [TB_Building] AS F
on B.BuildingID=F.ID
LEFT JOIN [TB_DormArea] AS G
ON B.DormAreaID=G.ID
LEFT JOIN TB_RoomType AS I
ON C.RoomType=I.ID");
                Database      db         = DBO.GetInstance();
                dbCommandWrapper             = db.DbProviderFactory.CreateCommand();
                dbCommandWrapper.CommandType = CommandType.Text;
                if (null != SessionHelper.Get(HttpContext.Current, TypeManager.User))
                {
                    strBuilder.AppendLine(@" inner join [TB_UserConnectDormArea] AS H
on G.ID=H.[DormAreaID]
where 1=1");
                    strBuilder.AppendLine(" AND H.[UserID] = @UserID");
                    db.AddInParameter(dbCommandWrapper, "@UserID", DbType.Int32, ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ID);
                }
                else
                {
                    strBuilder.AppendLine(" where 1=1");
                }

                if (tb_EmployeeCheckOut.SiteID > 0)
                {
                    strBuilder.AppendLine(" AND A.SiteID = @SiteID");
                    db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, tb_EmployeeCheckOut.SiteID);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.EmployeeNo))
                {
                    strBuilder.AppendLine(" AND A.EmployeeNo = @EmployeeNo");
                    db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, tb_EmployeeCheckOut.EmployeeNo);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.Name))
                {
                    strBuilder.AppendLine(" AND A.Name = @Name");
                    db.AddInParameter(dbCommandWrapper, "@Name", DbType.String, tb_EmployeeCheckOut.Name);
                }

                if (!String.IsNullOrEmpty(tb_EmployeeCheckOut.CardNo))
                {
                    strBuilder.AppendLine(" AND A.CardNo = @CardNo");
                    db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, tb_EmployeeCheckOut.CardNo);
                }

                if (pager != null && !pager.IsNull)
                {
                    dbCommandWrapper.CommandText = pager.GetPagerSql4Count(strBuilder.ToString());
                    dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                    pager.TotalRecord            = Convert.ToInt32(dt.Rows[0][0]);
                    dbCommandWrapper.CommandText = pager.GetPagerSql4Data(strBuilder.ToString(), DataBaseTypeEnum.sqlserver);
                }
                else
                {
                    dbCommandWrapper.CommandText = strBuilder.ToString();
                }
                dbCommandWrapper.CommandTimeout = 60; // johnsing he 2018-04-27 临时措施
                dt = db.ExecuteDataSet(dbCommandWrapper).Tables[0];
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// 事务更新
        /// </summary>
        /// <param name="info"></param>
        /// <param name="tran"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public int Edit(TB_EmployeeCheckOut info, DbTransaction tran, Database db)
        {
            DbCommand dbCommandWrapper = null;
            string    strUpdateSql     = @"UPDATE TB_EmployeeCheckOut SET [RoomID]=@RoomID
      ,[BedID]=@BedID
      ,[EmployeeNo]=@EmployeeNo
      ,[Name]=@Name
      ,[Sex]=@Sex
      ,[BUID]=@BUID
      ,[BU]=@BU
      ,[Company]=@Company
      ,[CardNo]=@CardNo
      ,[Telephone]=@Telephone
      ,[Province]=@Province
      ,[IsSmoking]=@IsSmoking
      ,[CheckInDate]=@CheckInDate
      ,[CheckOutDate]=@CheckOutDate
      ,[UpdateBy]=@UpdateBy
      ,[UpdateDate]=@UpdateDate
      ,[Reason]=@Reason
 ,[Remark]=@Remark
                                                            WHERE ID=@ID";

            try
            {
                dbCommandWrapper = db.GetSqlStringCommand(strUpdateSql);

                #region Add parameters
                db.AddInParameter(dbCommandWrapper, "@RoomID", DbType.Int32, info.RoomID);
                db.AddInParameter(dbCommandWrapper, "@BedID", DbType.Int32, info.BedID);
                db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.Int32, info.EmployeeNo);
                db.AddInParameter(dbCommandWrapper, "@Name", DbType.Int32, info.Name);
                db.AddInParameter(dbCommandWrapper, "@Sex", DbType.Int32, info.Sex);
                db.AddInParameter(dbCommandWrapper, "@BUID", DbType.Int32, info.BUID);
                db.AddInParameter(dbCommandWrapper, "@BU", DbType.String, info.BU);
                db.AddInParameter(dbCommandWrapper, "@Company", DbType.String, info.Company);
                db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, info.CardNo);
                db.AddInParameter(dbCommandWrapper, "@Telephone", DbType.String, info.Telephone);
                db.AddInParameter(dbCommandWrapper, "@Province", DbType.String, info.Province);
                db.AddInParameter(dbCommandWrapper, "@IsSmoking", DbType.Boolean, info.IsSmoking);
                db.AddInParameter(dbCommandWrapper, "@CheckInDate", DbType.DateTime, info.CheckInDate);
                db.AddInParameter(dbCommandWrapper, "@CheckOutDate", DbType.DateTime, info.CheckOutDate);
                db.AddInParameter(dbCommandWrapper, "@UpdateBy", DbType.String, info.UpdateBy);
                db.AddInParameter(dbCommandWrapper, "@UpdateDate", DbType.DateTime, DateTime.Now);
                db.AddInParameter(dbCommandWrapper, "@Reason", DbType.String, info.Reason);
                db.AddInParameter(dbCommandWrapper, "@Remark", DbType.String, info.Remark);
                #endregion
                if (tran == null)
                {
                    return(db.ExecuteNonQuery(dbCommandWrapper));
                }
                else
                {
                    return(db.ExecuteNonQuery(dbCommandWrapper, tran));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper.Dispose();
                    dbCommandWrapper = null;
                }
            }
        }
コード例 #12
0
 /// <summary>
 /// 获取退房记录分页数据
 /// </summary>
 /// <param name="tb_EmployeeCheckOut"></param>
 /// <param name="pager"></param>
 /// <returns></returns>
 public DataTable GetPagerData(TB_EmployeeCheckOut tb_EmployeeCheckOut, int iDormAreaID, int iRoomTypeID, string sRoomName, ref Pager pager)
 {
     return(_mTB_EmployeeCheckOutDAL.GetTable(tb_EmployeeCheckOut, iDormAreaID, iRoomTypeID, sRoomName, ref pager));
 }
コード例 #13
0
 /// <summary>
 /// 获取退房记录分页数据
 /// </summary>
 /// <param name="tb_EmployeeCheckOut"></param>
 /// <param name="pager"></param>
 /// <returns></returns>
 public DataTable GetPagerData(TB_EmployeeCheckOut tb_EmployeeCheckOut, ref Pager pager)
 {
     return(_mTB_EmployeeCheckOutDAL.GetTable(tb_EmployeeCheckOut, ref pager));
 }
コード例 #14
0
ファイル: EmployeeCheckInBLL.cs プロジェクト: radtek/DMdm
        /// <summary>
        /// 员工退房
        /// </summary>
        /// <param name="intID"></param>
        public void CheckOut(int intID, string sTotal)
        {
            DataTable           dtCheckIn            = null; //入住信息
            TB_EmployeeCheckOut mTB_EmployeeCheckOut = null; //退房记录
            bool    bCanLeave = false;
            bool    bSuccess  = false;
            decimal?dSum      = null;

            //启用事务
            _db         = DBO.CreateDatabase();
            _connection = _db.CreateConnection();
            _connection.Open();
            _tran = _connection.BeginTransaction();
            try
            {
                dtCheckIn = _mTB_EmployeeCheckInDAL.Get(intID);

                //添加扣费记录
                string[] sData                 = sTotal.Split('@');
                string   sReason               = sData[0].ToString();
                string   sChargeContent        = sData[1].ToString();
                string   sMoney                = sData[2].ToString();
                string   sAirConditionFee      = sData[3].ToString();
                string   sAirConditionFeeMoney = sData[4].ToString();
                string   sRoomKeyFee           = sData[5].ToString();
                string   sRoomKeyFeeMoney      = sData[6].ToString();
                string   sOtherFee             = sData[7].ToString();
                string   sOtherFeeMoney        = sData[8].ToString();
                string   sRemark               = sData[9].ToString();
                string   sCanLeave             = sData[10].ToString();

                //调房--分配到未入住区域
                if (sReason.Contains("调房"))
                {
                    TB_AssignDormArea tB_AssignDormArea = new TB_AssignDormArea();
                    tB_AssignDormArea.DormAreaID = Convert.ToInt32(sReason.Split('#')[1]);
                    tB_AssignDormArea.CardNo     = dtCheckIn.Rows[0]["CardNo"].ToString();
                    tB_AssignDormArea.EmployeeNo = dtCheckIn.Rows[0]["EmployeeNo"].ToString();
                    tB_AssignDormArea.CreateUser = SessionHelper.Get(HttpContext.Current, TypeManager.User) == null ? ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).Account : ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ADAccount;
                    tB_AssignDormArea.CreateDate = System.DateTime.Now;

                    new AssignRoomBLL().AssignArea(tB_AssignDormArea);

                    sReason = sReason.Split('#')[0];
                }

                //添加退房记录
                mTB_EmployeeCheckOut              = new TB_EmployeeCheckOut();
                mTB_EmployeeCheckOut.BedID        = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BedID]);
                mTB_EmployeeCheckOut.BU           = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BU] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BU].ToString();
                mTB_EmployeeCheckOut.BUID         = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BUID] is DBNull ? 0 : Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BUID]);
                mTB_EmployeeCheckOut.CardNo       = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CardNo] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CardNo].ToString();
                mTB_EmployeeCheckOut.CheckInDate  = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CheckInDate] is DBNull ? DateTime.Now : Convert.ToDateTime(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CheckInDate]);
                mTB_EmployeeCheckOut.CheckOutDate = DateTime.Now;
                mTB_EmployeeCheckOut.Company      = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Company] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Company].ToString();
                mTB_EmployeeCheckOut.Creator      = SessionHelper.Get(HttpContext.Current, TypeManager.User) == null ? ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).Account : ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ADAccount;
                mTB_EmployeeCheckOut.EmployeeNo   = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeNo] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeNo].ToString();
                mTB_EmployeeCheckOut.IsSmoking    = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_IsSmoking] is DBNull ? false : Convert.ToBoolean(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_IsSmoking]);
                mTB_EmployeeCheckOut.Name         = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Name] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Name].ToString();
                mTB_EmployeeCheckOut.Province     = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Province] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Province].ToString();
                mTB_EmployeeCheckOut.RoomID       = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_RoomID]);
                mTB_EmployeeCheckOut.Sex          = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Sex] is DBNull ? 0 : Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Sex]);
                mTB_EmployeeCheckOut.SiteID       = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_SiteID]);
                mTB_EmployeeCheckOut.Telephone    = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Telephone] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Telephone].ToString();
                mTB_EmployeeCheckOut.Reason       = sReason == "" ? string.Empty : sReason;
                mTB_EmployeeCheckOut.Remark       = sRemark == "" ? string.Empty : sRemark;
                bCanLeave = (Convert.ToInt32(sCanLeave) > 0);
                mTB_EmployeeCheckOut.CanLeave         = bCanLeave ? 1 : 0;
                mTB_EmployeeCheckOut.EmployeeTypeName = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeTypeName].ToString();

                _mTB_EmployeeCheckOutDAL.Create(mTB_EmployeeCheckOut, _tran, _db);

                //更新床位状态
                _mTB_BedDAL.Update(mTB_EmployeeCheckOut.BedID, _tran, _db, TypeManager.BedStatus.Free);
                //删除入住信息
                _mTB_EmployeeCheckInDAL.Delete(intID, _tran, _db);

                //添加扣费记录
                var dMoney = sMoney.Length > 0 ? Convert.ToDecimal(sMoney) : 0;
                var dAirConditionFeeMoney = sAirConditionFeeMoney.Length > 0 ? Convert.ToDecimal(sAirConditionFeeMoney) : 0;
                var dRoomKeyFeeMoney      = sRoomKeyFeeMoney.Length > 0 ? Convert.ToDecimal(sRoomKeyFeeMoney) : 0;
                var dOtherFeeMoney        = sOtherFeeMoney.Length > 0 ? Convert.ToDecimal(sOtherFeeMoney) : 0;
                dSum = dMoney + dAirConditionFeeMoney + dRoomKeyFeeMoney + dOtherFeeMoney; //总扣费

                ChargingBLL mChargingBLL = new ChargingBLL();
                TB_Charging mTB_Charging = new TB_Charging();
                mTB_Charging.Name                 = mTB_EmployeeCheckOut.Name;
                mTB_Charging.EmployeeNo           = mTB_EmployeeCheckOut.EmployeeNo;
                mTB_Charging.ChargeContent        = sChargeContent;
                mTB_Charging.Money                = dMoney;
                mTB_Charging.AirConditionFee      = sAirConditionFee;
                mTB_Charging.AirConditionFeeMoney = dAirConditionFeeMoney;
                mTB_Charging.RoomKeyFee           = sRoomKeyFee;
                mTB_Charging.RoomKeyFeeMoney      = dRoomKeyFeeMoney;
                mTB_Charging.OtherFee             = sOtherFee;
                mTB_Charging.OtherFeeMoney        = dOtherFeeMoney;
                mTB_Charging.SiteID               = mTB_EmployeeCheckOut.SiteID;
                mTB_Charging.Creator              = mTB_EmployeeCheckOut.Creator;
                mTB_Charging.BU = mTB_EmployeeCheckOut.BU;
                mChargingBLL.Add(mTB_Charging, _tran);

                //提交事务
                _tran.Commit();
                bSuccess = true;
            }
            catch (Exception ex)
            {
                //回滚事务
                _tran.Rollback();
                throw ex;
            }
            finally
            {
                //关闭连接
                _connection.Close();
            }

            if (bSuccess && bCanLeave)
            {
                SigningExitForEM(-1, mTB_EmployeeCheckOut.EmployeeNo, dSum);
            }
        }
コード例 #15
0
ファイル: EmployeeCheckInBLL.cs プロジェクト: radtek/DMdm
        private bool CheckOutBatch_part(DataRow rImp)
        {
            var bSuccess  = false;
            var dtCheckIn = _mTB_EmployeeCheckInDAL.GetByWorkID(DataTableHelper.TryGet(rImp, "工号"),
                                                                DataTableHelper.TryGet(rImp, "身份证号码"));

            if (DataTableHelper.IsEmptyDataTable(dtCheckIn))
            {
                return(false);
            }

            bool    bCanLeave = false;
            decimal?dSum      = null;
            var     sWorkID   = string.Empty;

            //启用事务
            using (_tran = _connection.BeginTransaction())
            {
                try
                {
                    var sReason   = DataTableHelper.TryGet(rImp, "退房原因");
                    var sRemark   = DataTableHelper.TryGet(rImp, "备注");
                    var sCanLeave = DataTableHelper.TryGet(rImp, "同步签退离职系统");

                    //添加退房记录
                    var mTB_EmployeeCheckOut = new TB_EmployeeCheckOut();
                    mTB_EmployeeCheckOut.BedID        = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BedID]);
                    mTB_EmployeeCheckOut.BU           = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BU] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BU].ToString();
                    mTB_EmployeeCheckOut.BUID         = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BUID] is DBNull ? 0 : Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_BUID]);
                    mTB_EmployeeCheckOut.CardNo       = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CardNo] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CardNo].ToString();
                    mTB_EmployeeCheckOut.CheckInDate  = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CheckInDate] is DBNull ? DateTime.Now : Convert.ToDateTime(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_CheckInDate]);
                    mTB_EmployeeCheckOut.CheckOutDate = DateTime.Now;
                    mTB_EmployeeCheckOut.Company      = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Company] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Company].ToString();
                    mTB_EmployeeCheckOut.Creator      = SessionHelper.Get(HttpContext.Current, TypeManager.User) == null ? ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).Account : ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ADAccount;
                    sWorkID = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeNo] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeNo].ToString();
                    mTB_EmployeeCheckOut.EmployeeNo = sWorkID;
                    mTB_EmployeeCheckOut.IsSmoking  = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_IsSmoking] is DBNull ? false : Convert.ToBoolean(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_IsSmoking]);
                    mTB_EmployeeCheckOut.Name       = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Name] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Name].ToString();
                    mTB_EmployeeCheckOut.Province   = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Province] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Province].ToString();
                    mTB_EmployeeCheckOut.RoomID     = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_RoomID]);
                    mTB_EmployeeCheckOut.Sex        = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Sex] is DBNull ? 0 : Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Sex]);
                    mTB_EmployeeCheckOut.SiteID     = Convert.ToInt32(dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_SiteID]);
                    mTB_EmployeeCheckOut.Telephone  = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Telephone] is DBNull ? string.Empty : dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_Telephone].ToString();
                    mTB_EmployeeCheckOut.Reason     = sReason == "" ? string.Empty : sReason;
                    mTB_EmployeeCheckOut.Remark     = sRemark == "" ? string.Empty : sRemark;
                    bCanLeave = (0 == string.Compare(sCanLeave, "是", true));
                    mTB_EmployeeCheckOut.CanLeave         = bCanLeave ? 1 : 0;
                    mTB_EmployeeCheckOut.EmployeeTypeName = dtCheckIn.Rows[0][TB_EmployeeCheckIn.col_EmployeeTypeName].ToString();

                    //调房--分配到未入住区域
                    //if (sReason.Contains("调房"))
                    //{
                    //    TB_AssignDormArea tB_AssignDormArea = new TB_AssignDormArea();
                    //    tB_AssignDormArea.DormAreaID = Convert.ToInt32(sReason.Split('#')[1]);
                    //    tB_AssignDormArea.CardNo = dtCheckIn.Rows[0]["CardNo"].ToString();
                    //    tB_AssignDormArea.EmployeeNo = dtCheckIn.Rows[0]["EmployeeNo"].ToString();
                    //    tB_AssignDormArea.CreateUser = SessionHelper.Get(HttpContext.Current, TypeManager.User) == null ? ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).Account : ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).ADAccount;
                    //    tB_AssignDormArea.CreateDate = System.DateTime.Now;
                    //    new AssignRoomBLL().AssignArea(tB_AssignDormArea);
                    //    sReason = sReason.Split('#')[0];
                    //}

                    _mTB_EmployeeCheckOutDAL.Create(mTB_EmployeeCheckOut, _tran, _db);

                    //更新床位状态
                    _mTB_BedDAL.Update(mTB_EmployeeCheckOut.BedID, _tran, _db, TypeManager.BedStatus.Free);
                    //删除入住信息
                    int intID = (int)dtCheckIn.Rows[0]["ID"];
                    _mTB_EmployeeCheckInDAL.Delete(intID, _tran, _db);

                    //添加扣费记录
                    ChargingBLL mChargingBLL = new ChargingBLL();
                    TB_Charging mTB_Charging = new TB_Charging();
                    mTB_Charging.Name          = mTB_EmployeeCheckOut.Name;
                    mTB_Charging.EmployeeNo    = mTB_EmployeeCheckOut.EmployeeNo;
                    mTB_Charging.ChargeContent = "管理费";
                    decimal num = 0.0M;
                    decimal.TryParse(DataTableHelper.TryGet(rImp, "管理费"), out num);
                    mTB_Charging.Money = num;

                    mTB_Charging.AirConditionFee = "空调费";
                    num = 0.0M;
                    decimal.TryParse(DataTableHelper.TryGet(rImp, "空调费"), out num);
                    mTB_Charging.AirConditionFeeMoney = num;

                    mTB_Charging.RoomKeyFee = "钥匙费";
                    num = 0.0M;
                    decimal.TryParse(DataTableHelper.TryGet(rImp, "钥匙费"), out num);
                    mTB_Charging.RoomKeyFeeMoney = num;

                    mTB_Charging.OtherFee = "其他费";
                    num = 0.0M;
                    decimal.TryParse(DataTableHelper.TryGet(rImp, "其他费"), out num);
                    mTB_Charging.OtherFeeMoney = num;
                    mTB_Charging.SiteID        = mTB_EmployeeCheckOut.SiteID;
                    mTB_Charging.Creator       = mTB_EmployeeCheckOut.Creator;
                    mTB_Charging.BU            = mTB_EmployeeCheckOut.BU;
                    mChargingBLL.Add(mTB_Charging, _tran);

                    dSum = mTB_Charging.Money + mTB_Charging.AirConditionFeeMoney
                           + mTB_Charging.RoomKeyFeeMoney + mTB_Charging.OtherFeeMoney; //总扣费

                    //提交事务
                    _tran.Commit();
                    bSuccess = true;
                }
                catch (Exception ex)
                {
                    //回滚事务
                    _tran.Rollback();
                    //throw ex;
                    LogManager.GetInstance().ErrorLog("批量退房失败CheckOutBatch_part", ex);
                }
            }

            if (bSuccess && bCanLeave)
            {
                SigningExitForEM(-1, sWorkID, dSum);
            }
            return(bSuccess);
        }