コード例 #1
0
ファイル: ConfigManager.cs プロジェクト: pigzhuzhu55/DisConf
        private void _itemWatcher_NodeChanged(string obj)
        {
            this._handler.Execute(() =>
            {
                using (MaintainWatcher mk = new MaintainWatcher(config.Host, 1000))
                {
                    ZooKeeper zk     = mk.ZooKeeper;
                    Stat stat        = new Stat();
                    var tmpdata      = zk.GetData(obj, false, stat);
                    string tmpString = System.Text.Encoding.UTF8.GetString(tmpdata);

                    ZNode znode = Deserialize(tmpString);
                    if (znode == null)
                    {
                        return;
                    }
                    znode.Version = stat.Version;

                    //获取本地的版本号,如果比服务器的低,则更新
                    string file  = Path.Combine(ClientPath, obj.TrimStart('/') + ".txt");
                    string text  = FileHelper.ReadFile(file);
                    ZNode zLocal = Deserialize(text);

                    if (zLocal == null || zLocal.Version < znode.Version)
                    {
                        FileHelper.WriteFile(file, znode.ToString());
                        LogHelper.WriteCustom($"更新节点:{$"{obj}"},值:{JsonHelper.ToNewtonJsonString(znode)}", "zookeeper\\", false);
                    }
                    //刷新内存值
                    this._itemWatcher.RefreshConfigValue(obj, znode.Value);
                }
            }, string.Format("Some thing is wrong with item '{0}'", obj));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: shanzm/ASP.NET-MVC
        public ActionResult GetZtreeNodeJson(int?Id)
        {
            string       sql          = "select * from Company where Pid=@Id";
            SqlParameter sqlParameter = new SqlParameter("@Id", Id ?? 1);//中国总公司的id=1
            DataTable    dt           = SqlHelper.GetDataTable(sql, System.Data.CommandType.Text, sqlParameter);
            List <ZNode> listZNode    = new List <ZNode>();

            foreach (DataRow row in dt.Rows)
            {
                ZNode zNode = new ZNode()
                {
                    Id   = Convert.ToInt32(row["Id"]),                              //节点Id
                    Name = row["Name"].ToString(),                                  //节点名字
                    Pid  = Convert.ToInt32(row["Pid"]),                             //父节点
                    Url  = "https://baike.baidu.com/item/" + row["Name"].ToString() //给节点添加超链接,可以在后台进行拼接,就像这里这样。
                };
                if (IsParent(zNode.Id) || zNode.Id == 10)
                {
                    zNode.IsParent = true;
                    zNode.Open     = true;
                }
                else
                {
                    zNode.IsParent = false;
                }
                listZNode.Add(zNode);
            }
            return(new JsonNetResult()
            {
                Data = listZNode
            });
        }
コード例 #3
0
ファイル: ConfigManager.cs プロジェクト: pigzhuzhu55/DisConf
        /// <summary>
        /// 反序列化
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static ZNode Deserialize(string text)
        {
            ZNode znode = null;

            try
            {
                //第一行是版本号
                //第二行是描述
                //第三行以后才是真正的值

                string[] tmps = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                int cnt = tmps.Length;

                if (cnt < 3)
                {
                    return(null);
                }
                znode             = new ZNode();
                znode.Version     = tmps[0].ToInt32();
                znode.Description = tmps[1];

                StringBuilder sb = new StringBuilder();
                for (int i = 2; i < cnt; i++)
                {
                    sb.AppendLine(tmps[i]);
                }
                znode.Value = sb.ToString().TrimEnd(new[] { '\r', '\n' });
            }
            catch
            {
            }
            return(znode);
        }
コード例 #4
0
        public ActionResult Index()
        {
            string       sql       = "select * from Company";
            DataTable    dt        = SqlHelper.GetDataTable(sql, System.Data.CommandType.Text);
            List <ZNode> listZNode = new List <ZNode>();

            foreach (DataRow row in dt.Rows)
            {
                ZNode zNode = new ZNode()
                {
                    Id   = Convert.ToInt32(row["Id"]),                              //节点Id
                    Name = row["Name"].ToString(),                                  //节点名字
                    Pid  = Convert.ToInt32(row["Pid"]),                             //父节点
                    Url  = "https://baike.baidu.com/item/" + row["Name"].ToString() //给节点添加超链接,可以在后台进行拼接,就像这里这样。
                };
                if (IsParent(zNode.Id))
                {
                    zNode.IsParent = true;
                    zNode.Open     = false;
                }
                else
                {
                    zNode.IsParent = false;
                }
                listZNode.Add(zNode);
            }
            return(new JsonNetResult()
            {
                Data = listZNode
            });
        }
コード例 #5
0
ファイル: ZListTests.cs プロジェクト: ZetKa98/Kata21List
        public void NodeTwoConnectCreateTest()
        {
            String contentFirstNode  = "This is first link";
            String contentSecondNode = "This is second link";
            String contentThirdNode  = "This is third link";

            ZNode nodeOne = new ZNode()
            {
                Index   = 1,
                Content = contentFirstNode
            };

            ZNode nodeTwo = new ZNode()
            {
                Index   = 2,
                Content = contentSecondNode
            };

            ZNode nodeThree = new ZNode()
            {
                Index   = 3,
                Content = contentThirdNode
            };

            nodeOne.NextNode = nodeTwo;
            nodeTwo.NextNode = nodeThree;

            nodeTwo.PreviousNode   = nodeOne;
            nodeThree.PreviousNode = nodeTwo;

            Assert.AreEqual(nodeOne, nodeThree.PreviousNode.PreviousNode);
        }
コード例 #6
0
ファイル: ZBTActionManager.cs プロジェクト: ZenCoderGames/ZAI
    // Edit this function when creating new nodes
    public static ZNode CreateNode(NODE_TYPE actionNodeType, ZNodeTree nodeTree, Rect nodeRect, JSON js)
    {
        ZNode node = null;

        if (actionNodeType == NODE_TYPE.SCALE)
        {
            node = new ZBTActionScale(nodeTree, nodeRect, js);
        }

        return(node);
    }
コード例 #7
0
        public async Task <BizResult <bool> > UpdateZNode(string path, ZNode node)
        {
            string[] strs = path.Split('/', StringSplitOptions.RemoveEmptyEntries);
            if (strs.LastOrDefault() != node.Key)
            {
                return(new BizResult <bool>(false, -1, "非法操作!"));
            }

            await _zookeeperClient.SetDataAsync(path, node);

            return(new BizResult <bool>(true));
        }
コード例 #8
0
ファイル: ZListTests.cs プロジェクト: ZetKa98/Kata21List
        public void NodeCreateTest()
        {
            String contentFirstNode  = "This is first link";
            String contentSecondNode = "This is second link";

            ZNode nodeOne = new ZNode()
            {
                Index   = 1,
                Content = contentFirstNode
            };

            ZNode nodeTwo = new ZNode()
            {
                Index   = 2,
                Content = contentSecondNode
            };

            nodeOne.NextNode = nodeTwo;

            Assert.AreEqual(contentSecondNode, nodeOne.NextNode.Content);
        }
コード例 #9
0
    public System.Xml.XmlDocument UploadProuctDefaultSKU(string UserId, string Password, ZNode.Libraries.Framework.Business.ZNodeGenericCollection<ProductEntity> ProductList, TList<SKUEntity> SKUList)
    {
        try
        {

            //Authorize Users
            bool IsAuthorized = Authorize(UserId, Password);

            if (IsAuthorized)
            {
                //Call Product insert/update method
                System.Xml.XmlDocument doc = InsertProduct(ProductList);

                string ResponseErrorCode = doc.SelectSingleNode("Response/ErrorCode").InnerText;
                string ResponseErrorDescription = doc.SelectSingleNode("Response/ErrorDescription").InnerText;

                //Check if any error encountered on the web service while processing our request
                if (ResponseErrorCode.Equals("0"))
                {
                    //Default Insert method
                    InsertDefaultSKU(SKUList);

                    XmlNode Node = doc.SelectSingleNode("Response/Data");

                    return CreateSOAPResponse("Data Uploaded Successfully!", "0", Node.Value + " of rows are affected in the product table");
                }

                return CreateSOAPResponse("","-1",ResponseErrorDescription);

            }
            else
            {
                return CreateSOAPResponse("", "1", ResponseMSG_UNAUTHORIZED);
            }
        }
        catch (Exception ex)
        {
            return CreateSOAPResponse("", "2", ResponseMSG_ERROR + "Reference: " + ex.Message);
        }
    }
コード例 #10
0
ファイル: orderStatus.aspx.cs プロジェクト: daniela12/gooptic
    private void SendEmailReceipt(ZNode.Libraries.DataAccess.Entities.Order order)
    {
        try
        {
            string senderEmail = ZNodeConfigManager.SiteConfig.CustomerServiceEmail;
            string recepientEmail = order.BillingEmailId;
            string subject = "Track your package";

            //get message text.
            StreamReader rw = new StreamReader(Server.MapPath(ZNodeConfigManager.EnvironmentConfig.ConfigPath + "TrackingNumber.htm"));
            string messageText = rw.ReadToEnd();
            Regex rx1 = new Regex("#BillingFirstName#", RegexOptions.IgnoreCase);
            messageText = rx1.Replace(messageText, order.BillingFirstName);

            Regex rx2 = new Regex("#BillingLastName#", RegexOptions.IgnoreCase);
            messageText = rx2.Replace(messageText, order.BillingLastName);

            Regex rx3 = new Regex("#Custom1#", RegexOptions.IgnoreCase);
            messageText = rx3.Replace(messageText, TrackingNumber.Text);

            Regex rx4 = new Regex("#TrackingMessage#", RegexOptions.IgnoreCase);
            if (order.ShippingIDSource.ShippingTypeID == 3)
            { messageText = rx4.Replace(messageText, "Your FedEx Tracking Number :  "); }
            else if (order.ShippingIDSource.ShippingTypeID == 2)
            { messageText = rx4.Replace(messageText, "Your UPS Tracking Number :  "); }
            else
            { messageText = rx4.Replace(messageText, ""); }

            Regex rx5 = new Regex("#Message#",RegexOptions.IgnoreCase);
             if (order.ShippingIDSource.ShippingTypeID == 3)
            {messageText = rx5.Replace(messageText, "We would like to inform you that your order has shipped. You can track your package using the tracking number given below:"); }
             else if (order.ShippingIDSource.ShippingTypeID == 2)
             { messageText = rx5.Replace(messageText, "We would like to inform you that your order has shipped. You can track your package using the tracking number given below:"); }
             else
             { messageText = rx5.Replace(messageText, "We would like to inform you that your order has shipped."); }

            ZNode.Libraries.Framework.Business.ZNodeEmail.SendEmail(recepientEmail, senderEmail, senderEmail, subject, messageText, true);

            trackmessage.Text = "Tracking Number Email Sent to " + "<a href=\"mailto:" + senderEmail.ToString() + "\">" + senderEmail + "</a>";

        }
        catch (Exception ex)
        {
            string senderEmail = ZNodeConfigManager.SiteConfig.CustomerServiceEmail;
            trackmessage.Text = "There was a problem sending the email to " + "<a href=\"mailto:" + senderEmail.ToString() + "\">" + senderEmail + "</a>";

            //log exception
            ExceptionPolicy.HandleException(ex, "ZNODE_GLOBAL_EXCEPTION_POLICY");
            //do not rethrow as this is non-critical
        }
    }
コード例 #11
0
        public async Task <BizResult <bool> > CreateZNode(string path, bool isParent, ZNode node)
        {
            if (node.Key.IndexOf('/') > 0 || node.Key.Contains("$$"))
            {
                return(new BizResult <bool>(false, -1, "Key不能包含 '/' 或者 '$$' 符号!"));
            }

            node.Key = node.Key.ToLower();
            var paths = path.Split('/', StringSplitOptions.RemoveEmptyEntries);

            if (paths.Count() > 1)
            {
                var existParentPath = string.Empty;
                foreach (var p in paths.Take(paths.Count() - 1))
                {
                    existParentPath += "/" + p;
                    if (await _zookeeperClient.ExistsAsync($"{existParentPath}/{node.Key}"))
                    {
                        return(new BizResult <bool>(false, -1, $"路径 {existParentPath} 下已存在相同名称的节点!"));
                    }
                }
            }

            var zpath = path + "/" + (isParent ? "$$" + node.Key : node.Key);

            if (await _zookeeperClient.ExistsAsync(zpath))
            {
                return(new BizResult <bool>(false, -1, $"Path:'{zpath.Replace("$$", "")}'节点已存在!"));
            }

            await _zookeeperClient.CreatePersistentAsync(zpath, node);

            return(new BizResult <bool>(true));
        }
コード例 #12
0
ファイル: ConfigManager.cs プロジェクト: pigzhuzhu55/DisConf
        /// <summary>
        /// 统一配置服务器站点的初始化
        /// </summary>
        public void InitServer()
        {
            var task = Task.Run(() =>
            {
                this._handler.Execute(() => {
                    //目前没考虑自定义配置 ,这里配置文件统一放置到zookeeper文件夹下
                    //同步zookeeper文件信息到zookeeper服务

                    if (!System.IO.Directory.Exists(RootPath))
                    {
                        System.IO.Directory.CreateDirectory(RootPath);
                    }

                    //第一级目录,我设想存放的是站点名称,我就存放站点对应的Key好了,类似1、2、3、4,你也可以自行扩展
                    var dirs = System.IO.Directory.GetDirectories(RootPath);

                    foreach (string dir in dirs)
                    {
                        string name = Path.GetFileName(dir);
                        using (MaintainWatcher mk = new MaintainWatcher(config.Host, 1000))
                        {
                            ZooKeeper zk = mk.ZooKeeper;
                            var stat     = zk.Exists($"/{name}", false);
                            if (stat == null)
                            {
                                zk.Create($"/{name}", "".GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);
                            }

                            var files = Directory.GetFiles(dir, "*.txt");

                            foreach (string file in files)
                            {
                                string key  = Path.GetFileNameWithoutExtension(file);
                                stat        = zk.Exists($"/{name}/{key}", false);
                                string text = FileHelper.ReadFile(file);

                                ZNode znode = Deserialize(text);

                                if (znode != null)
                                {
                                    if (stat == null)
                                    {
                                        zk.Create($"/{name}/{key}", znode.ToString().GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);
                                    }
                                    else
                                    {
                                        //文件的版本号比znode大,这样才去更新zookeeper服务器
                                        //if (znode.Version > stat.Version)
                                        {
                                            //下面没有事物处理,可能会有问题
                                            var tmpdata      = zk.GetData($"/{name}/{key}", false, null);
                                            string tmpString = System.Text.Encoding.UTF8.GetString(tmpdata);
                                            stat             = zk.SetData($"/{name}/{key}", znode.ToString().GetBytes(), -1);
                                            znode.Version    = stat.Version;
                                            FileHelper.WriteFile(file, znode.ToString());
                                        }
                                    }
                                }
                            }
                        }
                    }
                }, string.Empty);
            });

            task.Wait();
        }
コード例 #13
0
    public System.Xml.XmlDocument UploadRetailPrice(string UserId, string Password, ZNode.Libraries.Framework.Business.ZNodeGenericCollection<ProductSKUEntity> ProductSKUList)
    {
        try
        {

            //Authorize Users
            bool IsAuthorized = Authorize(UserId, Password);

            if (IsAuthorized)
            {
                string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ZNodeECommerceDB"].ConnectionString;

                //Call
                UploadProductRetailPrice(ProductSKUList, ConnectionString);

                return CreateSOAPResponse("Data Upload Success", "0", String.Empty);
            }
            else
            {
                return CreateSOAPResponse("", "1", ResponseMSG_UNAUTHORIZED);
            }
        }
        catch (Exception ex)
        {
            return CreateSOAPResponse("", "2", ResponseMSG_ERROR + "Reference: " + ex.Message);
        }
    }
コード例 #14
0
ファイル: ConfigManager.cs プロジェクト: pigzhuzhu55/DisConf
        /// <summary>
        /// 同步zookeeper服务并序列化成配置文件到本地
        /// 初始化
        /// </summary>
        public void InitClient()
        {
            var task = Task.Run(() =>
            {
                this._handler.Execute(() => {
                    StringBuilder logBuilder = new StringBuilder();

                    #region  步配置到本地
                    if (!Directory.Exists(ClientPath))
                    {
                        Directory.CreateDirectory(ClientPath);
                    }

                    logBuilder.AppendLine("同步zookeeper数据到本地\r\n");
                    using (MaintainWatcher mk = new MaintainWatcher(config.Host, 1000))
                    {
                        ZooKeeper zk = mk.ZooKeeper;
                        //本地站点的名称
                        string name = config.ClientInfo.AppName;
                        var stat    = zk.Exists($"/{name}", false);
                        if (stat == null)
                        {
                            return;
                        }
                        if (!System.IO.Directory.Exists(Path.Combine(ClientPath, name)))
                        {
                            System.IO.Directory.CreateDirectory(Path.Combine(ClientPath, name));
                        }

                        var children = zk.GetChildren($"/{name}", false);//取不到节点会报错
                        foreach (var child in children)
                        {
                            stat             = new Stat();
                            var tmpdata      = zk.GetData($"/{name}/{child}", false, stat);
                            string tmpString = System.Text.Encoding.UTF8.GetString(tmpdata);
                            ZNode znode      = Deserialize(tmpString);
                            if (znode == null)
                            {
                                continue;
                            }
                            znode.Version = stat.Version;

                            //看下本地的配置文件版本号,需要不需要更新
                            string file  = Path.Combine(ClientPath, name, child + ".txt");
                            string text  = FileHelper.ReadFile(file);
                            ZNode zLocal = Deserialize(text);

                            if (zLocal == null || zLocal.Version < znode.Version)
                            {
                                FileHelper.WriteFile(file, znode.ToString());
                                logBuilder.AppendLine($"下载节点:{$"/{name}/{child}"},值:{JsonHelper.ToNewtonJsonString(znode)}");
                            }
                        }
                    }
                    #endregion

                    #region 加载配置到内存
                    var files = Directory.GetFiles(Path.Combine(ClientPath, config.ClientInfo.AppName), "*.txt");
                    IZkTreeBuilder itemBuilder = new ZkTreeBuilder(config.ClientInfo.AppName);
                    foreach (string file in files)
                    {
                        string key  = Path.GetFileNameWithoutExtension(file);
                        string text = FileHelper.ReadFile(file);
                        ZNode znode = Deserialize(text);
                        if (znode == null)
                        {
                            continue;
                        }
                        itemBuilder.GetOrAddZnodeName($"/{config.ClientInfo.AppName}/{key}", znode.Value);
                    }
                    this._itemWatcher              = new NodeWatcher(config.Host, 30000, itemBuilder);
                    this._itemWatcher.NodeChanged += _itemWatcher_NodeChanged;
                    #endregion

                    LogHelper.WriteCustom(logBuilder.ToString(), "zookeeper\\", false);
                }, string.Empty);
            });

            task.Wait();
        }
コード例 #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ds"></param>
 /// <param name="appSettings"></param>
 /// <param name="connString"></param>
 private void UploadQuantityAvailble(ZNode.Libraries.Framework.Business.ZNodeGenericCollection<ProductSKUEntity> ProdSKUList, string connString)
 {
     # region Local Variables Declaration
コード例 #16
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="ds"></param>
    /// <param name="appSettings"></param>
    /// <param name="connString"></param>
    private void UploadProductRetailPrice(ZNode.Libraries.Framework.Business.ZNodeGenericCollection<ProductSKUEntity> ProdSKUList, string connString)
    {
        #region Local Variable Declaration
        SqlConnection conn = new SqlConnection(connString);
        ZNode.Libraries.DataAccess.Service.ProductService ProductServ = new ProductService();
        ZNode.Libraries.DataAccess.Service.SKUService ProductSKUServ = new SKUService();
        ZNode.Libraries.DataAccess.Service.AddOnValueService ProductAddOnValueServ = new AddOnValueService();
        #endregion

        foreach (ProductSKUEntity entity in ProdSKUList)
        {
            SKU _sku = new SKU();

            //Update Prodcut table
            int ProductID = GetProductBySKU(entity.SKU, connString);

            if (ProductID > 0)
            {
                Product _productObject = ProductServ.GetByProductID(ProductID);
                _productObject.RetailPrice = entity.RetailPrice;
                _productObject.SalePrice = entity.SalePrice;
                _productObject.WholesalePrice = entity.WholesalePrice;
                _productObject.UpdateDte = System.DateTime.Now;

                ProductServ.Update(_productObject);
            }

            //Update SKU table
            int SkuId = GetSkuID(entity.SKU, connString);

            if (SkuId > 0)
            {
                _sku = ProductSKUServ.GetBySKUID(SkuId);
                //Set Quantity available value
                _sku.RetailPriceOverride = entity.RetailPrice;
                _sku.SalePriceOverride = entity.SalePrice;
                _sku.WholesalePriceOverride = entity.WholesalePrice;

                _sku.UpdateDte = System.DateTime.Now;

                //Upate SKU
                ProductSKUServ.Update(_sku);
            }

            //Update Add-On table
            AddOnValue _addOnvalue = new AddOnValue();

            int AddOnValueId = GetSkuIDByAddOnValueSKU(entity.SKU, connString);

            if (AddOnValueId > 0)
            {
                _addOnvalue = ProductAddOnValueServ.GetByAddOnValueID(AddOnValueId);

                _addOnvalue.RetailPrice = entity.RetailPrice;
                _addOnvalue.SalePrice = entity.SalePrice;
                _addOnvalue.WholesalePrice = entity.WholesalePrice;

                _addOnvalue.UpdateDte = System.DateTime.Now;

                ProductAddOnValueServ.Update(_addOnvalue);
            }
        }
    }
コード例 #17
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="ProductList"></param>
    private System.Xml.XmlDocument InsertProduct(ZNode.Libraries.Framework.Business.ZNodeGenericCollection<ProductEntity> ProductList)
    {
        ZNode.Libraries.DataAccess.Service.ProductService ProductServ = new ProductService();
        string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ZNodeECommerceDB"].ConnectionString;
        int RowsAffected = 0;

        try
        {
            //Loop through the no.of items in the Product List object
            foreach (ProductEntity Entity in ProductList)
            {
                Product _product = new Product();

                int ProductId = GetProductID(Entity.ProductNum, ConnectionString);

                if (ProductId > 0)
                {
                    _product = ProductServ.GetByProductID(ProductId);
                }
                //Set Properties
                _product.Name = Entity.Name;
                _product.Description = Entity.Description;
                _product.FeaturesDesc = Entity.FeaturesDesc;
                _product.DisplayOrder = Entity.DisplayOrder;

                //General settings
                _product.PortalID = Entity.PortalID;
                _product.ProductNum = Entity.ProductNum;
                _product.ActiveInd = Entity.IsActive;
                _product.ImageFile = Entity.ImageFile;
                _product.RetailPrice = Entity.RetailPrice;
                _product.SalePrice = Entity.SalePrice;
                _product.WholesalePrice = Entity.WholesalePrice;

                //Display Settings
                _product.CallForPricing = Entity.CallForPricing;
                _product.HomepageSpecial = Entity.HomepageSpecial;
                _product.CategorySpecial = Entity.CategorySpecial;
                _product.Keywords = Entity.Keywords;

                //inventory Settings
                _product.BackOrderMsg = Entity.BackOrderMsg;
                _product.OutOfStockMsg = Entity.OutOfStockMsg;
                _product.InStockMsg = Entity.InStockMsg;

                // Product Type Section
                int ProductTypeId = ZnodeProductTypeInsert(Entity.PortalID, Entity.ProductTypeName, ConnectionString);

                if (ProductTypeId == 0)
                {
                    ProductTypeId = ZnodeProductTypeInsert(Entity.PortalID, Entity.ProductTypeName, ConnectionString);
                }

                //If product type is "Default" ,then SKU and Quantity on Hand values are updated into Product Table
                // Otherwise it will update the values into SKU table
                if (Entity.ProductTypeName.Equals("Default"))
                {
                    _product.QuantityOnHand = Entity.QuantityOnHand;
                    _product.SKU = Entity.SKU;

                    //remove Existing Skus for this product
                    ZNode.Libraries.Admin.SKUAdmin _skuAdmin = new ZNode.Libraries.Admin.SKUAdmin();
                    _skuAdmin.DeleteByProductId(ProductId);
                }
                else
                {
                    //Reset Default product Inventory settings
                    _product.QuantityOnHand = 0;
                    _product.SKU = Entity.SKU;
                }

                _product.ProductTypeID = ProductTypeId; // Set product type id

                int ManufacturerId = GetManufacturerID(Entity.ManufacturerName, ConnectionString);

                if (ManufacturerId == 0)
                {
                    _product.ManufacturerID = null; //If not exists ,then insert null to Manufacturerid
                }

                bool status = false;

                if (ProductId > 0)
                {
                    _product.UpdateDte = System.DateTime.Now;
                    status = ProductServ.Update(_product);
                }
                else
                {
                    status = ProductServ.Insert(_product);
                }

                if (status)
                {
                    RowsAffected++;
                }
            }
        }
        catch (Exception ex)
        { return CreateSOAPResponse("", "-2", ex.Message); }

        return CreateSOAPResponse(RowsAffected.ToString(),"0",""); ;
    }