Пример #1
0
        protected void uiDataListCardText_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Cards card = new Cards();
                card.LoadByPrimaryKey(CardID);
                TextBox textbox = (TextBox)e.Item.FindControl("uiTextBoxText");
                DropDownList dlfonts = (DropDownList)e.Item.FindControl("uiDropDownListFonts");
                DataRowView row = (DataRowView)e.Item.DataItem;
                if (row["IsMultiLine"] != null)
                {
                    if ((bool)row["IsMultiLine"] == true)
                        textbox.TextMode = TextBoxMode.MultiLine;
                }

                if (!card.IsColumnNull("DefaultFont"))
                {
                    dlfonts.SelectedValue = card.DefaultFont;
                }

            }
        }
Пример #2
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("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();
            }
            else if (e.CommandName == "DeleteCard")
            {
                try
                {
                    Cards objData = new Cards();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentCard = null;
                    BindData();
                }
                catch (Exception ex)
                {
                    return;
                }
            }
        }
Пример #3
0
        protected void uiRepeaterOrder_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Image envelop = (Image)e.Item.FindControl("uiImageEnvelop");
                Label maxQty = (Label)e.Item.FindControl("uiLabelMaxQty");
                Label Envdash = (Label)e.Item.FindControl("uiLabelEnvDash");

                DataRowView row = (DataRowView)e.Item.DataItem;

                Cards card = new Cards();
                card.LoadByPrimaryKey(Convert.ToInt32(row["CardID"]));
                if (card.IsColumnNull("IsPartySupplier"))
                {
                    maxQty.Visible = true;
                }
                else if (card.IsPartySupplier)
                {
                    maxQty.Visible = false;
                }
                else if (!card.IsPartySupplier)
                {
                    maxQty.Visible = true;
                }
                if (EnverlopID != 0)
                {
                    Envelops envelopTemp = new Envelops();
                    envelopTemp.LoadByPrimaryKey(Convert.ToInt32(row["EnvelopID"].ToString()));
                    envelop.ImageUrl = ".." + envelopTemp.ImagePath;
                    Envdash.Visible = false;
                }
                else
                {
                    Envdash.Visible = true;
                }

            }
        }
Пример #4
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;
                }
            }
        }