Ejemplo n.º 1
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExport_Click(object sender, EventArgs e)
        {
            TB_AllowanceApply    mTB_AllowanceApply    = new TB_AllowanceApply();
            TB_AllowanceApplyBLL mTB_AllowanceApplyBLL = new TB_AllowanceApplyBLL();

            mTB_AllowanceApply.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_AllowanceApply.Name       = "";
            mTB_AllowanceApply.CardNo     = this.txtScanCardNO.Text.Trim();
            mTB_AllowanceApply.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_AllowanceApply.BU         = this.txtBu.Text.Trim();
            DateTime dtCheckOut = DateTime.Now;

            if (DateTime.TryParse(this.txtHireDate.Text.Trim(), out dtCheckOut))
            {
                mTB_AllowanceApply.Hire_Date = dtCheckOut;
            }
            dtCheckOut = DateTime.Now;
            if (DateTime.TryParse(this.txtEffectiveDate.Text.Trim(), out dtCheckOut))
            {
                mTB_AllowanceApply.Effective_Date = dtCheckOut;
            }
            if (ddlEmpType.SelectedIndex > 0)
            {
                mTB_AllowanceApply.EmployeeTypeName = ddlEmpType.SelectedItem.Text;
            }

            string strFileName = mTB_AllowanceApplyBLL.Export(mTB_AllowanceApply);

            this.DownLoadFile(this.Request, this.Response, "住房津申请记录.xls", File.ReadAllBytes(strFileName), 10240000);
            //File.Delete(strFileName);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 下拉框绑定
        /// </summary>
        private void ddlBind()
        {
            TB_AllowanceApply    mTB_AllowanceApply    = new TB_AllowanceApply();
            TB_AllowanceApplyBLL mTB_AllowanceApplyBLL = new TB_AllowanceApplyBLL();

            #region 宿舍区
            this.ddlEmpType.DataValueField = "EmployeeTypeName";
            this.ddlEmpType.DataTextField  = "EmployeeTypeName";

            this.ddlEmpType.DataSource = mTB_AllowanceApplyBLL.GetAllEmployeeTypes();
            this.ddlEmpType.DataBind();
            this.ddlEmpType.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "--请选择--"
            });
            #endregion
        }
Ejemplo n.º 3
0
        private int GetAllowanceApply(string EmployeeID)
        {
            TB_AllowanceApply    mTB_AllowanceApply    = new TB_AllowanceApply();
            TB_AllowanceApplyBLL mTB_AllowanceApplyBLL = new TB_AllowanceApplyBLL();
            Pager     pager    = new Pager();
            DataTable dtSource = null;

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

            mTB_AllowanceApply.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_AllowanceApply.EmployeeNo = EmployeeID;
            mTB_AllowanceApply.Name       = "";
            mTB_AllowanceApply.CardNo     = "";
            dtSource = mTB_AllowanceApplyBLL.GetTable(mTB_AllowanceApply, ref pager);

            return(Convert.ToInt32(dtSource.Rows[0]["ID"]));
        }
Ejemplo n.º 4
0
        public bool CheckAllowanceApply(string EmployeeNo)
        {
            DataTable dt1 = new TB_AllowanceApplyBLL().GetTableByEmployeeNo(EmployeeNo);
            DataTable dt2 = new TB_AllowanceApplyCancelBLL().GetTableByEmployeeNo(EmployeeNo);

            if (dt1.Rows.Count == 0)
            {
                return(false);
            }
            else if (dt1.Rows.Count > 0 && dt2.Rows.Count == 0)
            {
                return(true);
            }
            else if (dt1.Rows.Count > 0 && dt2.Rows.Count > 0)
            {
                return(false);
            }
            return(false);
        }
Ejemplo n.º 5
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
            {
                //导入
                TB_AllowanceApplyBLL mTB_AllowanceApplyBLL = new TB_AllowanceApplyBLL();
                DataTable            dtError = mTB_AllowanceApplyBLL.Import(strFilePath);
                this.Bind(1);
                if (dtError.Rows.Count <= 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Success", "alert('导入成功!')", true);
                }
                else
                {
                    //string strFileName = Path.Combine(Server.MapPath("..\\..\\"), "report", DateTime.Now.ToString("yyMMddHHmmssms_") + "导入失败记录.xls");
                    //new ExcelHelper().RenderToExcel(dtError, strFileName);
                    //this.DownLoadFile(this.Request, this.Response, "导入失败记录.xls", File.ReadAllBytes(strFileName), 10240000);
                    //File.Delete(strFileName);
                    //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_ImpErrAllowanceApply, dtError);
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "myScript", "importComplete();", true);
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Success", "alert('部分导入成功,导入失败记录见文件')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Error", "alert('导入失败!" + ex.Message + "')", true);
            }
            finally
            {
                ViewState["FilePath"] = null;
            }
        }
