示例#1
0
        public static SquareItem[] ToSvItems(this CatalogObject catalogObject)
        {
            if (!(catalogObject.Type == ItemCatalogObjectType || catalogObject.Type == ItemVariationCatalogObjectType))
            {
                return(null);
            }

            if (catalogObject.Type == ItemCatalogObjectType)
            {
                var items = new List <SquareItem>();

                foreach (var variation in catalogObject.ItemData.Variations)
                {
                    var variationItem = variation.ToSvItems().First();

                    items.Add(new SquareItem()
                    {
                        Id            = catalogObject.Id,
                        VariationId   = variationItem.Id,
                        CategoryId    = catalogObject.ItemData.CategoryId,
                        Description   = catalogObject.ItemData.Description,
                        Sku           = variationItem.Sku,
                        UPC           = variationItem.UPC,
                        Price         = variationItem.Price,
                        PriceCurrency = variationItem.PriceCurrency
                    });
                }

                return(items.ToArray());
            }

            return(new SquareItem[] { catalogObject.ToSvItemVariation() });
        }
示例#2
0
        private void showData(bool accesoryIsExist, string Barcode)
        {
            readAccessory(accesoryIsExist, Barcode);

            if (accessory.Id == 0 && accessory.TypeOfWarrantly == TypesOfLampsWarrantly.None)
            {
                accessory.TypeOfWarrantly = TypesOfLampsWarrantly.Without;
            }

            //Установить отсканированный штрихкод
            dbObject.SetValue(accessory, dbObject.BARCODE_NAME, Barcode);

            //Список кнопок переходов
            Dictionary <string, KeyValuePair <Type, object> > listOfDetail;
            //Список доступных полей для редактирования
            List <LabelForConstructor> listOfLabels = CatalogObject.GetDetailVisualPresenter(
                currentType, out listOfDetail, accessory);

            MainProcess.ToDoCommand = currentTopic;
            //Дополение списка переходов
            listOfDetail.Add(
                mainType == currentType ? nextBtnText : okBtnText,
                new KeyValuePair <Type, object>(mainType, null));

            //Отобразить доступные поля для редактирования
            drawEditableProperties(listOfLabels);
            //Отобразить кнопоки переходов
            drawButtons(listOfDetail);

            if (currentType == typeof(Cases))
            {
                groupRegistrationButton = MainProcess.CreateButton("Групова реєстрація", 5, 275, 230, 35, string.Empty, startGroupRegistration);
            }
            //MainProcess.CreateButton("Заповнити як попередній", 5, 275, 230, 35, string.Empty, fillFromPrev);
        }
示例#3
0
        static public async Task PortCatagories()
        {
            List <ShopifySharp.CustomCollection> list = await Shopify.GetCollections();

            List <CatalogObjectBatch> batches = new List <CatalogObjectBatch>();
            CatalogObjectBatch        batch   = new CatalogObjectBatch
            {
                Objects = new List <CatalogObject>()
            };

            batches.Add(batch);

            foreach (ShopifySharp.CustomCollection collection in list)
            {
                CatalogObject category = new CatalogObject(
                    Type: "CATEGORY",
                    Id: $"#{collection.Title}",
                    PresentAtAllLocations: true,
                    CategoryData: new CatalogCategory
                {
                    Name = collection.Title
                }
                    );
                batch.Objects.Add(category);
            }
            CatalogApi api = new CatalogApi();
            BatchUpsertCatalogObjectsRequest  body     = new BatchUpsertCatalogObjectsRequest(Guid.NewGuid().ToString(), batches);
            BatchUpsertCatalogObjectsResponse response = await api.BatchUpsertCatalogObjectsAsync(body);
        }
示例#4
0
        public void ToSvItemVariation()
        {
            const string id            = "asdfsdf";
            const string variationId   = "sladkfja";
            const string sku           = "testsku";
            const string upc           = "SLFDKDJ";
            long?        price         = 12;
            const string currency      = "USD";
            var          catalogObject = new CatalogObject(ItemsExtensions.ItemVariationCatalogObjectType, variationId)
            {
                ItemVariationData = new CatalogItemVariation(id)
                {
                    Sku        = sku,
                    Upc        = upc,
                    PriceMoney = new Money(price, currency)
                }
            };

            var result = catalogObject.ToSvItemVariation();

            result.Id.Should().Be(id);
            result.VariationId.Should().Be(variationId);
            result.Sku.Should().Be(sku);
            result.UPC.Should().Be(upc);
            result.Price.Should().Be(price);
            result.PriceCurrency.Should().Be(currency);
        }
