Beispiel #1
0
        protected void btnCardAddSave_Click(object sender, EventArgs e)
        {
            #region 验证
            if (string.IsNullOrEmpty(this.txtAddCardNumber.Text.Trim()))
            {
                Alert.Show(this, "请输入卡号!");
                this.txtAddCardNumber.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtAddCardOpenDate.Text.Trim()))
            {
                Alert.Show(this, "开户日期不能为空!");
                this.txtAddCardOpenDate.Focus();
                return;
            }
            #endregion

            CardInfo cardInfo = new CardInfo();

            cardInfo.BankId      = Convert.ToInt32(this.dropAddBank.SelectedValue);
            cardInfo.CardNumber  = this.txtAddCardNumber.Text.Trim();
            cardInfo.AccountType = Convert.ToInt32(this.dropCardAddAccountType.SelectedValue);
            cardInfo.OwnerId     = Convert.ToInt32(this.dropAddCardOwner.SelectedValue);
            cardInfo.OwnerCode   = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardOwner.SelectedValue)).Code;
            if (!string.IsNullOrEmpty(this.dropAddCardUser.SelectedValue))
            {
                cardInfo.UserId   = Convert.ToInt32(this.dropAddCardUser.SelectedValue);
                cardInfo.UserCode = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardUser.SelectedValue)).Code;
            }
            else
            {
                cardInfo.UserId   = 0;
                cardInfo.UserCode = string.Empty;
            }
            cardInfo.BankName = this.txtAddBankName.Text.Trim();
            cardInfo.OpenDate = Convert.ToDateTime(this.txtAddCardOpenDate.Text.Trim());
            cardInfo.Content  = this.txtCardAddContent.Text.Trim();

            int i = CardMethods.InsertOrUpdatetoCard(cardInfo);
            if (i > 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "closeWin();", true);
            }
        }
Beispiel #2
0
        private void CardEditSubmit(ref int i)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayCardAdddiv();", true);
            #region 验证
            // if (string.IsNullOrEmpty(Request.Form["txtAddCardNumber"].ToString()))
            if (string.IsNullOrEmpty(this.txtAddCardNumber.Text.Trim()))
            {
                Alert.Show(this, "请输入卡号!");
                this.txtAddCardNumber.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtAddCardOpenDate.Text.Trim()))
            {
                Alert.Show(this, "开户日期不能为空!");
                this.txtAddCardOpenDate.Focus();
                return;
            }
            #endregion

            CardInfo cardInfo = new CardInfo();

            cardInfo.BankId = Convert.ToInt32(this.dropAddBank.SelectedValue);
            //cardInfo.CardNumber = Request.Form["txtAddCardNumber"].ToString().Trim();
            cardInfo.CardNumber  = this.txtAddCardNumber.Text.Trim();
            cardInfo.AccountType = Convert.ToInt32(this.dropCardAddAccountType.SelectedValue);
            cardInfo.OwnerId     = Convert.ToInt32(this.dropAddCardOwner.SelectedValue);
            cardInfo.OwnerCode   = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardOwner.SelectedValue)).Code;
            if (!string.IsNullOrEmpty(this.dropAddCardUser.SelectedValue))
            {
                cardInfo.UserId   = Convert.ToInt32(this.dropAddCardUser.SelectedValue);
                cardInfo.UserCode = UserMethods.GetUserById(Convert.ToInt32(this.dropAddCardUser.SelectedValue)).Code;
            }
            else
            {
                cardInfo.UserId   = 0;
                cardInfo.UserCode = string.Empty;
            }
            cardInfo.BankName = this.txtAddBankName.Text.Trim();
            cardInfo.OpenDate = Convert.ToDateTime(this.txtAddCardOpenDate.Text.Trim());
            cardInfo.Content  = this.txtCardAddContent.Text.Trim();

            i = CardMethods.InsertOrUpdatetoCard(cardInfo);
        }