/// <summary>
        /// It moves the element after its current next sibling.
        /// </summary>
        /// <param name="ele">Element to be moved.</param>
        /// <returns>
        /// true if the operation succeeded.
        /// </returns>
        public bool ElementPositionDown(SvgElement ele)
        {
            ErrH err = new ErrH("SvgDoc", "ElementPositionDown");

            err.Log("Element to move " + ele.ElementInfo(), ErrH._LogPriority.Info);

            SvgElement parent = ele.getParent();

            if (parent == null)
            {
                err.Log("Root node cannot be moved", ErrH._LogPriority.Info);
                err.LogEnd(false);

                return(false);
            }

            if (IsLastSibling(ele))
            {
                err.Log("Element is already at the last sibling position", ErrH._LogPriority.Info);
                err.LogEnd(false);

                return(false);
            }

            SvgElement nxt  = ele.getNext();
            SvgElement nxt2 = null;
            SvgElement prv  = ele.getPrevious();

            // fix Next
            if (nxt != null)
            {
                nxt.setPrevious(ele.getPrevious());
                nxt2 = nxt.getNext();
                nxt.setNext(ele);
            }

            // fix Previous
            if (prv != null)
            {
                prv.setNext(nxt);
            }

            // fix Element
            if (IsFirstChild(ele))
            {
                parent.setChild(nxt);
            }

            ele.setPrevious(nxt);
            ele.setNext(nxt2);

            if (nxt2 != null)
            {
                nxt2.setPrevious(ele);
            }

            err.Log("Element moved " + ele.ElementInfo(), ErrH._LogPriority.Info);
            err.LogEnd(true);

            return(true);
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string testPath = HttpContext.Current.Server.MapPath(TextBox2.Text);

            SvgDoc myDoc = new SvgDoc();

            bool fileOk = myDoc.LoadFromFile(testPath);

            //look for <g id="Your_Designs">
            SVGLib.SvgElement elYourDesigns = myDoc.GetSvgElement("Your_Designs");

            List <shapePrice> priceArray = AddFromSvg(elYourDesigns);
            zapQuote          newQuote   = new zapQuote(zapConstants.mAcrylic3mm, 1, 1);

            // StringBuilder myString = new StringBuilder();


            foreach (shapePrice i in priceArray)
            {
                // myString.Append("zap type: " + i.zapType + ", area: " + Convert.ToString( i.area) + ", length: " + Convert.ToString(i.length) + ", x: " + Convert.ToString(i.xpos) + ", y: " + Convert.ToString(i.ypos) + ",\r\n other: " + i.otherInfo + "\r\n");

                newQuote.appendShapeData(i.length, i.area, i.zapType, i.height, 0, 0);

                //myString.Append("\r\n" + i.otherInfo);
            }

            newQuote.calcTotalTime(zapConstants.mAcrylic3mm, 1, 1);


            lblareafill.Text            = newQuote.totalAreaFill.ToString();
            lblblightfillcount.Text     = newQuote.lightFillCount.ToString();
            lblbtotalengravelength.Text = newQuote.totalLengthEngrave.ToString();
            lblbtotalheavyengrave.Text  = newQuote.totalHeavyEngrave.ToString();
            lblcutcount.Text            = newQuote.cutCount.ToString();
            lblcuttime.Text             = newQuote.cutTime.ToString();
            lblengravetime.Text         = newQuote.engraveTime.ToString();
            lblfilltime.Text            = newQuote.fillTime.ToString();
            lblheavyengravecount.Text   = newQuote.heavyEngraveCount.ToString();
            lblheavyfillarea.Text       = newQuote.totalHeavyFill.ToString();
            lblheavyfillcount.Text      = newQuote.heavyFillCount.ToString();
            lbllightengravecount.Text   = newQuote.lightEngraveCount.ToString();
            lbllightfillarea.Text       = newQuote.totalLightFill.ToString();
            lblmedengravecount.Text     = newQuote.medEngraveCount.ToString();
            lblmedfillarea.Text         = newQuote.totalMedFill.ToString();
            lblmedfillcount.Text        = newQuote.medFillCount.ToString();
            lbltotalCutLength.Text      = newQuote.totalCutLength.ToString();
            lbltotallightengrave.Text   = newQuote.totalLengthEngrave.ToString();
            lbltotalmedengrave.Text     = newQuote.totalMedEngrave.ToString();
            lbltotaltime.Text           = newQuote.totalTime.ToString();


            //TextBox1.Text = myString.ToString();


            //errors
            //errors myHandler = new errors();
            //myHandler.errFileSize(testPath);

            // TextBox1.Text = myHandler.currentError;



            //string gPath = @"<path d=""M 100 100 L 300 100 L 200 300 z"" fill=""red"" stroke=""blue"" stroke-width=""3"" />";
        }
        /// <summary>
        /// It moves the element before its current previous sibling.
        /// </summary>
        /// <param name="ele">Element to be moved.</param>
        /// <returns>
        /// true if the operation succeeded.
        /// </returns>
        public bool ElementPositionUp(SvgElement ele)
        {
            ErrH err = new ErrH("SvgDoc", "ElementPositionUp");

            err.Log("Element to move " + ele.ElementInfo(), ErrH._LogPriority.Info);

            SvgElement parent = ele.getParent();

            if (parent == null)
            {
                err.Log("Root node cannot be moved", ErrH._LogPriority.Info);
                err.LogEnd(false);

                return(false);
            }

            if (IsFirstChild(ele))
            {
                err.Log("Element is already at the first position", ErrH._LogPriority.Info);
                err.LogEnd(false);

                return(false);
            }

            SvgElement nxt  = ele.getNext();
            SvgElement prv  = ele.getPrevious();
            SvgElement prv2 = null;

            ele.setNext(null);
            ele.setPrevious(null);

            // fix Next
            if (nxt != null)
            {
                nxt.setPrevious(prv);
            }

            // fix Previous
            if (prv != null)
            {
                prv.setNext(nxt);
                prv2 = prv.getPrevious();
                prv.setPrevious(ele);

                // check if the Previous is the first child
                if (IsFirstChild(prv))
                {
                    // if yes the moved element has to became the new first child
                    if (prv.getParent() != null)
                    {
                        prv.getParent().setChild(ele);
                    }
                }
            }

            // fix Previous/Previous
            if (prv2 != null)
            {
                prv2.setNext(ele);
            }

            // fix Element
            ele.setNext(prv);
            ele.setPrevious(prv2);

            err.Log("Element moved " + ele.ElementInfo(), ErrH._LogPriority.Info);
            err.LogEnd(true);

            return(true);
        }
        /// <summary>
        /// It creates a SVG document reading from a file.
        /// If a current document exists, it is destroyed.
        /// </summary>
        /// <param name="sFilename">The complete path of a valid SVG file.</param>
        /// <returns>
        /// true if the file is loaded successfully and it is a valid SVG document, false if the file cannot be open or if it is not
        /// a valid SVG document.
        /// </returns>
        public bool LoadFromFile(string sFilename)
        {
            ErrH err = new ErrH("SvgDoc", "LoadFromFile");

            err.LogParameter("sFilename", sFilename);

            if (m_root != null)
            {
                m_root    = null;
                m_nNextId = 1;
                m_elements.Clear();
            }

            bool bResult = true;

            try
            {
                XmlTextReader reader;
                reader = new XmlTextReader(sFilename);
                reader.WhitespaceHandling = WhitespaceHandling.None;
                reader.Normalization      = false;
                reader.XmlResolver        = null;
                reader.Namespaces         = false;

                string     tmp;
                SvgElement eleParent = null;

                try
                {
                    // parse the file and display each of the nodes.
                    while (reader.Read() && bResult)
                    {
                        switch (reader.NodeType)
                        {
                        case XmlNodeType.Attribute:
                            tmp = reader.Name;
                            tmp = reader.Value;
                            break;

                        case XmlNodeType.Element:
                        {
                            SvgElement ele = AddElement(eleParent, reader.Name);

                            if (ele == null)
                            {
                                err.Log("Svg element cannot be added. Name: " + reader.Name, ErrH._LogPriority.Warning);
                                bResult = false;
                            }
                            else
                            {
                                eleParent = ele;

                                if (reader.IsEmptyElement)
                                {
                                    if (eleParent != null)
                                    {
                                        eleParent = eleParent.getParent();
                                    }
                                }

                                bool bLoop = reader.MoveToFirstAttribute();
                                while (bLoop)
                                {
                                    ele.SetAttributeValue(reader.Name, reader.Value);

                                    bLoop = reader.MoveToNextAttribute();
                                }
                            }
                        }
                        break;

                        case XmlNodeType.Text:
                            if (eleParent != null)
                            {
                                eleParent.setElementValue(reader.Value);
                            }
                            break;

                        case XmlNodeType.CDATA:

                            err.Log("Unexpected item: " + reader.Value, ErrH._LogPriority.Warning);
                            break;

                        case XmlNodeType.ProcessingInstruction:

                            err.Log("Unexpected item: " + reader.Value, ErrH._LogPriority.Warning);
                            break;

                        case XmlNodeType.Comment:

                            err.Log("Unexpected item: " + reader.Value, ErrH._LogPriority.Warning);
                            break;

                        case XmlNodeType.XmlDeclaration:
                            m_sXmlDeclaration = "<?xml " + reader.Value + "?>";
                            break;

                        case XmlNodeType.Document:
                            err.Log("Unexpected item: " + reader.Value, ErrH._LogPriority.Warning);
                            break;

                        case XmlNodeType.DocumentType:
                        {
                            string sDTD1;
                            string sDTD2;

                            sDTD1 = reader.GetAttribute("PUBLIC");
                            sDTD2 = reader.GetAttribute("SYSTEM");

                            m_sXmlDocType = "<!DOCTYPE svg PUBLIC \"" + sDTD1 + "\" \"" + sDTD2 + "\">";
                        }
                        break;

                        case XmlNodeType.EntityReference:
                            err.Log("Unexpected item: " + reader.Value, ErrH._LogPriority.Warning);
                            break;

                        case XmlNodeType.EndElement:
                            if (eleParent != null)
                            {
                                eleParent = eleParent.getParent();
                            }
                            break;
                        } // switch
                    }     // while
                }         // read try
                catch (XmlException xmle)
                {
                    err.LogException(xmle);
                    err.LogParameter("Line Number", xmle.LineNumber.ToString());
                    err.LogParameter("Line Position", xmle.LinePosition.ToString());

                    bResult = false;
                }
                catch (Exception e)
                {
                    err.LogException(e);
                    bResult = false;
                }
                finally
                {
                    reader.Close();
                }
            }
            catch
            {
                err.LogUnhandledException();
                bResult = false;
            }

            err.LogEnd(bResult);

            return(bResult);
        }
        /// <summary>
        /// It creates a new element according to the element name provided
        /// and it adds the new element as the last children of the given parent element.
        /// </summary>
        /// <param name="parent">Parent element. If null the element is added under the root.</param>
        /// <param name="sName">SVG element name.</param>
        /// <returns>The new created element.</returns>
        public SvgElement AddElement(SvgElement parent, string sName)
        {
            SvgElement eleToReturn = null;

            if (sName == "svg")
            {
                m_root = new SvgRoot(this);
                m_root.setInternalId(m_nNextId++);

                m_elements.Add(m_root.getInternalId(), m_root);
                eleToReturn = m_root;
            }
            else if (sName == "desc")
            {
                eleToReturn = AddDesc(parent);
            }
            else if (sName == "text")
            {
                eleToReturn = AddText(parent);
            }
            else if (sName == "g")
            {
                eleToReturn = AddGroup(parent);
            }
            else if (sName == "rect")
            {
                eleToReturn = AddRect(parent);
            }
            else if (sName == "circle")
            {
                eleToReturn = AddCircle(parent);
            }
            else if (sName == "ellipse")
            {
                eleToReturn = AddEllipse(parent);
            }
            else if (sName == "line")
            {
                eleToReturn = AddLine(parent);
            }
            else if (sName == "path")
            {
                eleToReturn = AddPath(parent);
            }
            else if (sName == "polygon")
            {
                eleToReturn = AddPolygon(parent);
            }
            else if (sName == "image")
            {
                eleToReturn = AddImage(parent);
            }
            else
            {
                if (parent != null)
                {
                    eleToReturn = AddUnsupported(parent, sName);
                }
            }

            return(eleToReturn);
        }
 /// <summary>
 /// It deletes an element from the document.
 /// </summary>
 /// <param name="ele">Element to be deleted.</param>
 /// <returns>
 /// true if the element has been successfully deleted; false otherwise.
 /// </returns>
 public bool DeleteElement(SvgElement ele)
 {
     return(DeleteElement(ele, true));
 }
        protected void btnCalc_Click(object sender, EventArgs e)
        {
            // clear error messages
            dialog.InnerHtml = "";


            // FORM ITEMS ================================================================
            //file info:
            fileName.InnerHtml = HttpUtility.HtmlEncode(Context.Request.Form["cFileName"]);
            string fPath    = Context.Server.MapPath(@"imgLibrary");
            string fullPath = fPath + @"\" + Context.Request.Form["cFileName"];
            string fName    = Context.Request.Form["cFileName"];

            // user selected options:
            int materialId = Convert.ToInt32(svgMaterial.SelectedValue);
            int quantity   = Convert.ToInt32(svgQuantity.Text);
            int mmId       = Convert.ToInt32(svgMm.SelectedValue);

            // END FORM ==================================================================


            //get the template size id from the uloaded file
            templateSize myTemp         = new templateSize();
            int          templateSizeId = myTemp.detectTemplate(fullPath);

            if (templateSizeId == 0)
            {
                // is not a valid template - show error
                errors errType = new errors();
                errType.errTemplate();
                openError(errType.currentError + errType.helpUrl);
                errType = null;
                return;
            }

            //show template size on screen
            lblSvgTemplateSize.Text = "Template size " + myTemp.txtTemplateSize;
            myTemp = null;


            //load the svg doc into the svg library
            SvgDoc myDoc = new SvgDoc();

            myDoc.LoadFromFile(fullPath);


            SVGLib.SvgElement elYourDesigns = myDoc.GetSvgElement("Your_Designs");
            if (elYourDesigns.getChild() != null)
            {
                AddFromSvg2(elYourDesigns);
            }
            else
            {
                //check inkscape added group labled "Your Designs"
                // get the id by searching for the label then us the ID with getSvgElement
                inkscapeGroupFix gf      = new inkscapeGroupFix();
                string           groupId = gf.getgroupId("Your Designs", fullPath, "Your Designs");
                if (groupId == "")
                {
                    //throw error, no design detected
                    errors errType = new errors();
                    errType.errDesign();
                    openError(errType.currentError + errType.helpUrl);
                    errType = null;
                    return;
                }
                else
                {
                    elYourDesigns = myDoc.GetSvgElement(groupId);
                    AddFromSvg2(elYourDesigns);
                }

                gf = null;
            }

            myDoc = null;

            List <shapePrice> priceArray = allShapes;
            zapQuote          newQuote   = new zapQuote(materialId, templateSizeId, mmId);

            //check if error returned from AddFromSvg
            if (isValidSvgDesign == false)
            {
                //show error and halt progress
                openError(svgError);
                return;
            }


            foreach (shapePrice i in priceArray)
            {
                newQuote.appendShapeData(i.length, i.area, i.zapType, i.height, i.xpos, i.ypos);
                // raster line area from objects
                rasterExtraArea += i.rasterArea;
            }


            //calculate extra raster area from coordinates
            if (rasterPoints.Count > 0)
            {
                //find 4 outer points and calculate area as a rectangle

                double lX = rasterPoints.Min(c => c.X);
                double rX = rasterPoints.Max(c => c.X);
                double tY = rasterPoints.Min(c => c.Y);
                double bY = rasterPoints.Max(c => c.Y);

                rasterExtraArea = Common.rasterAreaFromPoints(lX, rX, tY, bY);
                extraHeight     = Common.rasterHeight(tY, bY);
            }



            newQuote.calcTotalTime(materialId, templateSizeId, mmId, rasterExtraArea, extraHeight);



            materialPrice mPrice = new materialPrice();

            mPrice.getMaterialPrices(materialId, templateSizeId, mmId);


            //cut lines price
            decimal cutPrice = Convert.ToDecimal(newQuote.cutTime * mPrice.costCutSec);
            // engrave lines
            decimal engravePrice = Convert.ToDecimal(newQuote.engraveTime * mPrice.costVectorSec);
            // raster engrave
            //decimal rasterPrice = Convert.ToDecimal((newQuote.totalAreaFill / 100) * mPrice.costRasterPerSqCm);

            decimal rasterPrice = Convert.ToDecimal(newQuote.fillTime * mPrice.costRasterPerSec);

            decimal totalLaserPrice = cutPrice + engravePrice + rasterPrice;

            decimal materialCost = Convert.ToDecimal(mPrice.pricePerUnit);

            decimal unitPrice = totalLaserPrice + materialCost;

            decimal totalPrice = unitPrice * quantity;


            //populate labels / session values

            StringBuilder quoteInfo = new StringBuilder();

            quoteInfo.Append("<ul>");
            quoteInfo.Append("<li><b>File Cost</b>");
            quoteInfo.Append("<div class='formInfo'>- " + fName + " = <span class='formBlue'>" + string.Format(CultureInfo.CreateSpecificCulture("en-GB"), "{0:C}", totalLaserPrice) + "</span></div>");
            quoteInfo.Append("<div class='formInfo'>- Quantity = <span class='formBlue'>x" + quantity + "</span></div>");
            quoteInfo.Append("<div class='formBlue'>Total File Cost = " + string.Format(CultureInfo.CreateSpecificCulture("en-GB"), "{0:C}", totalLaserPrice * quantity) + "</div>");
            quoteInfo.Append("</li>");
            quoteInfo.Append("<li><b>Material Cost</b>");
            quoteInfo.Append("<div class='formInfo'>- " + svgMaterial.SelectedItem.Text + "</div>");
            quoteInfo.Append("<div class='formInfo'>- " + svgMm.SelectedItem.Text + "</div>");
            quoteInfo.Append("<div class='formInfo'>- " + materialColour.SelectedItem.Text + "</div>");
            quoteInfo.Append("<div class='formInfo'>- = <span class='formBlue'>" + string.Format(CultureInfo.CreateSpecificCulture("en-GB"), "{0:C}", materialCost) + "</span></div>");
            quoteInfo.Append("<div class='formInfo'>- Quantity = <span class='formBlue'>x" + quantity + "</span></div>");
            quoteInfo.Append("<div class='formInfo'>- Total material cost= <span class='formBlue'>" + string.Format(CultureInfo.CreateSpecificCulture("en-GB"), "{0:C}", materialCost * quantity) + "</span></div>");
            quoteInfo.Append("</li>");
            quoteInfo.Append("<li><b>Total Cost</b> <span class='formBlue'>" + string.Format(CultureInfo.CreateSpecificCulture("en-GB"), "{0:C}", totalPrice) + "</span>");
            quoteInfo.Append("</li>");
            quoteInfo.Append("</ul>");

            divQuote.InnerHtml = quoteInfo.ToString();

            quoteInfo = null;



            StringBuilder debugInfo = new StringBuilder();


            debugInfo.Append("<p>Cut price:" + cutPrice + "</p>");
            debugInfo.Append("<p>Cut time:" + newQuote.cutTime + "</p>");
            debugInfo.Append("<p>Cut length mm:" + newQuote.totalCutLength + "</p>");
            debugInfo.Append("<p>Cut cost per sec:" + mPrice.costCutSec + "</p>");
            debugInfo.Append("<p>Number of cuts:" + newQuote.cutCount + "</p>");
            debugInfo.Append("<p>Cut area:" + newQuote.totalCutArea + "</p>");

            debugInfo.Append("<p>Vector engrave price:" + engravePrice + "</p>");
            debugInfo.Append("<p>Vector engrave time:" + newQuote.engraveTime + "</p>");
            debugInfo.Append("<p>Vector engrave cost per sec:" + mPrice.costVectorSec + "</p>");

            debugInfo.Append("<p>Vector engrave light length:" + newQuote.totalLightEngrave + "</p>");
            debugInfo.Append("<p>Vector engrave med length:" + newQuote.totalMedEngrave + "</p>");
            debugInfo.Append("<p>Vector engrave heavy length:" + newQuote.totalHeavyEngrave + "</p>");


            debugInfo.Append("<p>Raster price:" + rasterPrice + "</p>");
            debugInfo.Append("<p>Raster time:" + newQuote.fillTime + "</p>");
            debugInfo.Append("<p>Raster cost per sec:" + mPrice.costRasterPerSec + "</p>");
            debugInfo.Append("<p>Raster area:" + newQuote.rasterArea + "</p>");



            litErr.Text = debugInfo.ToString();

            debugInfo = null;
        }
        // ---------- PUBLIC METHODS END

        // ---------- PRIVATE METHODS

        private bool DeleteElement(SvgElement ele, bool bDeleteFromParent)
        {
            ErrH err = new ErrH("SvgDoc", "DeleteElement");

            if (ele == null)
            {
                err.LogEnd(false);

                return(false);
            }

            SvgElement parent = ele.getParent();

            if (parent == null)
            {
                // root node cannot be delete!
                err.Log("root node cannot be delete!", ErrH._LogPriority.Info);
                err.LogEnd(false);

                return(false);
            }

            // set the Next reference of the previous
            if (ele.getPrevious() != null)
            {
                ele.getPrevious().setNext(ele.getNext());
            }

            // set the Previous reference of the next
            if (ele.getNext() != null)
            {
                ele.getNext().setPrevious(ele.getPrevious());
            }

            // check if the element is the first child
            // the bDeleteFromParent flag is used to avoid deleting
            // all parent-child relationship. This is used in the Cut
            // operation where the subtree can be pasted
            if (bDeleteFromParent)
            {
                if (IsFirstChild(ele))
                {
                    // set the Child reference of the parent to the next
                    ele.getParent().setChild(ele.getNext());
                }
            }

            // delete its children
            SvgElement child = ele.getChild();

            while (child != null)
            {
                DeleteElement(child, false);
                child = child.getNext();
            }

            // delete the element from the colloection
            m_elements.Remove(ele.getInternalId());

            err.Log(ele.ElementInfo(), ErrH._LogPriority.Info);
            err.LogEnd(true);

            return(true);
        }