示例#5
0
        public ActionResult DeleteConfirmed(int id)
        {
            CatalogObject catalogObject = db.CatalogObjects.Find(id);

            db.CatalogObjects.Remove(catalogObject);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#6
0
 private SSBakery.Models.CatalogCategory MapDtoToCategory(CatalogObject dto)
 {
     return(new Models.CatalogCategory()
     {
         Id = dto.Id,
         Name = dto.CategoryData.Name
     });
 }
示例#7
0
 public Document()
 {
     _catalog = new CatalogObject(GetNextObjectNumber());
     _pages = new PagesObject(GetNextObjectNumber());
     _catalog.AddPages(_pages);
     _fonts = new Fonts.Fonts();
     _xObjects = new XObjects();
 }
示例#8
0
    public void FillCatalogEntry(CatalogObject catalogObject)
    {
        _objectImage.sprite = catalogObject._sprite;
        _title.text         = catalogObject._objectName;
        _entry.text         = catalogObject._catalogEntry;
        int highscore = PlayerPrefs.GetInt("highScoresList_" + catalogObject._index);

        _highScore.text = highscore + "%";
    }
示例#9
0
 public ActionResult Edit([Bind(Include = "ID,ObjectName,OtherName,Price,DateAcquired")] CatalogObject catalogObject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(catalogObject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(catalogObject));
 }
示例#10
0
 private SSBakery.Models.CatalogItem MapDtoToItem(CatalogObject dto)
 {
     return(new SSBakery.Models.CatalogItem()
     {
         Id = dto.Id,
         Name = dto.ItemData.Name,
         Description = dto.ItemData.Description,
         Price = Convert.ToDecimal(dto.ItemData.Variations[0].ItemVariationData.PriceMoney.Amount / 100).ToString("C2"),
         CategoryId = dto.ItemData.CategoryId
     });
 }
示例#11
0
        public ActionResult Create([Bind(Include = "ID,ObjectName,OtherName,Price,DateAcquired")] CatalogObject catalogObject)
        {
            if (ModelState.IsValid)
            {
                db.CatalogObjects.Add(catalogObject);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(catalogObject));
        }
示例#12
0
        public override sealed void DrawControls()
        {
            if (IsLoad)
            {
                object idObj = getAcceptanceDoc();

                if (idObj != null)
                {
                    documentId = idObj;
                    acceptanceDoc.Read <AcceptanceOfNewComponents>(documentId);

                    string caseModel = CatalogObject.GetDescription(typeof(Models).Name, acceptanceDoc.CaseModel);
                    string lampModel = CatalogObject.GetDescription(typeof(Models).Name, acceptanceDoc.LampModel);
                    string unitModel = CatalogObject.GetDescription(typeof(Models).Name, acceptanceDoc.UnitModel);

                    caseModelRef = CatalogObject.GetSyncRef(typeof(Models).Name, acceptanceDoc.CaseModel);
                    lampModelRef = CatalogObject.GetSyncRef(typeof(Models).Name, acceptanceDoc.LampModel);
                    unitModelRef = CatalogObject.GetSyncRef(typeof(Models).Name, acceptanceDoc.UnitModel);

                    if (acceptanceDoc.CaseModel == 0)
                    {
                        selectedModelRef = acceptanceDoc.LampModel == 0
                                              ? unitModelRef
                                              : lampModelRef;
                    }
                    else
                    {
                        selectedModelRef = caseModelRef;
                    }
                    const string emptyModel = "-";
                    MainProcess.CreateLabel(
                        string.Concat("Корпус: ", string.IsNullOrEmpty(caseModel) ? emptyModel : caseModel)
                        , 5, 95, 230, MobileFontSize.Normal, MobileFontPosition.Left, MobileFontColors.Default);
                    MainProcess.CreateLabel(
                        string.Concat("Лампа: ", string.IsNullOrEmpty(lampModel) ? emptyModel : lampModel)
                        , 5, 130, 230, MobileFontSize.Normal, MobileFontPosition.Left, MobileFontColors.Default);
                    MainProcess.CreateLabel(
                        string.Concat("Блок: ", string.IsNullOrEmpty(unitModel) ? emptyModel : unitModel)
                        , 5, 165, 230, MobileFontSize.Normal, MobileFontPosition.Left, MobileFontColors.Default);
                    labelOfCount = MainProcess.CreateLabel("0", 0, 215, 240, MobileFontSize.Large,
                                                           MobileFontPosition.Center, MobileFontColors.Info);
                    MainProcess.CreateButton("Завершити приймання", 15, 275, 210, 35, "ok", ok_Click);
                }
                else
                {
                    MainProcess.CreateLabel(
                        "Не знайдено жодного відкритого документа \"Прийомка нового комплектуючого\" для обраного типу!",
                        5, 115, 230, 150, MobileFontSize.Multiline, MobileFontPosition.Center, MobileFontColors.Warning, FontStyle.Bold);
                }
            }
        }
示例#13
0
        // GET: CatalogObject/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CatalogObject catalogObject = db.CatalogObjects.Find(id);

            if (catalogObject == null)
            {
                return(HttpNotFound());
            }
            return(View(catalogObject));
        }
