private OCode ImportType(DataRow var, string codeTypeName, OCode parentCode,string pri) { string mapColName = map[codeTypeName]; string typeName = ConvertToString(var[mapColName]); OCode code = null; //if (typeName == null) //{ // typeName = Strings.Types_Others; //} code = CreateCode(typeName, codeTypeName, parentCode.ObjectID, true,pri); return code; }
private static OCatalogue CreateCatalogue(string catalogueName, Guid? parentId, int type, OCode unitOfMeasure, decimal sellingPrice, string stockCode, string inventoryCatalogType) { OCatalogue catalogue = TablesLogic.tCatalogue.Create(); catalogue.ObjectName = catalogueName; //if (type == 0) //{ catalogue.ParentID = parentId; //} catalogue.IsCatalogueItem = type; catalogue.UnitOfMeasureID = unitOfMeasure == null ? null : unitOfMeasure.ObjectID; catalogue.UnitPrice = sellingPrice; catalogue.StockCode = stockCode; catalogue.InventoryCatalogType = inventoryCatalogType.ToUpper() == "CONSUMABLE" ? InventoryCatalogType.Consumable : InventoryCatalogType.NonConsumable; SaveObject(catalogue); if (type == 0) { if (!catalogueGroupList.ContainsKey(catalogueName)) { catalogueGroupList.Add(catalogueName, catalogue.ObjectID); } } return catalogue; }
private static OCode CreateUnitOfMeasure(string unit) { if (UnitOfMeasureType == null) { UnitOfMeasureType = TablesLogic.tCodeType.Load(TablesLogic.tCodeType.ObjectName == Strings.UnitOfMeasureTypeName, true, null); if (UnitOfMeasureType != null) { ActivateObject(UnitOfMeasureType); } else { throw new ApplicationException(String.Format("CodeType '{0}' doesn't exist.", Strings.UnitOfMeasureTypeName)); } } if (unitOfMeasureRoot == null) { unitOfMeasureRoot = TablesLogic.tCode.Load(TablesLogic.tCode.ObjectName == Strings.UnitOfMeasureRootName, true, null); } if (String.IsNullOrEmpty(unit)) { throw new ApplicationException("UnitOfMeasure required."); } OCode code = TablesLogic.tCode.Create(); code.ObjectName = unit; code.CodeTypeID = UnitOfMeasureType.ObjectID; code.ParentID = unitOfMeasureRoot.ObjectID; SaveObject(code); return code; }
private static OCatalogue CreateCatalogue(string catalogueName, Guid? parentId, int type, OCode unitOfMeasure, decimal sellingPrice, string stockCode, string inventoryCatalogType, string premiumType, string storeName, string manufacturer, string model, string tax) { OCatalogue catalogue = TablesLogic.tCatalogue.Create(); catalogue.ObjectName = catalogueName; //if (type == 0) //{ catalogue.ParentID = parentId; //} catalogue.IsCatalogueItem = type; catalogue.UnitOfMeasureID = unitOfMeasure == null ? null : unitOfMeasure.ObjectID; catalogue.UnitPrice = sellingPrice; catalogue.StockCode = stockCode; catalogue.InventoryCatalogType = inventoryCatalogType.ToUpper() == "CONSUMABLE" ? InventoryCatalogType.Consumable : InventoryCatalogType.NonConsumable; catalogue.Manufacturer = manufacturer; catalogue.Model = model; try { int inputtax = Convert.ToInt32(tax); catalogue.HasInputTax = inputtax; } catch { } if (premiumType == "Sponsored") catalogue.PremiumType = 1; else if (premiumType == "Purchased") catalogue.PremiumType = 2; else if (premiumType == "Bartered") catalogue.PremiumType = 0; OStore store = TablesLogic.tStore.Load(TablesLogic.tStore.ObjectName == storeName); if (store != null) catalogue.Store.Add(store); else catalogue.IsSharedAcrossAllStores = 1; SaveObject(catalogue); if (type == 0) { if (!catalogueGroupList.ContainsKey(catalogueName)) { catalogueGroupList.Add(catalogueName, catalogue.ObjectID); } } return catalogue; }