private void btnOK_Click(object sender, EventArgs e)
        {
            if (estimateNull() == false)
            {
                return;
            }

            if (m_jczmModel == null)
            {
                jt_jc_zm zmModel = new jt_jc_zm();
                zmModel = setModelValue(zmModel);
                bool isSuccess = LoanAccountsManager.Instance.Add(zmModel);
                if (isSuccess)
                {
                    MessageBoxFunction.showSaveSuccessMessageBox();
                    this.DialogResult = DialogResult.OK;
                }
            }
            else
            {
                m_jczmModel = setModelValue(m_jczmModel);
                bool isSuccess = LoanAccountsManager.Instance.Update(m_jczmModel);
                if (isSuccess)
                {
                    MessageBoxFunction.showSaveSuccessMessageBox();
                    this.DialogResult = DialogResult.OK;
                }
            }
            base.Close();
        }
        /// <summary>
        /// 给对象赋值
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private jt_jc_zm setModelValue(jt_jc_zm model)
        {
            if (model == null)
            {
                return(null);
            }
            model.v_jczm_no   = this.textBoxNo.Text.Trim();
            model.v_jc_who    = this.textBoxWho.Text.Trim();
            model.f_jc_money  = this.decimalTextBoxMoney.EditValue;
            model.t_jc_time   = this.dateTimeDate.Value;
            model.v_jczm_name = this.textBoxDescription.Text.Trim();

            model.v_jc_name      = this.textBoxWhoLoan.Text.Trim();
            model.t_gh_time      = this.dateTimeInputReturn.Value;
            model.i_gh_flag      = this.checkBoxReturn.Checked == true ?  1: 0;
            model.f_accrual      = this.tzxDecimalTextBoxAccrual.EditValue;
            model.f_gh_how_money = this.tzxDecimalTextBoxReturnMoney.EditValue;
            model.v_remark       = this.richTextBoxRemark.Text;
            if (m_jczmModel == 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);
        }
Beispiel #3
0
        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_jc_zm             zczmModel = LoanAccountsManager.Instance.GetModel(pk);
            EditLoanAccountsForm form      = new EditLoanAccountsForm();

            form.m_jczmModel = zczmModel;
            form.ShowDialog();

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