Beispiel #1
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExport_Click(object sender, EventArgs e)
        {
            TB_EmployeeCheckIn mTB_EmployeeCheckIn = new TB_EmployeeCheckIn();
            EmployeeCheckInBLL mEmployeeCheckInBLL = new EmployeeCheckInBLL();

            mTB_EmployeeCheckIn.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_EmployeeCheckIn.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_EmployeeCheckIn.Name       = this.txtName.Text.Trim();
            mTB_EmployeeCheckIn.CardNo     = this.txtScanCardNO.Text.Trim();
            mTB_EmployeeCheckIn.BUID       = Convert.ToInt32(Request.Form[this.ddlBuildingName.UniqueID.ToString()]);
            mTB_EmployeeCheckIn.BU         = GetSelectedBu();//this.txtBu.Text.Trim();
            mTB_EmployeeCheckIn.Telephone  = this.txtMobile.Text.Trim();

            DateTime dtVal = DateTime.Now;

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckIn.CheckInDateBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckIn.CheckInDateEnd = dtVal;
            }

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

            string strFileName = mEmployeeCheckInBLL.Export(mTB_EmployeeCheckIn, iDormAreaID, iRoomTypeID, sRoomName);

            this.DownLoadFile(this.Request, this.Response, "入住记录.xls", File.ReadAllBytes(strFileName), 10240000);
            //File.Delete(strFileName);
        }
Beispiel #2
0
        //2019-02-14
        //导出无工号人员
        protected void btnExportNullEmpID_Click(object sender, EventArgs e)
        {
            var    mEmployeeCheckInBLL = new EmployeeCheckInBLL();
            string strFileName         = mEmployeeCheckInBLL.ExportNullEmpID();

            this.DownLoadFile(this.Request, this.Response, "没有工号入住记录.xls", File.ReadAllBytes(strFileName), 10240000);
        }
        private void ImportToDB(string fileName)
        {
            var       checkInBll = new EmployeeCheckInBLL();
            DataTable dtErr      = null;
            int       nSuccess   = 0;

            if (checkInBll.CheckOutBatch(fileName, out nSuccess, out dtErr))
            {
                var str = string.Format("批量退房,{0}人成功", nSuccess);
                ShowMessage(str, true);
                hidFailXls.Value = "";
                return;
            }
            else
            {
                var nFailed = (dtErr == null) ? 0 : dtErr.Rows.Count;
                if (nFailed > 0)
                {
                    EmployeeCheckInBLL mEmployeeCheckInBLL = new EmployeeCheckInBLL();
                    string             strFileName         = mEmployeeCheckInBLL.Export(dtErr, "批量退房失败");
                    btnDownFails.Enabled = true;
                    hidFailXls.Value     = strFileName;
                    //this.DownLoadFile(this.Request, this.Response, Path.GetFileName(strFileName), File.ReadAllBytes(strFileName), 10240000);
                }
                var str = string.Format("批量退房,{0}人成功,{1}人失败", nSuccess, nFailed);
                ShowMessage(str, false);
            }
        }
Beispiel #4
0
        private void Bind(int intCurrentIndex)
        {
            TB_EmployeeCheckIn mTB_EmployeeCheckIn = new TB_EmployeeCheckIn();
            EmployeeCheckInBLL mEmployeeCheckInBLL = new EmployeeCheckInBLL();
            Pager     pager    = new Pager();
            DataTable dtSource = null;

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

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

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckIn.CheckInDateBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckIn.CheckInDateEnd = dtVal;
            }

            dtSource = mEmployeeCheckInBLL.GetPagerData(mTB_EmployeeCheckIn, 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;
        }
 public DataTable GetEmployeeInfoByEmployeeNo(string strEmployeeNo)
 {
     if (!String.IsNullOrEmpty(strEmployeeNo))
     {
         Pager     pager = null;
         DataTable dt    = new EmployeeCheckInBLL().GetPagerData(new TB_EmployeeCheckIn {
             EmployeeNo = strEmployeeNo
         }, ref pager);
         return(dt);
     }
     else
     {
         return(null);
     }
 }