示例#14
0
        /// <summary>Отображение</summary>
        /// <param name="id">Id</param>
        /// <param name="typeOfAccessories">Тип комплектующего</param>
        private void showInfoById(long id, TypeOfAccessories typeOfAccessories)
        {
            MainProcess.ClearControls();

            ListOfLabelsConstructor list = new ListOfLabelsConstructor(MainProcess);
            string topic;
            Dictionary <string, KeyValuePair <Type, object> > listOfDetail;

            //Отображаем текстовое инфо о элементе
            list.ListOfLabels       = CatalogObject.GetVisualPresenter(id, typeOfAccessories, out topic, out listOfDetail);
            MainProcess.ToDoCommand = topic;
            //Отображаем кнопки для перехода на связанные элементы
            drawButtons(listOfDetail);
        }
示例#15
0
        // GET: CatalogObject/Edit/5
        public ActionResult Edit(int id)
        {
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}
            CatalogObject catalogObject = db.CatalogObjects.Find(id);

            if (catalogObject == null)
            {
                return(HttpNotFound());
            }
            return(View(catalogObject));
        }
示例#16
0
        public static SquareItem ToSvItemVariation(this CatalogObject catalogObject)
        {
            if (catalogObject.Type != ItemVariationCatalogObjectType)
            {
                return(null);
            }

            return(new SquareItem
            {
                Id = catalogObject.ItemVariationData.ItemId,
                VariationId = catalogObject.Id,
                Sku = catalogObject.ItemVariationData.Sku,
                UPC = catalogObject.ItemVariationData.Upc,
                Price = catalogObject.ItemVariationData.PriceMoney?.Amount,
                PriceCurrency = catalogObject.ItemVariationData.PriceMoney?.Currency
            });
        }
示例#17
0
        private SSBakery.Models.CatalogCategory UpdateCategoryCache(CatalogObject catalogObject, ISourceCache <SSBakery.Models.CatalogCategory, string> categoryCache)
        {
            var lookupResult = categoryCache.Lookup(catalogObject.Id);
            var isNew        = !lookupResult.HasValue;
            var category     = isNew ? null : lookupResult.Value;

            if (isNew)
            {
                category = MapDtoToCategory(catalogObject);
                categoryCache.AddOrUpdate(category);
            }
            else
            {
                category.Name = catalogObject.CategoryData.Name;
            }

            return(category);
        }
示例#18
0
        public bool AddObject(string objName, string objDesc, string objServicePrice, string objCategory, string objImagePath)
        {
            var newObject = new CatalogObject();

            newObject.ObjectName = objName;
            newObject.OtherName  = objDesc;
            newObject.Price      = Convert.ToDouble(objServicePrice);
            newObject.ImagePath  = objImagePath;
            newObject.CategoryID = Convert.ToInt32(objCategory);

            using (CatalogObjectContext _db = new CatalogObjectContext())
            {
                _db.CatalogObjects.Add(newObject);
                _db.SaveChanges();
            }

            // Success.
            return(true);
        }
        public void TestBatchRetrieveCatalogObjects()
        {
            var request = new BatchRetrieveCatalogObjectsRequest(ObjectIds: new List <string>()
            {
                idMap[COFFEE_ID],
                idMap[SALES_TAX_ID]
            });
            var response = instance.BatchRetrieveCatalogObjects(request);

            Assert.AreEqual(2, response.Objects.Count);

            CatalogObject actualCoffee = response.Objects[0];

            Assert.AreEqual(TypeEnum.ITEM, actualCoffee.Type);
            Assert.AreEqual(idMap[COFFEE_ID], actualCoffee.Id);

            CatalogObject actualTax = response.Objects[1];

            Assert.AreEqual(TypeEnum.TAX, actualTax.Type);
            Assert.AreEqual(idMap[SALES_TAX_ID], actualTax.Id);
        }
