protected void grdDataWarehouseUnit_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e) { string[] args = e.Parameters.Split('|'); switch (args[0]) { case "delete": try { if (args.Length > 1) { Guid recordId = Guid.Parse(args[1]); InventoryUnit editManufacturerOrg = session.GetObjectByKey <InventoryUnit>(recordId); //editManufacturerOrg.Code = txtCode.Text; editManufacturerOrg.RowStatus = Utility.Constant.ROWSTATUS_DELETED; editManufacturerOrg.Save(); this.grdDataWarehouseUnit.JSProperties.Add("cpEvent", "deleted"); } else { throw new Exception("Must be pass id of the record"); } } catch (Exception) { throw; } break; default: break; } }
public InventoryItem(int id, string name, int quantity, InventoryUnit unit, InventoryRecordStatus status) { Id = id; Name = name; Quantity = quantity; Unit = unit; Status = status; }
public ItemUsage(int id, int itemid, string name, int quantity, InventoryUnit unit) { Id = id; ItemId = itemid; Name = name; Quantity = quantity; Unit = unit; }
protected void treelstToolUnits_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { //DND //Guid inventoryID = PrivateSession.Instance.InventoryId; Guid inventoryUnitId = Guid.Parse(e.NewValues["InventoryUnitId!Key"].ToString()); Boolean check = false; InventoryBO bo = new InventoryBO(); Guid checkGuid = Guid.Empty; List <Guid> inventotyUnitList = new List <Guid>(); bo.getInventoryTree(session, PrivateSession.Instance.InventoryId, ref inventotyUnitList); if (inventotyUnitList != null || inventotyUnitList.Count > 0) { checkGuid = inventotyUnitList.Find(p => p == inventoryUnitId); } if (!Guid.Equals(checkGuid, Guid.Empty)) { check = true; } Guid parentInventotyId; if (!treelstToolUnits.NewNodeParentKey.Equals(String.Empty)) { parentInventotyId = Guid.Parse(treelstToolUnits.NewNodeParentKey); // parentInventotyId = PrivateSession.Instance.InventoryId; if (bo.checkIsAlreadyHaveAChild(session, parentInventotyId)) { throw new Exception(String.Format("Lỗi: 1 nhánh chỉ được tạo 1 đơn vị lưu trữ")); } } if (check == true) { //SQL search Name trong InventoryUnit XPCollection <InventoryUnit> collectionUnit = new XPCollection <InventoryUnit>(session); collectionUnit.Criteria = CriteriaOperator.And( new BinaryOperator("InventoryUnitId", inventoryUnitId, BinaryOperatorType.Equal), new BinaryOperator("RowStatus", 1, BinaryOperatorType.Equal) ); InventoryUnit nameInventoryUnit = collectionUnit.First(); //Sau khi search lay duoc Mang gia tri //nameInventoryUnit . goi ra ten cot can lay throw new Exception(String.Format("Lỗi trùng đơn vị lưu trữ {0} trên cây", nameInventoryUnit.Name.ToString())); } else { string parentKey = treelstToolUnits.NewNodeParentKey; if (parentKey.Equals(String.Empty)) { e.NewValues["ParentInventoryId!Key"] = this.treelstToolUnits.RootValue; } } //END DND }
protected void popWarehouseUnitEdit_WindowCallback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { string[] args = e.Parameter.Split('|'); switch (args[0]) { case "new": InventoryUnit invUnit = InventoryUnit.InitNewRow(this.session); PrivateSession.Instance.InventoryUnitId = invUnit.InventoryUnitId; this.dsInventoryUnit.CriteriaParameters["InventoryUnitId"].DefaultValue = PrivateSession.Instance.InventoryUnitId.ToString(); this.ClearForm(); break; case "edit": this.ClearForm(); if (args.Length > 1) { PrivateSession.Instance.InventoryUnitId = Guid.Parse(args[1]); dsInventoryUnit.CriteriaParameters["InventoryUnitId"].DefaultValue = PrivateSession.Instance.InventoryUnitId.ToString(); //this.txtName.Text = CurrentInventoryUnit.Name; //txtCode.Text = CurrentManufacturerOrg.Code; } break; case "save": bool isSuccess = true; string recordIdStr = null; try { //Check validation if (!ASPxEdit.AreEditorsValid(this.pagWarehouseUnitEdit, true)) { formWarehouseUnitEdit.JSProperties.Add("cpInvalid", true); pagWarehouseUnitEdit.ActiveTabIndex = 0; return; } //Logic to save data if (args.Length > 1) { //Update mode //Update general information recordIdStr = args[1]; Guid recordId = Guid.Parse(recordIdStr); InventoryUnit editManufacturerOrg = session.GetObjectByKey <InventoryUnit>(PrivateSession.Instance.InventoryUnitId); //editManufacturerOrg.Code = txtCode.Text; editManufacturerOrg.Name = txtName.Text; //editManufacturerOrg.RowStatus = short.Parse(cbRowStatus.SelectedItem.Value.ToString()); editManufacturerOrg.Save(); } else { //Insert mode InventoryUnit newManufacturerOrg = session.GetObjectByKey <InventoryUnit>(PrivateSession.Instance.InventoryUnitId); //newManufacturerOrg.Code = txtCode.Text; newManufacturerOrg.Name = txtName.Text; //newManufacturerOrg.RowStatus = short.Parse(cbRowStatus.SelectedItem.Value.ToString()); newManufacturerOrg.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; newManufacturerOrg.Save(); } } catch (Exception) { isSuccess = false; throw; } finally { OnSaved(new WebModule.Interfaces.FormEditEventArgs() { isSuccess = isSuccess }); formWarehouseUnitEdit.JSProperties.Add("cpCallbackArgs", String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower())); PrivateSession.ClearInstance(); } break; default: break; } }
/// /// <param name="name"></param> /// <param name="quantity"></param> /// <param name="unit"></param> public InventoryItem CreateNewInventoryItem(string name, int quantity, InventoryUnit unit){ return null; }
void Start() { GetComponent <EnduranceBody>().OnDestroy += DoOnDestroy; inventory = Builder.FindGameObject <InventoryUnit>("Inventory"); }
/// <summary> /// Populate default data to database /// </summary> public static void Populate() { try { ////NAS.DAL.Accounting.AccountChart NAS.DAL.BI.Accounting.Account.CorrespondFinancialAccountDim.Populate(); NAS.DAL.BI.Accounting.Account.FinancialAccountDim.Populate(); Account.Populate(); AccountType.Populate(); AccountCategory.Populate(); Currency.Populate(); ////NAS.DAL.Accounting.Configure AllocationType.Populate(); ////NAS.DAL.CMS.ObjectDocument ObjectType.Populate(); CustomFieldType.Populate(); ObjectTypeCustomField.Populate(); ////NAS.DAL.Inventory.Item RecordedType.Populate(); ////NAS.DAL.Inventory.Operation CommanderStockCartStatus.Populate(); CommanderStockCartType.Populate(); ////NAS.DAL.Inventory.StockCart StockCartActorType.Populate(); ////NAS.DAL.Invoice TaxType.Populate(); PromotionType.Populate(); ////NAS.DAL.Nomenclature.Inventory Nomenclature.Inventory.Inventory.Populate(); InventoryUnit.Populate(); ////NAS.DAL.Nomenclature.Item ItemUnitRelationType.Populate(); UnitType.Populate(); Unit.Populate(); ItemUnit.Populate(); ItemTradingType.Populate(); ItemCustomType.Populate(); ////NAS.DAL.Nomenclature.Organization TradingCategory.Populate(); AuthenticationProvider.Populate(); DepartmentType.Populate(); OrganizationType.Populate(); Person.Populate(); Organization.Populate(); OwnerOrg.Populate(); CustomerOrg.Populate(); SupplierOrg.Populate(); ManufacturerOrg.Populate(); Department.Populate(); DepartmentPerson.Populate(); //NAS.DAL.Staging.Accounting.Journal AccountActorType.Populate(); ////NAS.DAL.Vouches VouchesType.Populate(); VouchesActorType.Populate(); ReceiptVouchesType.Populate(); PaymentVouchesType.Populate(); ForeignCurrency.Populate(); ////NAS.DAL.Accounting.Journal AccountingPeriod.Populate(); //SalesInvoicePickingStockCart.Populate(); ////NAS.DAL.System.ArtifactCode ArtifactType.Populate(); CodeRuleDataType.Populate(); CodeRuleDataFormat.Populate(); RuleRepeaterType.Populate(); //NAS.DAL.Sales.Price PricePolicyType.Populate(); //NAS.DAL.Inventory.Lot.Lot NAS.DAL.Inventory.Lot.Lot.Populate(); //NAS.DAL.Inventory.Command.InventoryCommandActorType NAS.DAL.Inventory.Command.InventoryCommandActorType.Populate(); NAS.DAL.BI.Inventory.InventoryCommandDim.Populate(); #region Other populate using (Session session = XpoHelper.GetNewSession()) { //Insert undefined supplier if (!Util.isExistXpoObject <SupplierOrg>("OrganizationId", Guid.Parse("3DEF2B62-2162-46CD-8418-DEE6F8E59E21"))) { SupplierOrg undefinedSupplierOrg = new SupplierOrg(session) { OrganizationId = Guid.Parse("3DEF2B62-2162-46CD-8418-DEE6F8E59E21"), Name = "Mặc định", Description = "Mặc định", Code = "MACDINH", RowCreationTimeStamp = DateTime.Now, RowStatus = Constant.ROWSTATUS_ACTIVE, OrganizationTypeId = NAS.DAL.Util.getDefaultXpoObject <OrganizationType>(session) }; undefinedSupplierOrg.Save(); } } #endregion } catch (Exception) { throw new Exception("Populate failed"); } finally { } }
/// /// <param name="name"></param> /// <param name="quantity"></param> /// <param name="unit"></param> public InventoryItem CreateNewInventoryItem(string name, int quantity, InventoryUnit unit) { return null; }