public async Task <HttpResponseMessage> GetAllByOrganId() { try { var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId); ItemUnitRule itemUnitRule = new ItemUnitRule(); var list = await itemUnitRule.GetAllByOrganIdAsync(Convert.ToInt32(organId)); return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = list })); } catch (Exception ex) { throw; } }
public async Task <HttpResponseMessage> GetNewCostAccountObject() { var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId); ItemUnitRule itemUnitRule = new ItemUnitRule(); var units = await itemUnitRule.GetAllByOrganIdAsync(organId); NewObjectKala newObjectKala = new NewObjectKala() { item = new ItemVM() { Barcode = "", BuyPrice = 0, DetailAccount = new DetailAccount() { Accounts = new List <AccountVM>() { new AccountVM() { Balance = 0, BalanceType = 2, Code = "08", Coding = "1108", GroupCode = "1", ID = 10, Level = ZhivarEnums.AccountType.Moen, LevelString = "معین", Name = "موجودی کالا", ParentCoding = "11", SystemAccount = 11, SystemAccountName = "موجودی کالا", credit = 0, debit = 0 }, new AccountVM() { Balance = 0, BalanceType = 2, Code = "01", Coding = "6101", GroupCode = "6", ID = 43, Level = ZhivarEnums.AccountType.Moen, LevelString = "معین", Name = "فروش کالا", ParentCoding = "61", SystemAccount = 14, SystemAccountName = "فروش", credit = 0, debit = 0 }, new AccountVM() { Balance = 0, BalanceType = 2, Code = "01", Coding = "5101", GroupCode = "5", ID = 39, Level = ZhivarEnums.AccountType.Moen, LevelString = "معین", Name = "خرید کالا", ParentCoding = "51", SystemAccount = 16, SystemAccountName = "خرید", credit = 0, debit = 0 } }, Code = await CreateCostAccountCode(organId), Id = 0, Node = new Node() { FamilyTree = "کالاها و خدمات", Id = 2, Name = "کالاها و خدمات" } //, Parent= null, Parents: ",2,", SystemAccount= 2 }, // // RelatedAccounts: ",10,43,39,", // // credit: 0, // // debit: // // }, // // Id: 0, IsGoods: true, IsService: false, ItemType: 0, MinStock: 0, Name: "", PurchasesTitle: "", // // SalesTitle: "", SellPrice: 0, Stock: 0, Unit: "", WeightedAveragePrice: // // }, // /// itemUnits: [{ 0: "عدد" }, { 1: "بسته" }, { 2: "کارتن" }, { 3: "دستگاه" }, }, ID = 0, IsGoods = true, IsService = false, ItemType = 0, //MinStock= 0, Name = "", PurchasesTitle = "", SalesTitle = "", SellPrice = 0, Stock = 0, UnitID = 0, //WeightedAveragePrice=0 Code = await CreateCostAccountCode(organId), }, showItemUnit = false, itemUnits = units }; return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ZhivarEnums.ResultCode.Successful, data = newObjectKala })); }