Ejemplo n.º 6
0
        private void Bind(int intCurrentIndex)
        {
            TB_AllowanceApply    mTB_AllowanceApply    = new TB_AllowanceApply();
            TB_AllowanceApplyBLL mTB_AllowanceApplyBLL = new TB_AllowanceApplyBLL();
            Pager pager = new Pager();

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

            mTB_AllowanceApply.Name       = "";
            mTB_AllowanceApply.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_AllowanceApply.CardNo     = this.txtScanCardNO.Text.Trim();
            mTB_AllowanceApply.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_AllowanceApply.BU         = this.txtBu.Text.Trim();
            DateTime dtCheckOut = DateTime.Now;

            if (DateTime.TryParse(this.txtHireDate.Text.Trim(), out dtCheckOut))
            {
                mTB_AllowanceApply.Hire_Date = dtCheckOut;
            }
            dtCheckOut = DateTime.Now;
            if (DateTime.TryParse(this.txtEffectiveDate.Text.Trim(), out dtCheckOut))
            {
                mTB_AllowanceApply.Effective_Date = dtCheckOut;
            }
            if (ddlEmpType.SelectedIndex > 0)
            {
                mTB_AllowanceApply.EmployeeTypeName = ddlEmpType.SelectedItem.Text;
            }

            DataTable dt = mTB_AllowanceApplyBLL.GetTable(mTB_AllowanceApply, ref pager);

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

            this.Pager1.ItemCount    = pager.TotalRecord;
            this.Pager1.PageCount    = pager.TotalPage;
            this.Pager1.CurrentIndex = pager.CurrentPageIndex;
            this.Pager1.PageSize     = pager.PageSize;
        }
Ejemplo n.º 7
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);

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

                if (!DataTableHelper.IsEmptyDataTable(dtEmployeeInfo))
                {
                    //检查用工类型
                    var sEmpType = dtEmployeeInfo.Rows[0]["EmployeeTypeName"].ToString();
                    if (!CanApplay(sEmpType))
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('此用户用工类型为:" + sEmpType + ",不能申请住房津贴')", true);
                        return;
                    }

                    //检查是否已经申请津贴
                    TB_AllowanceApply tb_AllowanceApply = new TB_AllowanceApply();
                    tb_AllowanceApply.EmployeeNo = dtEmployeeInfo.Rows[0]["EmployeeID"].ToString();
                    tb_AllowanceApply.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
                    Pager pager = new Pager();
                    pager.CurrentPageIndex = 1;
                    pager.srcOrder         = "  ID desc";

                    DataTable dt = bll.GetTableByID(tb_AllowanceApply, ref pager);
                    if (dt.Rows.Count > 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('此用户已经申请过住房津贴,不能重复申请')", true);
                        return;
                    }

                    //检查是否有分配记录
                    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
                    {
                        TB_AllowanceApply tB_AllowanceApply = new TB_AllowanceApply();
                        tB_AllowanceApply.EmployeeNo       = dtEmployeeInfo.Rows[0]["EmployeeID"].ToString();
                        tB_AllowanceApply.Name             = dtEmployeeInfo.Rows[0]["ChineseName"].ToString();
                        tB_AllowanceApply.CardNo           = sIdCard;
                        tB_AllowanceApply.Sex              = dtEmployeeInfo.Rows[0]["Sex"].ToString();
                        tB_AllowanceApply.Company          = "";
                        tB_AllowanceApply.BU               = dtEmployeeInfo.Rows[0]["SegmentName"].ToString();
                        tB_AllowanceApply.Grade            = 0;
                        tB_AllowanceApply.CheckOutDate     = GetCheckOutDate(tB_AllowanceApply.EmployeeNo);
                        tB_AllowanceApply.EmployeeTypeName = dtEmployeeInfo.Rows[0]["EmployeeTypeName"].ToString();
                        tB_AllowanceApply.CreateUser       = (base.UserInfo == null ? base.SystemAdminInfo.Account : base.UserInfo.ADAccount);
                        tB_AllowanceApply.CreateDate       = System.DateTime.Now;
                        tB_AllowanceApply.SiteID           = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
                        tB_AllowanceApply.Hire_Date        = Convert.ToDateTime(dtEmployeeInfo.Rows[0]["Hire_Date"]);
                        tB_AllowanceApply.Effective_Date   = DateTime.Now.AddDays(1 - DateTime.Now.Day).AddMonths(1).AddHours(-DateTime.Now.Hour + 1).AddMinutes(-DateTime.Now.Minute).AddSeconds(-DateTime.Now.Second);
                        bll.ADDAllowanceApply(tB_AllowanceApply);

                        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();
            }
        }
