private productType CreateproductType()
        {
            productType p = new productType();

            p.Name = txtName.Text;
            return(p);
        }
예제 #2
0
        public IAsyncResult BeginEstablish(
            string conversationId,
            Guid applicationId,
            productType productInfo,
            IEnumerable <skillType> skills,
            AsyncCallback userCallback, object state)
        {
            agentDashboardInitType agentdashboardinitdata = new agentDashboardInitType();

            agentdashboardinitdata.product = productInfo;
            agentdashboardinitdata.skills  = new List <skillType>(skills).ToArray();


            string serializedInitData;

            XmlSerializer serializer = new XmlSerializer(agentdashboardinitdata.GetType());

            using (TextWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, agentdashboardinitdata);
                serializedInitData = writer.ToString();
            }

            Console.WriteLine(serializedInitData);

            ConversationContextChannelEstablishOptions options = new ConversationContextChannelEstablishOptions();

            options.ContextualData       = serializedInitData;
            options.Toast                = "hi";
            options.RemoteConversationId = conversationId;

            m_innerChannel.DataReceived += InnerChannel_DataReceived;

            return(m_innerChannel.BeginEstablish(applicationId, options, userCallback, state));
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ProductTypeModel model = new ProductTypeModel();
            productType      pt    = CreateproductType();

            lblResult.Text = model.InsertproductType(pt);
        }
예제 #4
0
        //新增
        public static int Get_chanpinlbAdd(productType p)
        {
            NewHope4Entities uu = new NewHope4Entities();

            uu.productType.Add(p);
            return(uu.SaveChanges());
        }
        /// <summary>
        /// Returns MimePartContentDescription based on incoming context.
        /// </summary>
        /// <param name="incomingContext">Incoming context. </param>
        /// <returns>MimePartContextDescription.</returns>
        public MimePartContentDescription GenerateContextMimePartContentDescription(IDictionary <string, string> incomingContext)
        {
            MimePartContentDescription mimePartContentDescription = null;

            //Check if we have context key.
            if (incomingContext != null && incomingContext.ContainsKey(ProductContextContextInformationProvider.ContextKey))
            {
                productType productType = this.GetProductTypeFromProductId(incomingContext[ProductContextContextInformationProvider.ContextKey]);
                if (productType != null)
                {
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(productType));
                    //Try to serialize
                    try
                    {
                        byte[]      contentAsByteArray = CommonHelper.SerializeObjectToByteArray(productType, xmlSerializer);
                        ContentType contentType        = new ContentType();
                        mimePartContentDescription = new MimePartContentDescription(contentType, contentAsByteArray);
                    }
                    catch (XmlException xmlException)
                    {
                        Helper.Logger.Error("Xml exception occured {0}", EventLogger.ToString(xmlException));
                    }
                }
            }

            return(mimePartContentDescription);
        }
