Ejemplo n.º 1
0
        protected void ctlBankFormView_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            short  bankId = UIHelper.ParseShort(ctlBankFormView.DataKey.Value.ToString());
            DbBank dbBank = DbBankService.FindByIdentity(bankId);

            TextBox  txtBankNo  = ctlBankFormView.FindControl("ctlTxtBankNo") as TextBox;
            TextBox  txtComment = ctlBankFormView.FindControl("ctlTxtComment") as TextBox;
            CheckBox chkActive  = ctlBankFormView.FindControl("chkActive") as CheckBox;

            dbBank.BankNo  = txtBankNo.Text;
            dbBank.Comment = txtComment.Text;
            dbBank.Active  = chkActive.Checked;

            dbBank.UpdPgm  = ProgramCode;
            dbBank.UpdDate = DateTime.Now.Date;
            dbBank.UpdBy   = UserAccount.UserID;

            try
            {
                DbBankService.SaveOrUpdate(dbBank);

                // Cancel insert with DataSource.
                e.Cancel = true;
                ctlGridBank.DataCountAndBind();
                ctlBankModalPopupExtender.Hide();
                UpdatePanelGridView.Update();
            }
            catch
            { }
            //catch ( ServiceValidationException ex)
            //{
            //    ValidationErrors.MergeErrors(ex.ValidationErrors);
            //}
        }
Ejemplo n.º 2
0
        protected void ctlGridBank_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "BankEdit")
            {
                int   rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                short bankId   = UIHelper.ParseShort(ctlGridBank.DataKeys[rowIndex].Value.ToString());

                ctlGridBank.EditIndex = rowIndex;
                IList <DbBank> bankList = new List <DbBank>();
                DbBank         bank     = DbBankService.FindByIdentity(bankId);

                bankList.Add(bank);

                ctlBankFormView.DataSource = bankList;
                ctlBankFormView.PageIndex  = 0;

                ctlBankFormView.ChangeMode(FormViewMode.Edit);
                ctlBankFormView.DataBind();

                UpdatePanelBankForm.Update();
                ctlBankModalPopupExtender.Show();
                BankLangGridViewFinish();
            }
            else if (e.CommandName == "Select")
            {
                int   rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                short bankId   = UIHelper.ParseShort(ctlGridBank.DataKeys[rowIndex].Value.ToString());

                ctlBankLangGrid.DataSource = DbBankLangService.FindByBankId(bankId);
                ctlBankLangGrid.DataBind();

                if (ctlBankLangGrid.Rows.Count > 0)
                {
                    ctlSubmit.Visible          = true;
                    ctlCancel.Visible          = true;
                    ctlBankLangLangFds.Visible = true;
                }
                else
                {
                    ctlSubmit.Visible          = false;
                    ctlCancel.Visible          = false;
                    ctlBankLangLangFds.Visible = false;
                }
                ctlBankLangUpdatePanel.Update();
            }
        }