示例#20
0
    // Start is called before the first frame update
    void Start()
    {
        obj  = CatalogManager.Instance.GetCurrentObject();
        grid = GetComponent <GridLayoutGroup>();

        Rect rect = new Rect();

        rect        = ScrollViewTransform.rect;
        rect.width  = ScrollViewTransform.rect.width;
        rect.height = obj.Images[0].rect.height;
        ScrollViewTransform.rect.Set(rect.x, rect.y, rect.width, rect.height);

        Vector2 cellSize = new Vector2();

        cellSize.x    = ScrollViewTransform.rect.height;
        cellSize.y    = cellSize.x;
        grid.cellSize = cellSize;

        Populate();

        //SET TITLE
        Title.text       = obj.Name;
        Description.text = obj.Description;
    }
示例#21
0
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue.
//		public static async Task ProcessQueueMessage([TimerTrigger("0 */10 * * * *")]TimerInfo timer)
        public static async void ProcessQueueMessage([TimerTrigger("0 0 12 1/3 * *")] TimerInfo timer)
        {
            var issueCommandRepository = new IssueCommandRepository();
            var issueQueryRepository   = new IssueQueryRepository();
            var issueContext           = new IssueContext(issueQueryRepository, issueCommandRepository);
            var issueFactory           = new IssueFactory(issueContext);

            var titleCommandRepository = new TitleCommandRepository();
            var titleQueryRepository   = new TitleQueryRepository();
            var titleContext           = new TitleContext(titleQueryRepository, titleCommandRepository);
            var titleFactory           = new TitleFactory(titleContext);

            var publisherQueryRepository = new PublisherQueryRepository();
            var publisherContext         = new PublisherContext(publisherQueryRepository);
            var publisherFactory         = new PublisherFactory(publisherContext);

            var catalogContext = new CatalogContext(publisherFactory, titleFactory, issueFactory);

            var Catalog = new CatalogObject(catalogContext);

            await Catalog.Commands.NewReleases(0);

            var end = string.Empty;
        }
示例#22
0
        /// <summary>Создание объектов синхронизации</summary>
        /// <param name="table">Данные о объектах</param>
        /// <param name="skipExists">Пропустить существующие</param>
        /// <param name="deferredProperty">Список отложеных свойств</param>
        /// <param name="updId">Нужно обновить ID</param>
        private static void CreateSyncObject <T>(CatalogSynchronizer synchronizer, DataTable table, bool skipExists, ref List <DataAboutDeferredProperty> deferredProperty, bool updId) where T : dbObject
        {
            if (synchronizer != null)
            {
                int rowsCount = table.Rows.Count;
                for (int rowIndex = 0; rowIndex < rowsCount; rowIndex++)
                {
                    DataRow row = table.Rows[rowIndex];
                    synchronizer.Merge(row);

                    //if (rowIndex % 10 == 0)
                    {
                        Trace.WriteLine(string.Format("{1} %, rowIndex = {0} from {2}", rowIndex, (int)(100 * rowIndex / rowsCount), rowsCount));
                    }

                    //if (rowIndex % 500 == 0)
                    //    {
                    //    GC.Collect();
                    //    GC.WaitForPendingFinalizers();
                    //    }
                }
                return;
            }

            Type type = typeof(T);

            PropertyInfo[] properties        = type.GetProperties();
            string         syncRef           = string.Empty;
            string         syncRefName       = dbObject.SYNCREF_NAME.ToLower();
            int            lastDeferredIndex = deferredProperty.Count;

            foreach (DataRow row in table.Rows)
            {
                object newObj       = Activator.CreateInstance(typeof(T));
                T      newObject    = (T)newObj;
                bool   needDeferred = false;

                foreach (PropertyInfo property in properties)
                {
                    dbFieldAtt attribute = Attribute.GetCustomAttribute(property, typeof(dbFieldAtt)) as dbFieldAtt;

                    if (attribute != null && table.Columns.Contains(property.Name))
                    {
                        object value = row[property.Name];

                        //Не существует ли елемент с такой ссылкой?
                        if (property.Name.ToLower().Equals(syncRefName))
                        {
                            if (BarcodeWorker.IsRefExist(type, value.ToString()))
                            {
                                if (skipExists)
                                {
                                    break;
                                }

                                newObject.SetNotNew();
                            }

                            syncRef = value.ToString();
                        }
                        else if (updId && property.Name.ToLower().Equals(dbObject.IDENTIFIER_NAME))
                        {
                            continue;
                        }

                        if (property.PropertyType == typeof(int))
                        {
                            value = string.IsNullOrEmpty(value.ToString()) ? 0 : Convert.ToInt32(value);
                        }
                        else if (property.PropertyType == typeof(double))
                        {
                            value = string.IsNullOrEmpty(value.ToString()) ? 0D : Convert.ToDouble(value);
                        }
                        else if (property.PropertyType == typeof(long))
                        {
                            if (attribute.dbObjectType == null)
                            {
                                value = string.IsNullOrEmpty(value.ToString()) ? 0L : Convert.ToInt64(value);
                            }
                            else
                            {
                                if (value != null && !string.IsNullOrEmpty(value.ToString()))
                                {
                                    DataAboutDeferredProperty data = new DataAboutDeferredProperty(type, attribute.dbObjectType, property.Name, value);
                                    deferredProperty.Add(data);
                                    needDeferred = true;
                                }

                                value = 0L;
                            }
                        }
                        else if (property.PropertyType == typeof(bool))
                        {
                            value = Convert.ToBoolean(value);
                        }
                        else if (property.PropertyType == typeof(DateTime))
                        {
                            value = StringParser.ParseDateTime(value);
                        }
                        else if (property.PropertyType.IsEnum)
                        {
                            value = Enum.Parse(property.PropertyType, value.ToString(), false);
                        }
                        else if (property.PropertyType == typeof(string))
                        {
                            string fullValue = value.ToString();
                            value = value.ToString();

                            if (property.Name != CatalogObject.DESCRIPTION)
                            {
                                int length = attribute.StrLength == 0
                                                 ? dbFieldAtt.DEFAULT_STR_LENGTH
                                                 : attribute.StrLength;

                                if (fullValue.Length > length)
                                {
                                    value = fullValue.Substring(0, length);
                                }
                            }
                        }

                        property.SetValue(newObject, value, null);
                    }
                }

                ISynced syncObject = newObject as ISynced;

                if (syncObject != null)
                {
                    syncObject.IsSynced = true;
                }

                if (updId && !skipExists && !string.IsNullOrEmpty(syncRef))
                {
                    newObject.Id = Convert.ToInt64(BarcodeWorker.GetIdByRef(type, syncRef));
                }

                CatalogObject catalog = newObject as CatalogObject;

                if (catalog != null)
                {
                    dbElementAtt attribute = Attribute.GetCustomAttribute(newObject.GetType(), typeof(dbElementAtt)) as dbElementAtt;
                    int          length    = attribute == null || attribute.DescriptionLength == 0
                                     ? dbElementAtt.DEFAULT_DES_LENGTH
                                     : attribute.DescriptionLength;

                    if (catalog.Description.Length > length)
                    {
                        catalog.Description = catalog.Description.Substring(0, length);
                    }
                }

                newObject.Sync <T>(updId);

                if (needDeferred)
                {
                    for (int i = lastDeferredIndex; i < deferredProperty.Count; i++)
                    {
                        deferredProperty[i].Id = newObject.Id;
                    }

                    lastDeferredIndex = deferredProperty.Count;
                }
            }
        }
