Esempio n. 1
0
        protected void uiButtonSaveText_Click(object sender, EventArgs e)
        {
            CardText txt = new CardText();
            if (CurrentTxt == null)
            {
                txt.AddNew();
                txt.CardID = CurrentCard.CardID;
            }
            else
                txt = CurrentTxt;

            txt.TextLabel = uiTextBoxTxtLabel.Text;
            int width, height, x, y;
            int.TryParse(uiTextBoxWidth.Text, out width);
            int.TryParse(uiTextBoxWidth.Text, out height);
            int.TryParse(uiTextBoxWidth.Text, out y);
            int.TryParse(uiTextBoxWidth.Text, out x);
            txt.Width = width;
            txt.Height = height;
            txt.PosX = x;
            txt.PosY = y;
            txt.IsMultiLine = uiCheckBoxIsMultiLine.Checked;
            txt.Save();
            BindCardTxt();
            ClientScript.RegisterStartupScript(this.GetType(), "selectTab", "$(document).ready(function (){ $('#myTab a[href=\"#t-2\"]').tab('show'); $('#myTab a[href=\"#t-1\"]').removeClass('active'); $('#myTab a[href=\"#t-2\"]').addClass('active'); });", true);
            CleartextFields();
            CurrentTxt = null;
        }
Esempio n. 2
0
        protected void uiGridViewCardText_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditTxt")
            {
                CardText objData = new CardText();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxTxtLabel.Text = objData.TextLabel;
                uiTextBoxWidth.Text = objData.Width.ToString();
                uiTextBoxHeight.Text = objData.Height.ToString();
                uiTextBoxX.Text = objData.PosX.ToString();
                uiTextBoxY.Text = objData.PosY.ToString();
                uiCheckBoxIsMultiLine.Checked = objData.IsMultiLine;

                CurrentTxt = objData;
                ClientScript.RegisterStartupScript(this.GetType(), "selectTab", "$(document).ready(function (){ $('#myTab a[href=\"#t-2\"]').tab('show'); $('#myTab a[href=\"#t-1\"]').removeClass('active'); $('#myTab a[href=\"#t-2\"]').addClass('active'); });", true);
            }
            else if (e.CommandName == "DeleteTxt")
            {
                try
                {
                    CardText objData = new CardText();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentTxt = null;
                    BindCardTxt();
                }
                catch (Exception ex)
                {
                    return;
                }
            }
        }
Esempio n. 3
0
        protected void uiGridViewCards_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditCard")
            {
                Cards objData = new Cards();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxCardNameEn.Text = objData.CardNameEng;
                uiTextBoxCardNameAr.Text = objData.CardNameAr;
                uiTextBoxDescEn.Text = objData.DescriptionEng;
                uiTextBoxDescAr.Text = objData.DescriptionAr;
                if (!objData.IsColumnNull("DefaultFont"))
                {
                    uiDropDownListFonts.SelectedValue = objData.DefaultFont;
                }

                if (!objData.IsColumnNull("DimensionID"))
                    uiDropDownListDim.SelectedValue = objData.DimensionID.ToString();

                uiTextBoxPriceAfter.Text = objData.PriceNow.ToString();
                uiTextBoxPriceBefore.Text = objData.PriceBefore.ToString();

                uiPanelAllCards.Visible = false;
                uiPanelEdit.Visible = true;
                tabs.Visible = true;
                tabscontent.Visible = true;
                CurrentCard = objData;

                BindData();
                BindCardTxt();
                BindCardLayout();
                BindCardColors();
                BindCardImages();

                uiLabelCatName.Text = uiDropDownListCats.SelectedItem.Text;
                uiLabelCardName.Text = objData.CardNameEng;
            }
            else if (e.CommandName == "DeleteCard")
            {
                try
                {
                    int id = Convert.ToInt32(e.CommandArgument.ToString());

                    CardImages images = new CardImages();
                    images.GetCardImageByCardID(id);
                    int irows = images.RowCount;
                    for (int i = 0; i < irows; i++)
                    {
                        images.MarkAsDeleted();
                        images.MoveNext();
                    }
                    images.Save();

                    CardLayouts layouts = new CardLayouts();
                    layouts.GetCardLayoutByCardID(id);
                    int lrows = layouts.RowCount;
                    for (int i = 0; i < lrows; i++)
                    {
                        layouts.MarkAsDeleted();
                        layouts.MoveNext();
                    }

                    layouts.Save();

                    CardText texts = new CardText();
                    texts.GetCardTxtByCardID(id);
                    int trows = texts.RowCount;
                    for (int i = 0; i < trows; i++)
                    {
                        texts.MarkAsDeleted();
                        texts.MoveNext();
                    }

                    texts.Save();

                    CardColor colors = new CardColor();
                    colors.GetCardColorsByCardID(id);
                    int crows = colors.RowCount;
                    for (int i = 0; i < crows; i++)
                    {
                        colors.MarkAsDeleted();
                        colors.MoveNext();
                    }

                    colors.Save();

                    Cards objData = new Cards();
                    objData.LoadByPrimaryKey(id);
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentCard = null;
                    BindData();
                }
                catch (Exception ex)
                {
                    return;
                }
            }
        }