Example #1
0
 public void RemoveStudioMAttributes(QandAForSupplier qa)
 {
     StudioMQandA.Remove(qa);
     //foreach (var item in StudioMQandA)
     //{
     //    if (item.SupplierID == qa.SupplierID && item.QuestionID == qa.QuestionID && item.AnswerID == qa.AnswerID)
     //    {
     //        StudioMQandA.Remove(qa);
     //    }
     //}
 }
Example #2
0
        public void AddStudioMAttributes(QandAForSupplier qa)
        {
            bool dul = false;

            foreach (var item in StudioMQandA)
            {
                if (item.SupplierBrandID == qa.SupplierBrandID && item.QuestionID == qa.QuestionID && item.AnswerID == qa.AnswerID)
                {
                    dul = true;
                    break;
                }
            }
            if (!dul)
            {
                StudioMQandA.Add(qa);
            }
        }
Example #3
0
        public void LoadStudioMAttributes()
        {
            QandAForSupplier qa;

            StudioMQandA.Clear();
            client = new SQSAdminServiceClient();
            client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint);

            string xml = client.SQSAdmin_StudioM_GetProductStudioMAttribute(productid);

            client.Close();

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);

                XmlNodeList supplierList = doc.SelectNodes("/Brands/Brand");
                foreach (XmlNode xd in supplierList)
                {
                    XmlNode idnode   = xd.Attributes["id"];
                    XmlNode namenode = xd.Attributes["name"];
                    if (idnode != null && idnode.Value != "")
                    {
                        XmlNodeList questionList = doc.SelectNodes("/Brands/Brand[@id='" + idnode.Value + "']/Questions/Question");
                        foreach (XmlNode xd2 in questionList)
                        {
                            XmlNode idnode2   = xd2.Attributes["id"];
                            XmlNode textnode2 = xd2.Attributes["text"];
                            XmlNode atypenode = xd2.Attributes["type"];
                            XmlNode mandatory = xd2.Attributes["mandatory"];
                            if (idnode2 != null && idnode2.Value != "")
                            {
                                XmlNodeList answerList = doc.SelectNodes("/Brands/Brand[@id='" + idnode.Value + "']/Questions/Question[@id='" + idnode2.Value + "']/Answers/Answer");
                                foreach (XmlNode xd3 in answerList)
                                {
                                    XmlNode idnode3   = xd3.Attributes["id"];
                                    XmlNode textnode3 = xd3.Attributes["text"];
                                    bool    m         = true;
                                    qa                   = new QandAForSupplier();
                                    qa.AnswerID          = int.Parse(idnode3.Value);
                                    qa.AnswerText        = textnode3.Value;
                                    qa.AnswerType        = atypenode.Value;
                                    qa.QuestionID        = int.Parse(idnode2.Value.ToString());
                                    qa.QuestionText      = textnode2.Value;
                                    qa.SupplierBrandID   = int.Parse(idnode.Value.ToString());
                                    qa.SupplierBrandName = namenode.Value;
                                    if (mandatory != null && mandatory.Value.ToString() == "1")
                                    {
                                        m = true;
                                    }
                                    else
                                    {
                                        if (mandatory == null)
                                        {
                                            m = true;
                                        }
                                        else
                                        {
                                            m = false;
                                        }
                                    }
                                    qa.Mandatory = m;

                                    StudioMQandA.Add(qa);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }