Ejemplo n.º 1
0
        void UCBankAccountAddOrEdit_StatusEvent(object sender, EventArgs e)
        {
            if (!MessageBoxEx.ShowQuestion(string.Format("确定要{0}吗?", btnStatus.Caption)))
            {
                if (int.Parse(dr["status"].ToString()) == (int)DataSources.EnumStatus.Start)
                {
                    btnStatus.Caption = "启用";
                }
                else
                {
                    btnStatus.Caption = "停用";
                }
                return;
            }

            if (StatusSql())
            {
                MessageBoxEx.ShowInformation(btnStatus.Caption + "成功!");
                uc.BindData(id);
                deleteMenuByTag(this.Tag.ToString(), this.uc.Name);
            }
            else
            {
                MessageBoxEx.ShowError(btnStatus.Caption + "失败!");
                if (int.Parse(dr["status"].ToString()) == (int)DataSources.EnumStatus.Start)
                {
                    btnStatus.Caption = "启用";
                }
                else
                {
                    btnStatus.Caption = "停用";
                }
            }
        }
Ejemplo n.º 2
0
        void Save()
        {
            string bankAccount = txtBankAccount.Caption.Trim();

            if (bankAccount.Length == 0)
            {
                MessageBoxEx.Show("请输入银行账户!");
                txtBankAccount.Focus();
                return;
            }
            string bankName = txtBankName.Caption.Trim();

            if (bankName.Length == 0)
            {
                MessageBoxEx.Show("请输入银行名称!");
                txtBankName.Focus();
                return;
            }
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("bank_name", bankName);
            dic.Add("bank_account", bankAccount);
            dic.Add("status", rboEnable.Checked ? "1" : "0");
            //判断窗体状态
            if (windowStatus == WindowStatus.Add || windowStatus == WindowStatus.Copy)
            {
                dic.Add("bank_account_id", Guid.NewGuid().ToString());
                dic.Add("enable_flag", ((int)DataSources.EnumEnableFlag.USING).ToString());
                dic.Add("create_by", GlobalStaticObj.UserID);
                dic.Add("create_time", DateTime.UtcNow.Ticks.ToString());
                if (DBHelper.Submit_AddOrEdit("银行账户操作", "tb_bank_account", "", "", dic))
                {
                    MessageBoxEx.Show("保存成功!");
                    uc.BindData(id);
                    deleteMenuByTag(this.Tag.ToString(), this.uc.Name);
                }
                else
                {
                    MessageBoxEx.Show("保存失败!");
                }
            }
            else if (windowStatus == WindowStatus.Edit)
            {
                dic.Add("update_by", GlobalStaticObj.UserID);
                dic.Add("update_time", DateTime.UtcNow.Ticks.ToString());
                if (DBHelper.Submit_AddOrEdit("银行账户操作", "tb_bank_account", "bank_account_id", id, dic))
                {
                    MessageBoxEx.Show("修改成功!");
                    uc.BindData(id);
                    deleteMenuByTag(this.Tag.ToString(), this.uc.Name);
                }
                else
                {
                    MessageBoxEx.Show("修改失败!");
                }
            }
        }