Ejemplo n.º 8
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);

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

                TB_AllowanceApplyCancelBLL bll = new TB_AllowanceApplyCancelBLL();
                if (!DataTableHelper.IsEmptyDataTable(dtEmployeeInfo))
                {
                    //检查是否已经申请津贴
                    TB_AllowanceApply tb_AllowanceApply = new TB_AllowanceApply();
                    tb_AllowanceApply.EmployeeNo = dtEmployeeInfo.Rows[0]["EmployeeID"].ToString();
                    tb_AllowanceApply.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
                    Pager pager = new Pager();
                    pager.CurrentPageIndex = 1;
                    pager.srcOrder         = "  ID desc";

                    DataTable dt = new TB_AllowanceApplyBLL().GetTableByID(tb_AllowanceApply, ref pager);
                    if (dt.Rows.Count == 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('此用户未申请过住房津贴,不能申请取消津贴')", true);
                        return;
                    }

                    //检查是否已经申请津贴
                    TB_AllowanceApplyCancel tb_AllowanceApplyCancel = new TB_AllowanceApplyCancel();
                    tb_AllowanceApplyCancel.EmployeeNo = dtEmployeeInfo.Rows[0]["EmployeeID"].ToString();
                    tb_AllowanceApplyCancel.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);


                    DataTable dt1 = bll.GetTableByID(tb_AllowanceApplyCancel, ref pager);
                    if (dt1.Rows.Count > 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "msg", "alert('此用户已经申请过取消住房津贴,不能重复申请')", true);
                        return;
                    }

                    //检查是否已经有CheckIn的记录
                    TB_AllowanceApplyCancel tB_AllowanceApplyCancel = new TB_AllowanceApplyCancel();
                    tB_AllowanceApplyCancel.EmployeeNo       = dtEmployeeInfo.Rows[0]["EmployeeID"].ToString();
                    tB_AllowanceApplyCancel.Name             = dtEmployeeInfo.Rows[0]["ChineseName"].ToString();
                    tB_AllowanceApplyCancel.CardNo           = sIdCard;
                    tB_AllowanceApplyCancel.Sex              = dtEmployeeInfo.Rows[0]["Sex"].ToString();
                    tB_AllowanceApplyCancel.Company          = "";
                    tB_AllowanceApplyCancel.BU               = dtEmployeeInfo.Rows[0]["SegmentName"].ToString();
                    tB_AllowanceApplyCancel.Grade            = 0;
                    tB_AllowanceApplyCancel.AlloWanceApplyID = GetAllowanceApply(tB_AllowanceApplyCancel.EmployeeNo);
                    tB_AllowanceApplyCancel.EmployeeTypeName = dtEmployeeInfo.Rows[0]["EmployeeTypeName"].ToString();
                    tB_AllowanceApplyCancel.CreateUser       = (base.UserInfo == null ? base.SystemAdminInfo.Account : base.UserInfo.ADAccount);
                    tB_AllowanceApplyCancel.CreateDate       = System.DateTime.Now;
                    tB_AllowanceApplyCancel.SiteID           = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
                    tB_AllowanceApplyCancel.Hire_Date        = Convert.ToDateTime(dtEmployeeInfo.Rows[0]["Hire_Date"]);
                    tB_AllowanceApplyCancel.Effective_Date   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                    bll.ADDAllowanceCancelApply(tB_AllowanceApplyCancel);



                    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();
            }
        }