Example #1
0
        // 保存
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (estimateNull() == false)
            {
                return;
            }

            if (m_zczmModel == null)
            {
                jt_zc_zm zmModel = new jt_zc_zm();
                zmModel = setModelValue(zmModel);
                bool isSuccess = ExpendAccountsManager.Instance.Add(zmModel);
                if (isSuccess)
                {
                    MessageBoxFunction.showSaveSuccessMessageBox();
                    this.DialogResult = DialogResult.OK;
                }
            }
            else
            {
                m_zczmModel = setModelValue(m_zczmModel);
                bool isSuccess = ExpendAccountsManager.Instance.Update(m_zczmModel);
                if (isSuccess)
                {
                    MessageBoxFunction.showSaveSuccessMessageBox();
                    this.DialogResult = DialogResult.OK;
                }
            }
            base.Close();
        }
Example #2
0
        /// <summary>
        /// 给对象赋值
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private jt_zc_zm setModelValue(jt_zc_zm model)
        {
            model.v_zczm_no   = this.textBoxNo.Text.Trim();
            model.f_zc_money  = this.decimalTextBoxMoney.EditValue;
            model.v_zclx_no   = this.comboBoxType.SelectedValue.ToString();
            model.v_zclx_name = this.comboBoxType.Text.ToString();
            model.t_xf_time   = this.dateTimeDate.Value;
            model.v_zczm_name = this.textBoxDescription.Text.Trim();

            model.v_who       = this.textBoxWho.Text.Trim();
            model.v_zffs_name = this.comboBoxPayType.Text.ToString();
            model.v_zffs_no   = this.comboBoxPayType.SelectedValue.ToString();
            model.v_remark    = this.richTextBoxRemark.Text.Trim();
            if (m_zczmModel == 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);
        }
Example #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_zc_zm zczmModel            = ExpendAccountsManager.Instance.GetModel(pk);
            EditSpendingAccountsForm form = new EditSpendingAccountsForm();

            form.m_zczmModel            = zczmModel;
            form.m_spendingAccountsForm = this;
            form.ShowDialog();

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