Ejemplo n.º 1
0
        protected void ctlPaymentMethodForm_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            short    paymentMethodId      = Convert.ToInt16(ctlPaymentMethodForm.DataKey.Value);
            TextBox  ctlPaymentMethodCode = (TextBox)ctlPaymentMethodForm.FindControl("ctlPaymentMethodCode");
            TextBox  ctlPaymentMethodName = (TextBox)ctlPaymentMethodForm.FindControl("ctlPaymentMethodName");
            CheckBox ctlActiveChk         = (CheckBox)ctlPaymentMethodForm.FindControl("ctlActiveChk");

            DbPaymentMethod paymentMethod = DbPaymentMethodService.FindByIdentity(paymentMethodId);

            paymentMethod.PaymentMethodCode = ctlPaymentMethodCode.Text;
            paymentMethod.PaymentMethodName = ctlPaymentMethodName.Text;

            paymentMethod.Active  = ctlActiveChk.Checked;
            paymentMethod.CreBy   = UserAccount.UserID;
            paymentMethod.CreDate = DateTime.Now;
            paymentMethod.UpdBy   = UserAccount.UserID;
            paymentMethod.UpdDate = DateTime.Now;
            paymentMethod.UpdPgm  = ProgramCode;

            try
            {
                DbPaymentMethodService.UpdatePaymentMethod(paymentMethod);
                ctlPaymentMethodGrid.DataCountAndBind();
                ctlPaymentMethodForm.ChangeMode(FormViewMode.ReadOnly);
                ClosePaymentMethodPopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }
Ejemplo n.º 2
0
        public DbPaymentMethod GetPaymentMethodCriteria()
        {
            DbPaymentMethod paymentMethod = new DbPaymentMethod();

            paymentMethod.PaymentMethodCode = ctlPaymentMethodCodeCri.Text;
            paymentMethod.PaymentMethodName = ctlPaymentMethodNameCri.Text;
            return(paymentMethod);
        }
Ejemplo n.º 3
0
        public int RequestCount()
        {
            DbPaymentMethod paymentMethod = GetPaymentMethodCriteria();

            int count = ScgDbQueryProvider.DbPaymentMethodQuery.CountPaymentMethodByCriteria(paymentMethod);

            return(count);
        }
Ejemplo n.º 4
0
        protected void ctlPaymentMethodForm_DataBound(object sender, EventArgs e)
        {
            if (ctlPaymentMethodForm.CurrentMode != FormViewMode.ReadOnly)
            {
                TextBox ctlPaymentMethodCode = (TextBox)ctlPaymentMethodForm.FindControl("ctlPaymentMethodCode");
                ctlPaymentMethodCode.Focus();
                CheckBox ctlActiveCheck = (CheckBox)ctlPaymentMethodForm.FindControl("ctlActiveChk");

                if (ctlPaymentMethodForm.CurrentMode == FormViewMode.Edit)
                {
                    short           paymentMethodID = UIHelper.ParseShort(ctlPaymentMethodForm.DataKey.Value.ToString());
                    DbPaymentMethod paymentMethod   = DbPaymentMethodService.FindByIdentity(paymentMethodID);
                }
                if (ctlPaymentMethodForm.CurrentMode == FormViewMode.Insert)
                {
                    ctlActiveCheck.Checked = true;
                }
            }
        }
Ejemplo n.º 5
0
        protected void ctlPaymentMethodGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("PaymentMethodEdit"))
            {
                int   rowIndex        = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                short paymentMethodId = Convert.ToInt16(ctlPaymentMethodGrid.DataKeys[rowIndex].Value);
                ctlPaymentMethodForm.PageIndex = (ctlPaymentMethodGrid.PageIndex * ctlPaymentMethodGrid.PageSize) + rowIndex;
                ctlPaymentMethodForm.ChangeMode(FormViewMode.Edit);
                IList <DbPaymentMethod> paymentMethodList = new List <DbPaymentMethod>();
                DbPaymentMethod         paymentMethod     = DbPaymentMethodService.FindByIdentity(paymentMethodId);
                paymentMethodList.Add(paymentMethod);
                ctlPaymentMethodForm.DataSource = paymentMethodList;
                ctlPaymentMethodForm.DataBind();

                ctlUpdatePanelPaymentMethodForm.Update();
                ctlPaymentMethodModalPopupExtender.Show();
            }
            if (e.CommandName.Equals("PaymentMethodDelete"))
            {
                try
                {
                    int             rowIndex        = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                    long            paymentMethodId = UIHelper.ParseLong(ctlPaymentMethodGrid.DataKeys[rowIndex].Value.ToString());
                    DbPaymentMethod paymentMethod   = ScgDbQueryProvider.DbPaymentMethodQuery.FindByIdentity(paymentMethodId);
                    DbPaymentMethodService.Delete(paymentMethod);
                }
                catch (Exception ex)
                {
                    if (((System.Data.SqlClient.SqlException)(ex.GetBaseException())).Number == 547)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertInUseData",
                                                                "alert('This data is now in use.');", true);
                        ctlPaymentMethodGrid.DataCountAndBind();
                    }
                }

                ctlPaymentMethodGrid.DataCountAndBind();
                ctlUpdatePanelPaymentMethodGridview.Update();
            }
        }
Ejemplo n.º 6
0
        public Object RequestData(int startRow, int pageSize, string sortExpression)
        {
            DbPaymentMethod paymentMethod = GetPaymentMethodCriteria();

            return(ScgDbQueryProvider.DbPaymentMethodQuery.GetPaymentMethodList(paymentMethod, startRow, pageSize, sortExpression));
        }