Ejemplo n.º 1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            this.expenseGrid.CloseEditor();

            var input = CheckInput();

            if (!input.Item1)
            {
                MessageUtil.ShowError(input.Item2);
                return;
            }

            WaterExpense entity = new WaterExpense();

            SetEntity(entity);

            try
            {
                BusinessFactory <WaterExpenseBusiness> .Instance.Create(entity, this.currentUser);

                MessageUtil.ShowInfo("保存成功");
                this.Close();
            }
            catch (PoseidonException pe)
            {
                MessageUtil.ShowError(string.Format("保存失败,错误消息:{0}", pe.Message));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 显示水费支出信息
        /// </summary>
        /// <param name="entity">水费支出</param>
        private void ShowWaterExpense(WaterExpense entity)
        {
            this.txtBelongDate.Text    = entity.BelongDate.ToString("yyyy年MM月");
            this.txtTicketDate.Text    = entity.TicketDate.ToDateString();
            this.txtFeeType.Text       = DictUtility.GetDictValue(entity, "FeeType", entity.FeeType);
            this.txtTotalQuantity.Text = entity.TotalQuantity.ToString();
            this.txtTotalAmount.Text   = entity.TotalAmount.ToString();
            this.txtRemark.Text        = entity.Remark;
            this.txtCreateUser.Text    = entity.CreateBy.Name;
            this.txtCreateTime.Text    = entity.CreateBy.Time.ToDateTimeString();
            this.txtEditUser.Text      = entity.UpdateBy.Name;
            this.txtEditTime.Text      = entity.UpdateBy.Time.ToDateTimeString();

            this.waterExpRecGrid.DataSource = entity.Records;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 设置实体
        /// </summary>
        /// <param name="entity"></param>
        private void SetEntity(WaterExpense entity)
        {
            entity.AccountId     = this.currentAccount.Id;
            entity.BelongDate    = this.dpBelongDate.DateTime.Date;
            entity.TicketDate    = this.dpTicketDate.DateTime.Date;
            entity.FeeType       = Convert.ToInt32(this.cmbFeeType.EditValue);
            entity.TotalQuantity = this.spTotalQuantity.Value;
            entity.TotalAmount   = this.spTotalAmount.Value;
            entity.Remark        = this.txtRemark.Text;

            entity.Records = this.expenseGrid.DataSource;
            foreach (var item in entity.Records)
            {
                item.MeterNumber = item.MeterNumber ?? "";
                item.MeterName   = item.MeterName ?? "";
                item.Remark      = item.Remark ?? "";
            }
        }
        private void InitData(string id, string accountId)
        {
            this.currentExpense = BusinessFactory <WaterExpenseBusiness> .Instance.FindById(id);

            this.currentAccount = BusinessFactory <ExpenseAccountBusiness> .Instance.FindById(accountId);
        }