Beispiel #9
0
        public int detectTemplate(string docPath)
        {
            // XDocument test = XDocument.Load(docPath);

            // IEnumerable<XElement> users = (from el in test.Root.Descendants() where (string)el.Attribute("id") == "Your_Designs" select el);

            // XElement element = users.First();
            // string mc = element.Attribute("class").Value.ToString();


            // another change 15 june 2012 now using fill value from nested path in group with id = borders
            string pathFill = "";
            SvgDoc myDoc    = new SvgDoc();

            myDoc.LoadFromFile(docPath);
            SVGLib.SvgElement elBorders = myDoc.GetSvgElement("Borders");
            if (elBorders != null)
            {
                if (elBorders.getChild() != null)
                {
                    SvgElement pathBorder = elBorders.getChild();
                    pathData   myPath     = new pathData((SvgPath)pathBorder);
                    pathFill   = myPath.fillColor;
                    pathBorder = null;
                    myPath     = null;
                }
            }
            else
            {
                // check if is an inkscape
                //check inkscape added group labled "Borders"
                // get the id by searching for the label then us the ID with getSvgElement
                inkscapeGroupFix gf      = new inkscapeGroupFix();
                string           groupId = gf.getgroupId("Borders", docPath, "Borders");
                if (groupId == "")
                {
                    //show template error - not recognised
                }
                else
                {
                    //get the fill colour
                    elBorders = myDoc.GetSvgElement(groupId);
                    SvgElement   pathBorder = elBorders.getChild();
                    pathData     myPath     = new pathData((SvgPath)pathBorder);
                    string       pathStyle  = myPath.style;
                    extractStyle rStyle     = new extractStyle();
                    rStyle.getStyle(pathStyle);
                    pathFill = rStyle.fillColour;

                    //convert to RGB values
                    Color htmlPath = ColorTranslator.FromHtml(pathFill);
                    pathFill = Convert.ToString(htmlPath.R) + Convert.ToString(htmlPath.G) + Convert.ToString(htmlPath.B);

                    rStyle     = null;
                    pathBorder = null;
                    myPath     = null;
                }
                myDoc = null;
            }



            //IEnumerable<XElement> users = test.Root.Descendants();

            //string viewBox = svgTree.Attribute("viewBox").Value.ToString();



            // chang to get the fill colour from the borders child path element TODO


            // pathData myPath = new pathData((SvgPath)elBorders.getChild());
            // myShapes shapeData = new myShapes();

            //string pathData = myPath.shapeData;
            //double length = shapeData.getPathLength(pathData);
            //int absLength = Convert.ToInt32(Math.Round(length));

            //myDoc = null;
            // elBorders = null;
            //myPath = null;
            //shapeData = null;
            //svgTree = null;



            SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings["zapCartDb"].ConnectionString);

            myConn.Open();

            //SqlCommand myCmd = new SqlCommand("SELECT * FROM tbl_templateSizes where viewBox = @viewBox");
            //SqlCommand myCmd = new SqlCommand("SELECT * FROM tbl_templateSizes where templateSizeText = @viewBox");
            SqlCommand myCmd = new SqlCommand("SELECT * FROM tbl_templateSizes where borders = @borders");

            myCmd.Connection = myConn;
            SqlParameter myParam = new SqlParameter();

            myParam.ParameterName = "@borders";
            //myParam.Value = viewBox;
            myParam.Value = pathFill;
            myCmd.Parameters.Add(myParam);

            SqlDataReader myReader = null;

            myReader = myCmd.ExecuteReader();

            int templateSizeId = 0;

            while (myReader.Read())
            {
                templateSizeId  = (int)myReader["templateSizeId"];
                txtTemplateSize = (string)myReader["templateSizeText"];
            }

            myReader = null;
            myConn.Close();
            myCmd  = null;
            myConn = null;


            return(templateSizeId);
        }
Beispiel #10
0
 /// <summary>
 /// It sets the previous element.
 /// </summary>
 /// <param name="ele">New previous element.</param>
 public void setPrevious(SvgElement ele)
 {
     m_Previous = ele;
 }
Beispiel #11
0
 /// <summary>
 /// It sets the next sibling element.
 /// </summary>
 /// <param name="ele">New next element.</param>
 public void setNext(SvgElement ele)
 {
     m_Next = ele;
 }
Beispiel #12
0
 /// <summary>
 /// It sets the first child element.
 /// </summary>
 /// <param name="ele">New child.</param>
 public void setChild(SvgElement ele)
 {
     m_Child = ele;
 }
Beispiel #13
0
 /// <summary>
 /// It sets the parent element.
 /// </summary>
 /// <param name="ele">New parent element</param>
 public void setParent(SvgElement ele)
 {
     m_Parent = ele;
 }