예제 #6
0
        //产品新增
        public ActionResult Get_chanpinlbAdd(productType p)
        {
            p.UserID       = 1;
            p.CreationDate = DateTime.Now;
            p.state        = 0;

            return(Json(YQmanager.Get_chanpinlbAdd(p), JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        public object CreateProduct()
        {
            var prodService = ServiceProvider.getProductService();

            var product = new productType();
            product.categoryCode = "a";
            product.title = "Test Ürünü";

            product.specs = new[]
                {
                    new specType {name = "Marka", type = "Combo", value = "Patates", required = true},
                    new specType {name = "Durumu", type = "Combo", value = "Sıfır", required = true},
                    new specType {name = "Garanti", type = "Combo", value = "Yok", required = true}
                };

            product.photos = new[]
                {
                    new photoType {photoId = 0, photoIdSpecified = true, url = "http://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Bamberger_Hoernle.jpg/320px-Bamberger_Hoernle.jpg"},
                    new photoType {photoId = 1, photoIdSpecified = true, url = "http://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Russet_potato_.jpg/320px-Russet_potato_.jpg"}
                };

            product.pageTemplate = 1;
            product.pageTemplateSpecified = true;
            product.description = "Patates (Solanum tuberosum), patlıcangiller (Solanaceae) familyasından yumruları yenen otsu bitki türü.";
            product.format = "A";
            product.startPrice = 0;
            product.startPriceSpecified = true;
            product.buyNowPrice = 5.00;
            product.buyNowPriceSpecified = true;
            product.listingDays = 1;
            product.listingDaysSpecified = true;
            product.productCount = 1;
            product.productCountSpecified = true;

            product.cargoDetail = new cargoDetailType
                {
                    city = "20",
                    cargoCompanies = new[] {"Aras", "Yurtiçi"},
                    cargoDescription = "Kargo alıcıya aittir",
                    shippingPayment = "B",
                    shippingWhere = "Turkey"
                };

            product.affiliateOption = false;
            product.boldOption = false;
            product.catalogOption = true;
            product.vitrineOption = false;
            product.startDate = "17.05.2013 00:00:00";

            var response = prodService.insertProduct("ptt001", product, false, false, "tr");
            if (response != null && response.ackCode == "success")
            {
                var id = response.productId;
                return product;
            }

            return null;
        }
예제 #8
0
        //修改
        public static int Get_chanpinlbupdate(productType p)
        {
            NewHope4Entities uu = new NewHope4Entities();
            var obj             = uu.productType.Find(p.PID);

            obj.PName  = p.PName;
            obj.remark = p.remark;
            //obj.CreationDate = m.CreationDate;
            //obj.state = m.state;
            return(uu.SaveChanges());
        }
 public bool OfType(productType type_)
 {
     if (proType == type_)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public ActionResult addType([FromBody] productType productType)
 {
     if (productType != null)
     {
         db.ProductTypes.Add(productType);
         db.SaveChanges();
         return(Ok(productType));
     }
     else
     {
         return(NotFound());
     }
 }
 public StoreObjectReference(GameObject obj, string name_, int objectID_, int subID_) // misc items constructor, not accessed by user but utilized ingame often
 {
     gameObject_      = obj;
     objectScreenshot = null;
     productName      = name_;
     objectID         = objectID_;
     subID            = subID_;
     tilType          = tileType.none;
     objType          = objectType.Shelf;
     proType          = productType.none;
     boxWeight        = -1;
     price            = 0;
 }
예제 #12
0
 public string InsertproductType(productType productType)
 {
     try
     {
         firstdbEntities2 db = new firstdbEntities2();
         db.productTypes.Add(productType);
         db.SaveChanges();
         return(productType.Name + " was sucessfully inserted");
     }
     catch (Exception e)
     {
         return("Error:" + e);
     }
 }
 public StoreObjectReference(GameObject obj, Sprite screenshot, string name_, int price_, int objectID_, int subID_) // Store object addon constructor
 {
     gameObject_      = obj;
     objectScreenshot = screenshot;
     productName      = name_;
     objectID         = objectID_;
     subID            = subID_;
     tilType          = tileType.none;
     objType          = objectType.StoreObjectAddon;
     proType          = productType.none;
     containerType    = ContainerType.none;
     boxWeight        = -1;
     price            = price_;
 }
 public StoreObjectReference(GameObject obj, Sprite screenshot, string name_, ContainerType type_, int price_, int objectID_, int subID_, int boxWeight_)
 { // Container constructor
     gameObject_      = obj;
     objectScreenshot = screenshot;
     productName      = name_;
     objectID         = objectID_;
     subID            = subID_;
     boxWeight        = boxWeight_;
     objType          = objectType.Product;
     proType          = productType.container;
     containerType    = type_;
     tilType          = tileType.none;
     price            = price_;
 }
 public StoreObjectReference(GameObject obj, Sprite screenshot, string name_, productType type_, int price_, int objectID_, int subID_, int boxWeight_) // Product constructor
 {
     gameObject_      = obj;
     objectScreenshot = screenshot;
     productName      = name_;
     objectID         = objectID_;
     subID            = subID_;
     boxWeight        = boxWeight_;
     objType          = objectType.Product;
     tilType          = tileType.none;
     containerType    = ContainerType.none;
     proType          = type_;
     price            = price_;
     color            = ProductColor.GetRandomProductColor();
 }
예제 #16
0
 public string DeleteproductType(int id)
 {
     try
     {
         firstdbEntities2 db          = new firstdbEntities2();
         productType      productType = db.productTypes.Find(id);
         db.productTypes.Attach(productType);
         db.productTypes.Remove(productType);
         db.SaveChanges();
         return(productType.Name + "was sucessfully deleted");
     }
     catch (Exception e)
     {
         return("Error:" + e);
     }
 }
예제 #17
0
 public string UpdateproductType(int id, productType productType)
 {
     try
     {
         firstdbEntities2 db = new firstdbEntities2();
         //Fetch object from db
         productType p = db.productTypes.Find(id);
         p.Name = productType.Name;
         db.SaveChanges();
         return(productType.Name + "was sucessfully updated");
     }
     catch (Exception e)
     {
         return("Error:" + e);
     }
 }
예제 #18
0
        /// END: Copied from http://cladosnippet.blogspot.com/2012/04/c-get-season-according-to-given-date.html
        public Weather()
        {
            // Position of Alexandria, VA on the map -- should be extensible to any "home" location of the application user
            longitude = 38.8047m; // 38.8047 degrees N (N is positive)
            latitude = -77.0472m; // 77.0472 degrees W (W is negative)
            weatherForecastProductType = productType.timeseries;
            startTime = DateTime.UtcNow; // Weather forecast begins at the current time
            endTime = DateTime.UtcNow.AddDays(1); // Weather forecast ends a day after the current time -- Daily weather forecast
            weatherUnit = unitType.m; // Weather forecast generated in metric (SI) units

            currentSeason = CurrentSeason(startTime);
            forecastParametersType = new weatherParametersType();
            forecastParametersType.maxt = true; // Maximum temperature
            forecastParametersType.mint = true; // Minimum temperature
            forecastParametersType.appt = true; // Apparent temperature
            forecastParametersType.maxrh = true; // Maximum relative humidity
            forecastParametersType.minrh = true; // Minimum relative humidity
            forecastParametersType.pop12 = true; // 12 hour probability of precipitation
            if (Equals(currentSeason, Seasons.Winter)) // Snowfall is almost certainly zero unless the query is made in the winter
            {
                forecastParametersType.snow = true; // Snowfall amount
            }
            forecastParametersType.wspd = true; // Wind speed
            forecastParametersType.wdir = true; // Wind direction

            weatherDictionary = new Dictionary<string, double>();
            weatherDictionary.Add("Maximum Temperature", 0.0);
            weatherDictionary.Add("Minimum Temperature", 0.0);
            weatherDictionary.Add("Apparent Temperature", 0.0);
            weatherDictionary.Add("12 Hour Probability of Precipitation", 0.0);
            weatherDictionary.Add("Wind Speed", 0.0);
            weatherDictionary.Add("Wind Direction", 0.0);
            weatherDictionary.Add("Maximum Relative Humidity", 0.0);
            weatherDictionary.Add("Minimum Relative Humidity", 0.0);
            weatherDictionary.Add("Snowfall Amount", 0.0); // Need to fix this for winter... will not work
        }
 yield return(new Product(productType, terminalMasses[n], neutralLoss));
예제 #20
0
 //修改
 public ActionResult Get_chanpinlbupdate(productType p)
 {
     return(Json(YQmanager.Get_chanpinlbupdate(p), JsonRequestBehavior.AllowGet));
 }
예제 #21
0
 public ToysOrder(channel channel, productType productType) : base(channel, productType.Toys)
 {
     _channel     = channel;
     _productType = productType;
     processOrder();
 }
예제 #22
0
 public FurnitureOrder(channel channel, productType productType) : base(channel, productType.Furniture)
 {
     _channel     = channel;
     _productType = productType;
     processOrder();
 }
예제 #23
0
 //新增
 public static int Get_chanpinlbAdd(productType p)
 {
     return(YQdal.Get_chanpinlbAdd(p));
 }
예제 #24
0
 public Order(channel channel, productType productType)
 {
     this.Channel     = channel;
     this.productType = productType;
 }
예제 #25
0
        // Кнопка создания нового объекта конфигуратора
        private void createNewObjButton_Click(object sender, EventArgs e)
        {
            if (confTree.SelectedNode.Text == Resources.Configurator_Типы_объектов)
            {
                if (_dbConnection.ProductTypeThere(createObjText.Text))
                {
                    MessageBox.Show(Resources.Configurator_Указанный_тип_уже_существует, Resources.error_operation_msg);
                }
                else
                {
                    int isRooted = 0;
                    if (rootType.Checked)
                    {
                        isRooted = 1;
                    }
                      var productType = new productType()
                      {
                          typeName = createObjText.Text,
                          rootType = isRooted
                      };
                      db.productType.Add(productType);
                      db.SaveChanges();
                      confTree.Nodes[0].Nodes.Add(createObjText.Text);
                      createObjText.Text = null;
                      rootType.CheckState = CheckState.Unchecked;

                }
            }
            else
            {
                if (confTree.SelectedNode.Text == Resources.Configurator_Атрибуты_объектов)
                {
                    if (_dbConnection.ProductAttributeThere(createObjText.Text))
                    {
                        MessageBox.Show(Resources.Configurator_Указанный_атрибут_уже_существует, Resources.error_operation_msg);
                    }
                    else
                    {
                        _dbConnection.CreateAttribute(createObjText.Text);
                        confTree.Nodes[1].Nodes.Add(createObjText.Text);
                        createObjText.Text = null;
                    }
                }
            }
        }
예제 #26
0
 public ElectronicOrder(channel channel, productType productType) : base(channel, productType.Electronic)
 {
     _channel     = channel;
     _productType = productType;
     processOrder();
 }
예제 #27
0
        static void AddProduct()
        {
            ProductService productService = ServiceProvider.getProductService();
            productType    product        = new productType();

            product.categoryCode = "aaa";
            product.title        = "Test Ürünüdür";

            specType brandSpec = new specType();

            brandSpec.name     = "Marka";
            brandSpec.type     = "Combo";
            brandSpec.value    = "Nokia";
            brandSpec.required = true;
            specType modelSpec = new specType();

            modelSpec.name     = "Model";
            modelSpec.type     = "Combo";
            modelSpec.value    = "N73";
            modelSpec.required = true;
            specType statusSpec = new specType();

            statusSpec.name     = "Durumu";
            statusSpec.type     = "Combo";
            statusSpec.value    = "Sıfır";
            statusSpec.required = true;
            specType guaranteeSpec = new specType();

            guaranteeSpec.name     = "Garantisi";
            guaranteeSpec.type     = "Combo";
            guaranteeSpec.value    = "Yok";
            guaranteeSpec.required = true;
            specType[] specTypeArray = new specType[4];
            specTypeArray[0] = brandSpec;
            specTypeArray[1] = modelSpec;
            specTypeArray[2] = statusSpec;
            specTypeArray[3] = guaranteeSpec;
            product.specs    = specTypeArray;

            // set ProductPhoto
            photoType photo = new photoType();

            photo.photoId          = 0;
            photo.photoIdSpecified = true;
            photo.url = "http://img2.blogcu.com/images/o/r/g/orgudunyam1/cilek.jpg";
            photoType[] photoTypeArray = new photoType[1];
            photoTypeArray[0] = photo;
            product.photos    = photoTypeArray;

            product.pageTemplate          = 1;
            product.pageTemplateSpecified = true;
            product.description           = "Test ürünü açıklaması";
            product.format = "S";
            //product.startPrice = 3.50;
            //product.startPriceSpecified = true;
            product.buyNowPrice           = 49.50;
            product.buyNowPriceSpecified  = true;
            product.listingDays           = 30;
            product.listingDaysSpecified  = true;
            product.productCount          = 1;
            product.productCountSpecified = true;

            // set CargoDetail
            cargoDetailType cargoDetail = new cargoDetailType();

            cargoDetail.city = "34";
            String[] cargoCompany = new String[3];
            cargoCompany[0]            = "aras";
            cargoCompany[1]            = "mng";
            cargoDetail.cargoCompanies = cargoCompany;
            cargoCompanyDetailType cargoCompanyDetailType = new cargoCompanyDetailType();

            cargoCompanyDetailType.cityPrice    = "3.00";
            cargoCompanyDetailType.countryPrice = "5.00";
            cargoDetail.shippingPayment         = "B";
            cargoDetail.shippingWhere           = "city";
            product.cargoDetail = cargoDetail;

            product.affiliateOption = false;
            product.boldOption      = false;
            product.catalogOption   = false;
            product.vitrineOption   = false;
            product.startDate       = "2020-02-13 00:00:00";


            productServiceResponse response = productService.insertProduct("pc", product, true, false, "tr");

            if (response != null && response.ackCode.ToString().Equals("success"))
            {
                Console.WriteLine("Result: " + response.result);
                Console.WriteLine("ProductId: " + response.productId);
            }
            else
            {
                Console.WriteLine("ErrorId: " + response.error.errorId);
                Console.WriteLine("ErrorCode: " + response.error.errorCode);
                Console.WriteLine("ErrorMessage: " + response.error.message);
            }
        }
        /// <summary>
        /// Gets product type from product id.
        /// </summary>
        /// <param name="productId">Product id.</param>
        /// <returns>productType. Can be null.</returns>
        private productType GetProductTypeFromProductId(string productId)
        {
            Product           dbProduct        = null;
            string            connectionString = m_connectionString;
            List <AgentSkill> agentSkills      = null;
            productType       retVal           = null;

            if (!String.IsNullOrEmpty(productId) && !String.IsNullOrEmpty(connectionString))
            {
                using (ProductStore dataStore = new ProductStore(SqlHelper.Current.GetConnection(connectionString)))
                {
                    try
                    {
                        dbProduct = dataStore.Product.SingleOrDefault(p => p.Id.ToString().Equals(productId));
                        if (dbProduct != null)
                        {
                            //If we have product info. Query for agent skills associated with this product.
                            var allAgentSkillMappings = from a in dataStore.AgentSkillMapping
                                                        where a.ProductId == dbProduct.Id
                                                        select a;

                            agentSkills = new List <AgentSkill>();
                            foreach (var agentSkillMapping in allAgentSkillMappings)
                            {
                                if (agentSkillMapping.AgentSkillId.HasValue)
                                {
                                    AgentSkill agentSkill = dataStore.AgentSkill.SingleOrDefault(ask => ask.Id.ToString().Equals(agentSkillMapping.AgentSkillId));
                                    if (agentSkill != null)
                                    {
                                        agentSkills.Add(agentSkill);
                                    }
                                }
                            }
                        }
                    }
                    catch (SqlException sqlException)
                    {
                        Helper.Logger.Error("Sql exception occured {0}", EventLogger.ToString(sqlException));
                    }
                } // end of data store.
            }

            if (dbProduct != null)
            {
                retVal              = new productType();
                retVal.productGuid  = dbProduct.Id.ToString();
                retVal.productImage = dbProduct.Image;
                retVal.productPrice = dbProduct.Price.ToString();
                retVal.productTitle = dbProduct.Title;
                if (agentSkills != null && agentSkills.Count > 0)
                {
                    retVal.agentSkillsList = new agentSkillType[agentSkills.Count];
                    for (int i = 0; i < agentSkills.Count; i++)
                    {
                        agentSkillType agentSkillType = new agentSkillType();
                        agentSkillType.name       = agentSkills[i].SkillName;
                        agentSkillType.Value      = agentSkills[i].SkillValue;
                        retVal.agentSkillsList[i] = agentSkillType;
                    }
                }
            }

            return(retVal);
        }
예제 #29
0
        private IEnumerable <AgentSkill> ProcessMimeParts(IEnumerable <MimePartContentDescription> contextualData, out productType productInformation)
        {
            List <AgentSkill> listOfRequestedSkills = new List <AgentSkill>();

            List <MimePartContentDescription> listOfMimeParts = new List <MimePartContentDescription>(contextualData);

            productType product = null;

            _logger.Log(String.Format("Processing MIME parts {0}", listOfMimeParts.Count));

            bool success = true;

            listOfMimeParts.ForEach(mp =>
            {
                if (mp.ContentType.Equals(new ContentType("application/octet-stream")))
                {
                    try
                    {
                        //Now deserialize and make sure we have right data.

                        XmlSerializer serializer = new XmlSerializer(typeof(productType));

                        product = SerializerHelper.DeserializeObjectFragment(mp.GetBody(), serializer) as productType;

                        if (product != null &&
                            product.agentSkillsList != null &&
                            product.agentSkillsList.Length > 0)
                        {
                            List <agentSkillType> list = new List <agentSkillType>(product.agentSkillsList);
                            list.ForEach(sk =>
                            {
                                _logger.Log(String.Format("Finding skill name {0}", sk.name));
                                Skill skillFound = Skill.FindSkill(sk.name, _matchMaker.Configuration.Skills);
                                if (null != skillFound)
                                {
                                    if (!String.IsNullOrEmpty(sk.Value))
                                    {
                                        try
                                        {
                                            AgentSkill agentSkill = new AgentSkill(skillFound, sk.Value);
                                            listOfRequestedSkills.Add(agentSkill);
                                            _logger.Log(String.Format("Adding agent skill {0} value = {1}", skillFound, sk.Value));
                                        }
                                        catch (ArgumentException aex)
                                        {
                                            _logger.Log(String.Format("AcdPortal detected a skill value that is not provisioned {0}", sk.Value), aex);
                                        }
                                    }
                                }
                                else
                                {
                                    _logger.Log(String.Format("Skill name {0}. Not found", sk.name));
                                }
                            });
                        }
                        else
                        {
                            _logger.Log("Product is null or agentSkillsList is empty");
                        }
                    }
                    catch (XmlException xex)
                    {
                        _logger.Log("AcdPortal detected a derialization isssue", xex);
                        success = false;
                    }
                }
                else
                {
                    _logger.Log("Invalid content type");
                }
            });


            productInformation = product;


            if (success)
            {
                return(listOfRequestedSkills);
            }
            else
            {
                return(new List <AgentSkill>());
            }
        }