Beispiel #6
0
        void CheckIsCharging(int checkinID)
        {
            EmployeeCheckInBLL bll         = new EmployeeCheckInBLL();
            DataTable          dt          = bll.GetCheckInDateByID(checkinID);
            ChargingBLL        chargingbll = new ChargingBLL();
            DataTable          dtCharging  = chargingbll.GetTableMonthByEmployeeNo(dt.Rows[0]["EmployeeNo"].ToString());

            if (dtCharging.Rows.Count > 0)
            {
                if (Convert.ToInt32(dtCharging.Rows[0]["Money"]) > 0)
                {
                    ckGLF.Checked  = false;
                    ckGLF.Disabled = true;
                    txtMoney.Text  = "本月调房已收管理费";
                }
            }
        }
Beispiel #7
0
        private void Bind(int intCurrentIndex)
        {
            TB_EmployeeCheckIn mTB_EmployeeCheckIn = new TB_EmployeeCheckIn();
            EmployeeCheckInBLL mEmployeeCheckInBLL = new EmployeeCheckInBLL();
            Pager     pager    = new Pager();
            DataTable dtSource = null;

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

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

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

            DateTime dtVal = DateTime.Now;

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckIn.CheckInDateBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_EmployeeCheckIn.CheckInDateEnd = dtVal;
            }

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

            dtSource             = mEmployeeCheckInBLL.GetPagerData(mTB_EmployeeCheckIn, 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;
        }
Beispiel #8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                TB_EmployeeCheckIn mTB_EmployeeCheckIn = new TB_EmployeeCheckIn();
                EmployeeCheckInBLL mEmployeeCheckInBLL = new EmployeeCheckInBLL();
                mTB_EmployeeCheckIn.ID               = Convert.ToInt32(Request.QueryString["id"].ToString());
                mTB_EmployeeCheckIn.EmployeeNo       = txtEmployeeNo.Text.Trim();
                mTB_EmployeeCheckIn.BU               = txtBU.Text;
                mTB_EmployeeCheckIn.EmployeeTypeName = txtEmployeeType.Text;
                mTB_EmployeeCheckIn.CheckInDate      = Convert.ToDateTime(txtCheckinDate.Text);
                mTB_EmployeeCheckIn.Telephone        = txtPhone.Text;
                mEmployeeCheckInBLL.EditTB_EmployeeCheckIn(mTB_EmployeeCheckIn);

                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>saveComplete();</script>");
            }
            catch (Exception ex)
            {
                LogManager.GetInstance().ErrorLog(ex.Message);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnImport_Click(object sender, EventArgs e)
        {
            string strFilePath = ViewState["FilePath"] as String;

            if (string.IsNullOrEmpty(strFilePath))
            {
                ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Error", "alert('请先上传需要导入的文件!')", true);
                return;
            }
            try
            {
                //导入
                EmployeeCheckInBLL mEmployeeCheckInBLL = new EmployeeCheckInBLL();
                DataTable          dtError             = mEmployeeCheckInBLL.Import(strFilePath);
                this.Bind(1);
                if (dtError.Rows.Count <= 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Success", "alert('导入成功!')", true);
                }
                else
                {
                    //Cache mCache = new Cache(this.UserInfo == null ? this.SystemAdminInfo.Account : this.UserInfo.ADAccount, (this.UserInfo == null ? this.SystemAdminInfo.SiteID : this.UserInfo.SiteID) + "dtError");
                    //mCache.SetCache(dtError);
                    SessionHelper.Set(HttpContext.Current, TypeManager.SESSIONKEY_ImpErrCheckIn, dtError);
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "myScript", "importComplete();", true);
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Success", "alert('部分导入成功,导入失败记录见文件')", true);
                }
            }
            catch (Exception ex)
            {
                var sErr = string.Format("alert(\"导入失败!{0}\")", ex.Message);
                sErr = sErr.Replace("\r\n", "");
                ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Error", sErr, true);
            }
            finally
            {
                ViewState["FilePath"] = null;
            }
        }