示例#23
0
 public void SetCurrentModel(CatalogObject model)
 {
     CatalogActiveObject  = model;
     CurrentCatalogObject = model;
 }
示例#24
0
        static public async Task PortItemsAsync2(string locationId)
        {
            List <ShopifySharp.Product> products = await Shopify.GetProductsAsync();

            List <CatalogObjectBatch> batches = new List <CatalogObjectBatch>();
            CatalogObjectBatch        batch   = new CatalogObjectBatch
            {
                Objects = new List <CatalogObject>()
            };

            batches.Add(batch);

            CatalogObject tax = new CatalogObject(
                "TAX",
                Id: $"#salestax",
                PresentAtAllLocations: true,
                TaxData: new CatalogTax
            {
                Name = "SalesTax",
                AppliesToCustomAmounts = true,
                CalculationPhase       = "SUBTOTALPHASE",
                Enabled       = true,
                InclusionType = "ADDITIVE",
                Percentage    = "8.9"
            }
                );

            CatalogObject employee = new CatalogObject(
                Type: "DISCOUNT",
                Id: $"#employee",
                PresentAtAllLocations: true,
                DiscountData: new CatalogDiscount
            {
                Name         = "Employee",
                DiscountType = "FIXEDPERCENTAGE",
                LabelColor   = "Red",
                PinRequired  = false,
                Percentage   = "40"
            }
                );

            batch.Objects.Add(tax);
            foreach (ShopifySharp.Product prod in products)
            {
                CatalogObject obj = new CatalogObject(
                    Type: "ITEM",
                    Id: $"#{prod.Title}",
                    PresentAtAllLocations: true,
                    ItemData: new CatalogItem
                {
                    Name = prod.Title,
                    //						Description = prod.,
                    //					CategoryId = "#Beverages",
                    TaxIds = new List <string>()
                    {
                        "#salestax"
                    },
                    Variations = new List <CatalogObject>()
                }
                    );
                foreach (ShopifySharp.ProductVariant variant in prod.Variants)
                {
                    CatalogObject vari = new CatalogObject
                                         (
                        Type: "ITEMVARIATION",
                        Id: $"#{prod.Title}-{variant.Title}",
                        PresentAtAllLocations: true,
                        ItemVariationData: new CatalogItemVariation()
                    {
                        UserData       = variant.Id.ToString(),
                        Upc            = variant.Barcode,
                        ItemId         = $"#{prod.Title}",
                        Name           = variant.Title,
                        TrackInventory = true,
                        PricingType    = "FIXEDPRICING",
                        PriceMoney     = new Money(
                            Amount: variant.Price.HasValue ? ((long?)(variant.Price.Value * 100L)) : null,
                            Currency: "USD"
                            )
                    }
                                         );
                    obj.ItemData.Variations.Add(vari);
                }
                batch.Objects.Add(obj);
            }

            CatalogApi api = new CatalogApi();

            BatchUpsertCatalogObjectsRequest  body     = new BatchUpsertCatalogObjectsRequest(Guid.NewGuid().ToString(), batches);
            BatchUpsertCatalogObjectsResponse response = await api.BatchUpsertCatalogObjectsAsync(body);

            foreach (CatalogObject item in response.Objects.Where(o => o.Type == "ITEM"))
            {
                if (!string.IsNullOrEmpty(item.ItemData.Variations?[0].ItemVariationData.UserData))
                {
                    long oldId = long.Parse(item.ItemData.Variations?[0].ItemVariationData.UserData);
                    ShopifySharp.Product prod = products.FirstOrDefault(p => p.Variants.Any(v => v.Id == oldId));

                    await ImageUploader.PortImage(locationId, item.Id, prod.Images.First().Src);
                }
            }
        }
