Esempio n. 1
0
        protected void gvPrices_RowUpdate(object sender, GridViewUpdateEventArgs e)
        {
            int         index   = e.RowIndex;
            GridViewRow row     = gvPrices.Rows[index];
            Int64       PriceId = Int64.Parse(gvPrices.DataKeys[index].Value.ToString());
            TextBox     tb      = (TextBox)row.Cells[0].FindControl("txtPriceName");

            if (tb.Text == "")
            {
                Master.MessageCenter.DisplayErrorMessage(PricesStrings.GetText(@"PriceNameRequired"));
                return;
            }
            PriceFilter p = PriceFilter.FetchByName(tb.Text);

            if (p != null && p.PriceId != PriceId)
            {
                Master.MessageCenter.DisplayErrorMessage(PricesStrings.GetText(@"MessageSaveFailedNameAlreadyExists"));
                return;
            }

            p           = PriceFilter.FetchByID(PriceId);
            p.PriceName = tb.Text;
            p.Save();

            gvPrices.EditIndex = -1;

            LoadItems();
        }
Esempio n. 2
0
        protected void gvPrices_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (!e.CommandName.Equals("AddNew"))
            {
                return;
            }

            GridViewRow row = gvPrices.FooterRow;
            TextBox     tb  = (TextBox)row.FindControl("txtNewPriceName");

            if (tb.Text == "")
            {
                Master.MessageCenter.DisplayErrorMessage(PricesStrings.GetText(@"PriceNameRequired"));
                return;
            }
            if (PriceFilter.FetchByName(tb.Text) != null)
            {
                Master.MessageCenter.DisplayErrorMessage(PricesStrings.GetText(@"MessageSaveFailedNameAlreadyExists"));
                return;
            }
            PriceFilter p = new PriceFilter();

            p.PriceName = tb.Text;
            p.Save();

            LoadItems();
        }
Esempio n. 3
0
        protected void gvPrices_RowDelete(object sender, GridViewDeleteEventArgs e)
        {
            int   index   = e.RowIndex;
            Int64 PriceId = Int64.Parse(gvPrices.DataKeys[index].Value.ToString());

            Query qry = new Query(ProductYad2.TableSchema)
                        .Where(ProductYad2.Columns.PriceId, PriceId);

            if (qry.GetCount() > 0)
            {
                Master.MessageCenter.DisplayErrorMessage(PricesStrings.GetText(@"MessageDeleteFailedInUse"));
                return;
            }
            PriceFilter.Delete(PriceId);
            LoadItems();
        }
Esempio n. 4
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     Master.PageTitle  = PricesStrings.GetText(@"PricesPageTitle");
     Master.ActiveMenu = "Prices";
 }