예제 #1
0
        private void Bind(int intCurrentIndex)
        {
            TB_Charging mTB_Charging = new TB_Charging();
            ChargingBLL mChargingBLL = new ChargingBLL();
            Pager       pager        = new Pager();
            DataTable   dtSource     = null;

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

            mTB_Charging.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_Charging.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_Charging.Name       = this.txtName.Text.Trim();
            mTB_Charging.BU         = GetSelectedBu(); //this.txtBu.Text.Trim();
            DateTime dtVal = DateTime.Now;

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_Charging.CreateTimeBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_Charging.CreateTimeEnd = dtVal;
            }

            dtSource             = mChargingBLL.GetPagerData(mTB_Charging, 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;
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["edit"].ToString() == "true")
                {
                    ChargingBLL mChargingBLL = new ChargingBLL();
                    TB_Charging mTB_Charging = new TB_Charging();
                    mTB_Charging.ID                   = Convert.ToInt32(Request.QueryString["id"].ToString());
                    mTB_Charging.Name                 = this.txtName.Text;
                    mTB_Charging.EmployeeNo           = this.txtEmployeeNo.Text;
                    mTB_Charging.ChargeContent        = this.txtChargeContent.Text;
                    mTB_Charging.Money                = this.txtMoney.Text.Length > 0 ? Convert.ToDecimal(txtMoney.Text) : 0;
                    mTB_Charging.AirConditionFee      = this.txtAirConditionFee.Text;
                    mTB_Charging.AirConditionFeeMoney = this.txtAirConditionFeeMoney.Text.Length > 0 ? Convert.ToDecimal(this.txtAirConditionFeeMoney.Text) : 0;
                    mTB_Charging.RoomKeyFee           = this.txtRoomKeyFee.Text;
                    mTB_Charging.RoomKeyFeeMoney      = this.txtRoomKeyFeeMoney.Text.Length > 0 ? Convert.ToDecimal(this.txtRoomKeyFeeMoney.Text) : 0;
                    mTB_Charging.OtherFee             = this.txtOtherFee.Text;
                    mTB_Charging.OtherFeeMoney        = this.txtOtherFeeMoney.Text.Length > 0 ? Convert.ToDecimal(this.txtOtherFeeMoney.Text) : 0;
                    mTB_Charging.SiteID               = base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID;
                    mTB_Charging.UpdateBy             = base.UserInfo == null ? base.SystemAdminInfo.Account : base.UserInfo.ADAccount;
                    mTB_Charging.BU                   = this.ddlBU.SelectedValue;
                    mChargingBLL.Edit(mTB_Charging);
                }
                else
                {
                    ChargingBLL mChargingBLL = new ChargingBLL();
                    TB_Charging mTB_Charging = new TB_Charging();
                    mTB_Charging.Name                 = this.txtName.Text;
                    mTB_Charging.EmployeeNo           = this.txtEmployeeNo.Text;
                    mTB_Charging.ChargeContent        = this.txtChargeContent.Text;
                    mTB_Charging.Money                = this.txtMoney.Text.Length > 0 ? Convert.ToDecimal(txtMoney.Text) : 0;
                    mTB_Charging.AirConditionFee      = this.txtAirConditionFee.Text;
                    mTB_Charging.AirConditionFeeMoney = this.txtAirConditionFeeMoney.Text.Length > 0 ? Convert.ToDecimal(this.txtAirConditionFeeMoney.Text) : 0;
                    mTB_Charging.RoomKeyFee           = this.txtRoomKeyFee.Text;
                    mTB_Charging.RoomKeyFeeMoney      = this.txtRoomKeyFeeMoney.Text.Length > 0 ? Convert.ToDecimal(this.txtRoomKeyFeeMoney.Text) : 0;
                    mTB_Charging.OtherFee             = this.txtOtherFee.Text;
                    mTB_Charging.OtherFeeMoney        = this.txtOtherFeeMoney.Text.Length > 0 ? Convert.ToDecimal(this.txtOtherFeeMoney.Text) : 0;
                    mTB_Charging.SiteID               = base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID;
                    mTB_Charging.Creator              = base.UserInfo == null ? base.SystemAdminInfo.Account : base.UserInfo.ADAccount;
                    mTB_Charging.BU = this.ddlBU.SelectedValue;
                    mChargingBLL.Add(mTB_Charging, null);
                }

                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>saveComplete();</script>");
            }
            catch (Exception ex)
            {
                LogManager.GetInstance().ErrorLog(ex.Message);
            }
        }
예제 #3
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  = "本月调房已收管理费";
                }
            }
        }
예제 #4
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();
                ChargingBLL mChargingBLL = new ChargingBLL();
                var         sErr         = string.Empty;
                DataTable   dtError      = mChargingBLL.Import(strFilePath, out sErr);
                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_ImpErrCharing, dtError);
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "myScript", "importComplete();", true);
                    var sAlert = string.Format("alert(\"部分导入成功,导入失败记录见文件 {0}\")", sErr);
                    ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Success", sAlert, true);
                }
            }
            catch
            {
                ScriptManager.RegisterClientScriptBlock(this.UpdatePanel1, this.GetType(), "Error", "alert('导入失败!')", true);
            }
            finally
            {
                ViewState["FilePath"] = null;
            }
        }
예제 #5
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            TB_Charging mTB_Charging = new TB_Charging();

            mTB_Charging.SiteID     = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID);
            mTB_Charging.EmployeeNo = this.txtWorkDayNo.Text.Trim();
            mTB_Charging.Name       = this.txtName.Text.Trim();
            mTB_Charging.BU         = GetSelectedBu(); // this.txtBu.Text.Trim();
            DateTime dtVal = DateTime.Now;

            if (DateTime.TryParse(this.txtStartDay.Text.Trim(), out dtVal))
            {
                mTB_Charging.CreateTimeBegin = dtVal;
            }
            if (DateTime.TryParse(this.txtEndDay.Text.Trim(), out dtVal))
            {
                mTB_Charging.CreateTimeEnd = dtVal;
            }

            string strFileName = new ChargingBLL().Export(mTB_Charging);

            this.DownLoadFile(this.Request, this.Response, "扣费记录.xls", File.ReadAllBytes(strFileName), 10240000);
            //File.Delete(strFileName);
        }