示例#25
0
        public void loadSQL(string name, string path)
        {
            string        sConn   = @"server=" + this.strServer + "; database=" + this.strDataBase + ";user id=" + this.strUsername + ";password="******";";
            SqlConnection objConn = new SqlConnection(sConn);

            objConn.Open();

            ///BizagiInfo.xml
            ///Catalog__Indexes.xml
            ///Catalog__IndexObjects.xml
            ///Catalog__Localization.xml
            ///Catalog__Objects.xml
            ///Catalog__References.xml
            ///Options.xml
            ///PackageInfo.xml
            ///Relational.xml
            ///
            if (name.ToLower() == "packageinfo.xml")
            {
                //var xmlCO = File.ReadAllText(path);
                //XmlSerializer serializer = new XmlSerializer(typeof(PackageContentInformation));
                //StringReader rdr = new StringReader(xmlCO);
                //PackageContentInformation packageContentInformation = (PackageContentInformation)serializer.Deserialize(rdr);
                //this.PackageContentInformation = packageContentInformation;

                //propertyGrid1.SelectedObject = packageContentInformation;
                //txtContent.Text = xmlCO;
            }
            if (name.ToLower() == "relational.xml")
            {
                string     sTSQL  = "SELECT * from BADPLYCONFIG";
                SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
                objCmd.CommandType = CommandType.Text;
                SqlDataReader dr = objCmd.ExecuteReader();
                dr.Read();
                var dFile = dr["baDplyConfigFile"];
                var m_oDefaultEncodingForXML = new UTF8Encoding(false, true);
                //var texto = Encoding.Unicode.GetString((byte[])dFile);
                var texto          = Compression.DecompressString((byte[])dFile, m_oDefaultEncodingForXML);
                var textoFormatado = "";
                if (texto.StartsWith("<?xml") || texto.Contains("xmlns="))
                {
                    textoFormatado = texto;
                }
                else
                {
                    textoFormatado = Newtonsoft.Json.Linq.JToken.Parse(texto).ToString();
                }

                NewDataSet bADPLYCONFIG = new NewDataSet();
                bADPLYCONFIG.BADPLYCONFIG = new List <BADPLYCONFIG>();

                BADPLYCONFIG bi = new BADPLYCONFIG();

                bi.BaDplyConfigFile = textoFormatado;
                bi.DcFileVersion    = ((byte)dr["dcFileVersion"]).ToString();
                bi.DcMapType        = ((byte)dr["dcMapType"]).ToString();
                bi.DplyBADplyConfig = ((byte)dr["dplyBADplyConfig"]).ToString();
                bi.GuidBADplyConfig = ((System.Guid)dr["guidBADplyConfig"]).ToString();
                bi.IdBaDplyConfig   = ((int)dr["idBaDplyConfig"]).ToString();

                bADPLYCONFIG.BADPLYCONFIG.Add(bi);

                this.BADPLYConfig = bADPLYCONFIG;
                var jdata = Newtonsoft.Json.JsonConvert.SerializeObject(bADPLYCONFIG);
                txtContent.Text = Newtonsoft.Json.Linq.JToken.Parse(jdata).ToString();
            }

            if (name.ToLower() == "options.xml")
            {
                //var xmlCO = File.ReadAllText(path);
                //XmlSerializer serializer = new XmlSerializer(typeof(AdvancedOptions));
                //StringReader rdr = new StringReader(xmlCO);
                //AdvancedOptions advancedOptions = (AdvancedOptions)serializer.Deserialize(rdr);
                //this.AdvancedOptions = advancedOptions;
                //var dic = new Dictionary<string, string>();
                //var option = advancedOptions.AdvancedOption.FirstOrDefault();
                //if (option != null)
                //    propertyGrid1.SelectedObject = option;
                //txtContent.Text = xmlCO;
            }
            if (name.ToLower() == "bizagiinfo.xml")
            {
                //select * from BIZAGIINFO
                string     sTSQL  = "SELECT * from BIZAGIINFO";
                SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
                objCmd.CommandType = CommandType.Text;
                SqlDataReader dr         = objCmd.ExecuteReader();
                NewDataSet    bizagiInfo = new NewDataSet();
                bizagiInfo.BIZAGIINFO = new List <BIZAGIINFO>();
                while (dr.Read())
                {
                    BIZAGIINFO bi = new BIZAGIINFO
                    {
                        BAInfo  = (string)dr["BAInfo"],
                        BAValue = (string)dr["BAValue"]
                    };
                    bizagiInfo.BIZAGIINFO.Add(bi);
                }
                this.BizagiInfo = bizagiInfo;
                var dic = new Dictionary <string, string>();
                foreach (var b in bizagiInfo.BIZAGIINFO)
                {
                    dic.Add(b.BAInfo, b.BAValue);
                }
                propertyGrid1.SelectedObject = new DictionaryPropertyGridAdapter(dic);
                txtContent.Text = "";
            }
            if (name.ToLower() == "catalog__references.xml")
            {
                // var xmlCO = File.ReadAllText(path);
                string     sTSQL  = "SELECT * from BACATALOGREFERENCE";
                SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
                objCmd.CommandType = CommandType.Text;
                SqlDataReader dr = objCmd.ExecuteReader();

                ArrayOfReference catalogReferences = new ArrayOfReference();
                CatalogReferences.Reference = new List <Reference>();
                while (dr.Read())
                {
                    Reference bi = new Reference();
                    bi.Deleted  = ((byte)dr["Deleted"]).ToString();
                    bi.Pointer  = ((System.Guid)dr["guidPointer"]).ToString();
                    bi.Referrer = ((System.Guid)dr["guidObjectRef"]).ToString();
                    bi.Root     = ((System.Guid)dr["rootObject"]).ToString();
                    bi.Target   = ((System.Guid)dr["guidObjectTarget"]).ToString();

                    CatalogReferences.Reference.Add(bi);
                }

                this.CatalogReferences = catalogReferences;

                FilterReferences(catalogReferences.Reference);

                //txtContent.Text = xmlCO;
            }
            if (name.ToLower() == "catalog__objects.xml")
            {
                //string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);

                string     sTSQL  = "SELECT * from vwBA_Catalog_BABIZAGICATALOG";
                SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
                objCmd.CommandType = CommandType.Text;
                SqlDataReader dr = objCmd.ExecuteReader();


                CatalogObject catOb = new CatalogObject();

                ArrayOfCatalogObject resultingMessage = new ArrayOfCatalogObject();
                resultingMessage.CatalogObject = new List <CatalogObject>();
                while (dr.Read())
                {
                    CatalogObject bi = new CatalogObject();
                    //bi.CatalogReferences = ((byte)dr["Deleted"]).ToString();
                    bi.ChangeSetId = dr["changeSetId"] == DBNull.Value ? "" : ((int)dr["changeSetId"]).ToString();
                    bi.Type        = dr["objTypeName"] == DBNull.Value ? "" : ((string)dr["objTypeName"]);
                    var byCont = (byte[])dr["objContent"];
                    bi.Content = Convert.ToBase64String(byCont, 0, byCont.Length);
                    try
                    {
                        var texto          = Encoding.Unicode.GetString(byCont);
                        var textoFormatado = "";
                        if (texto.StartsWith("<?xml"))
                        {
                            textoFormatado = texto;
                        }
                        else
                        {
                            textoFormatado = Newtonsoft.Json.Linq.JToken.Parse(texto).ToString();
                        }
                        bi.Content = textoFormatado;
                    }
                    catch (Exception)
                    {
                        //   throw;
                    }


                    bi.ParentId       = dr["guidObjectParent"] == DBNull.Value ? "" : ((System.Guid)dr["guidObjectParent"]).ToString();
                    bi.DeployOnParent = dr["DeployOnParent"] == DBNull.Value ? "false" : ((bool)dr["DeployOnParent"]).ToString();// ((byte)dr["DeployOnParent"]).ToString();
                    bi.HasOverride    = dr["isOverride"] == DBNull.Value ? "false" : ((string)dr["isOverride"]);
                    bi.ContentFormat  = ((byte)dr["contentFormat"]).ToString();
                    bi.Deleted        = dr["Deleted"] == DBNull.Value ? "false" : ((bool)dr["Deleted"]).ToString();
                    bi.DeployOnParent = dr["deployOnParent"] == DBNull.Value ? "false" : ((bool)dr["deployOnParent"]).ToString();; // ((byte)dr["deployOnParent"]).ToString();
                    bi.Dicionario     = new Dictionary <string, object>();
                    bi.Id             = ((System.Guid)dr["guidObject"]).ToString();
                    bi.Indexes        = new Indexes();
                    bi.ModifiedByUser = (string)dr["modifiedByUser"];
                    bi.Name           = (string)dr["objName"];
                    bi.ParentId       = dr["guidObjectParent"] == DBNull.Value ? "":((System.Guid)dr["guidObjectParent"]).ToString();
                    bi.References     = new References();
                    bi.Root           = dr["rootObject"] == DBNull.Value ? "" : ((System.Guid)dr["rootObject"]).ToString();
                    bi.Tags           = new Tags();


                    bi.Version = ((int)dr["mtdVersion"]).ToString();
                    resultingMessage.CatalogObject.Add(bi);
                }

                this.DataCatalog = resultingMessage;
                propertyGrid1.SelectedObjects = resultingMessage.CatalogObject.ToArray();
                this.Tabelas = new List <CatalogObject>();
                this.Types   = new List <TipoObjeto>();
                this.Types   = FillTypes(resultingMessage.CatalogObject).OrderBy(d => d.Tipo).ToList();
                cmbType.Items.Clear();
                foreach (var tb in this.Types)
                {
                    cmbType.Items.Add(new ComboIten {
                        Name = tb.Tipo, Value = tb.Tipo, Catalogos = tb.Objetos
                    });
                }
                this.Tabelas = FillTabelas(resultingMessage.CatalogObject);

                Filter(resultingMessage.CatalogObject);
            }
            if (name.ToLower() == "catalog__indexes.xml")
            {
                string     sTSQL  = "SELECT * from BATAGVALUE";
                SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
                objCmd.CommandType = CommandType.Text;
                SqlDataReader dr = objCmd.ExecuteReader();

                ArrayOfIndexValue cIndex = new ArrayOfIndexValue();
                cIndex.IndexValueIn = new List <IndexValue>();
                while (dr.Read())
                {
                    IndexValue bi = new IndexValue();
                    bi.Deleted   = dr["Deleted"] == DBNull.Value?"false": ((bool)dr["Deleted"]).ToString();
                    bi.IndexName = ((string)dr["tagName"]);
                    bi.ObjectId  = ((System.Guid)dr["taggedObject"]).ToString();
                    bi.Root      = ((System.Guid)dr["rootObject"]).ToString();
                    bi.TagType   = ((System.Guid)dr["tagType"]).ToString();
                    bi.Value     = (string)dr["value"];
                    cIndex.IndexValueIn.Add(bi);
                }

                this.DataCatalogIndex = cIndex;
            }
            objConn.Close();
        }
 public TitleObject Create(CatalogObject catalog)
 {
     return(new TitleObject(catalog, Context));
 }
 public TitleObject(CatalogObject owner, ITitleContext context)
 {
     Owner   = owner;
     Context = context;
 }
示例#28
0
 public void SetCurrentObject(CatalogObject catalogObject)
 {
     CurrentObject = catalogObject;
 }
示例#29
0
 public CatalogController(ICatalogContext catalogContext)
 {
     Catalog = new CatalogObject(catalogContext);
 }
示例#30
0
 public void SetCurrentModel(CatalogObject model) => Controller.SetCurrentModel(model);
 public IssueObject(CatalogObject owner, IIssueContext context)
 {
     Owner   = owner;
     Context = context;
 }