Exemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (estimateNull() == false)
            {
                return;
            }

            if (m_yszmModel == null)
            {
                jt_ys_zm zmModel = new jt_ys_zm();
                zmModel = setModelValue(zmModel);
                bool isSuccess = BudgetAccountsManager.Instance.Add(zmModel);
                if (isSuccess)
                {
                    MessageBoxFunction.showSaveSuccessMessageBox();
                    this.DialogResult = DialogResult.OK;
                }
            }
            else
            {
                m_yszmModel = setModelValue(m_yszmModel);
                bool isSuccess = BudgetAccountsManager.Instance.Update(m_yszmModel);
                if (isSuccess)
                {
                    MessageBoxFunction.showSaveSuccessMessageBox();
                    this.DialogResult = DialogResult.OK;
                }
            }
            base.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 给对象赋值
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private jt_ys_zm setModelValue(jt_ys_zm model)
        {
            model.v_yszm_no    = this.textBoxNo.Text.Trim();
            model.f_ys_money   = this.decimalTextBoxMoney.EditValue;
            model.v_yszm_name  = this.textBoxName.Text.Trim();
            model.t_date_start = this.dateTimeStart.Value;
            model.t_date_end   = this.dateTimeEnd.Value;
            model.v_remark     = this.textBoxRemark.Text.Trim();
            if (m_yszmModel == null)
            {
                model.v_jz_user_name = LoginAccountManager.Instance.getLoginUserModel().v_yh_name;
                model.v_jz_user_pk   = LoginAccountManager.Instance.getLoginUserModel().pk.ToString();
                model.t_create_time  = this.dateTimeTallyDate.Value;
            }

            return(model);
        }
        private void buttonXModify_Click(object sender, EventArgs e)
        {
            if (this.gridViewDataList.SelectedRowsCount == 0)
            {
                MessageBox.Show("请选择一条数据!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            m_selectRow = this.gridViewDataList.FocusedRowHandle;
            // 取出pk
            int      selectRow          = this.gridViewDataList.GetSelectedRows()[0];
            int      pk                 = Convert.ToInt32(this.gridViewDataList.GetRowCellValue(selectRow, "pk").ToString());
            jt_ys_zm yszmModel          = BudgetAccountsManager.Instance.GetModel(pk);
            EditBudgetAccountsForm form = new EditBudgetAccountsForm();

            form.m_yszmModel          = yszmModel;
            form.m_budgetAccountsForm = this;
            form.ShowDialog();

            if (form.DialogResult == DialogResult.OK)
            {
                this.loadDataList();
            }
        }