Пример #1
0
        public void ApplyDorm(List <string> mKeys, string sHandlerWorkdayNo, string sEnName, string sDormAreaID, string sHandle, string sMsg)
        {
            var assignArea = new AssignRoomBLL();

            foreach (var k in mKeys)
            {
                var dtAppInfo  = _mDAL.GetApplyDormByID(k);
                var dr         = dtAppInfo.Rows[0];
                var sWorkdayNo = dr["EmployeeNo"] as string;

                if ("1" == sHandle)
                {
                    TB_AssignDormArea tB_AssignDormArea = new TB_AssignDormArea();
                    tB_AssignDormArea.DormAreaID = Convert.ToInt32(sDormAreaID);
                    tB_AssignDormArea.CardNo     = dr["CardNo"] as string;
                    tB_AssignDormArea.EmployeeNo = sWorkdayNo;
                    tB_AssignDormArea.CreateUser = sHandlerWorkdayNo;
                    tB_AssignDormArea.CreateDate = System.DateTime.Now;

                    if (assignArea.AssignArea(tB_AssignDormArea))
                    {
                        _mDAL.HandleApplyDorm(k, sEnName, sHandle, sMsg);
                    }
                }
                else
                {
                    _mDAL.HandleApplyDorm(k, sEnName, sHandle, sMsg);
                }
                MessageBLL.SendJpush(sWorkdayNo, "宿舍申请", "宿舍申请", sMsg, "msg");
            }
        }
Пример #2
0
        public int AddAssignDormInfo(TB_AssignDormArea info)
        {
            Database  db = DBO.GetInstance();
            DbCommand dbCommandWrapper = null;
            int       intId;
            string    strInsertSql   = @"INSERT INTO [TB_AssignDormArea] ([DormAreaID]
      ,[CardNo],[EmployeeNo],[CreateUser],[CreateDate]) VALUES(@DormAreaID,@CardNo,@EmployeeNo,@CreateUser,@CreateDate)";
            string    strSelectIdSql = ";SELECT SCOPE_IDENTITY()";

            try
            {
                dbCommandWrapper = db.GetSqlStringCommand(strInsertSql + strSelectIdSql);
                #region Add parameters
                db.AddInParameter(dbCommandWrapper, "@DormAreaID", DbType.Int32, info.DormAreaID);
                db.AddInParameter(dbCommandWrapper, "@CardNo", DbType.String, info.CardNo);
                db.AddInParameter(dbCommandWrapper, "@EmployeeNo", DbType.String, info.EmployeeNo);
                db.AddInParameter(dbCommandWrapper, "@CreateUser", DbType.String, info.CreateUser);
                db.AddInParameter(dbCommandWrapper, "@CreateDate", DbType.DateTime, info.CreateDate);
                #endregion
                intId = Convert.ToInt32(db.ExecuteScalar(dbCommandWrapper));
                return(intId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dbCommandWrapper != null)
                {
                    dbCommandWrapper = null;
                }
            }
        }
Пример #3
0
        public bool AssignArea(TB_AssignDormArea tB_AssignDormArea)
        {
            try
            {
                //添加宿舍分配记录
                int i = _mTB_AssignRoomDAL.AddAssignDormInfo(tB_AssignDormArea);

                if (i > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
        }
Пример #4
0
        protected void btnAssign_Click(object sender, EventArgs e)
        {
            try
            {
                var    sInputID   = this.txtScanCardNO.Text.Trim();
                var    sWorkDayNO = this.txtWorkDayNo.Text.Trim();
                string sIdCard    = string.Empty;
                GetIdCardNumber(sInputID, sWorkDayNO, out sIdCard);

                //获取选中的ID
                string areaID = selAreaID.Value;
                //查询room信息
                //DataTable dt = ViewState["dtDormArea"] as DataTable;
                //DataRow[] drAssignAreaArr = dt.Select("ID=" + areaID + "");

                //查询人员信息
                DataTable dtEmployeeInfo = new StaffingBLL().GetTableWithIDL(sWorkDayNO, sIdCard);

                if (!DataTableHelper.IsEmptyDataTable(dtEmployeeInfo))
                {
                    //检查是否有分配记录
                    DataTable dtAssignArea = new AssignRoomBLL().GetAssignDormArea(dtEmployeeInfo.Rows[0]["IDCardNumber"].ToString());
                    if (dtAssignArea.Rows.Count > 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('此用户已有分配记录!')", true);
                        return;
                    }

                    //检查是否已经有CheckIn的记录
                    DataTable DtCheck = new AssignRoomBLL().GetAssignedData(dtEmployeeInfo.Rows[0]["IDCardNumber"].ToString(), "");
                    if (DtCheck != null && DtCheck.Rows.Count > 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('此用户已有入住记录!')", true);
                    }
                    else
                    {
                        var dr = dtEmployeeInfo.Rows[0];
                        TB_AssignDormArea tB_AssignDormArea = new TB_AssignDormArea();
                        tB_AssignDormArea.DormAreaID = Convert.ToInt32(areaID);
                        tB_AssignDormArea.CardNo     = string.IsNullOrEmpty(sIdCard) ? dr["IDCardNumber"].ToString() : sIdCard;
                        tB_AssignDormArea.EmployeeNo = dr["EmployeeID"].ToString();
                        tB_AssignDormArea.CreateUser = (base.UserInfo == null ? base.SystemAdminInfo.Account : base.UserInfo.ADAccount);
                        tB_AssignDormArea.CreateDate = System.DateTime.Now;

                        new AssignRoomBLL().AssignArea(tB_AssignDormArea);

                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('分配成功!')", true);
                        this.Bind(1);
                        if (dtEmployeeInfo.Rows[0]["Phone"].ToString() != "")
                        {
                            //string sContent = dtEmployeeInfo.Rows[0]["EmployeeID"].ToString() + "亲,以下是你被分配的宿舍信息:" + sDormAreaName + "宿舍 " + sBuildingName + "栋 " + sRoomName + "房间 " + sBedName + "床.  该宿舍的服务热线18926980019,请于3天内前往宿舍区办理入住手续,谢谢! ";
                            try
                            {
                                //SendSMS(dtEmployeeInfo.Rows[0]["Phone"].ToString(), sContent);
                            }
                            catch
                            {
                                return;
                            }
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('招聘系统找不到此用户!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('" + ex.Message + "')", true);
            }
            finally
            {
                ClearWorkIDInput();
            }
        }
Пример #5
0
        /// <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);
            }
        }