Пример #1
0
        protected void uiGridViewDims_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditDim")
            {
                Dimension objData = new Dimension();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxWidth.Text = objData.Width.ToString();
                uiTextBoxHeight.Text = objData.Height.ToString();

                uiPanelAllCats.Visible = false;
                uiPanelEditCat.Visible = true;
                CurrentDim = objData;

                BindDims();
            }
            else if (e.CommandName == "DeleteDim")
            {
                try
                {
                    Dimension objData = new Dimension();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentDim = null;
                    BindDims();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Пример #2
0
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            Dimension dim = new Dimension();
            if (CurrentDim == null)
                dim.AddNew();
            else
                dim = CurrentDim;

            try
            {
                dim.Width = Convert.ToDecimal(uiTextBoxWidth.Text);
                dim.Height = Convert.ToDecimal(uiTextBoxHeight.Text);

            }
            catch (Exception ex)
            {
                return;
            }
            dim.Save();
            ClearFields();
            CurrentDim = null;
            uiPanelEditCat.Visible = false;
            uiPanelAllCats.Visible = true;
            BindDims();
        }