예제 #1
0
        public async Task <HttpResponseMessage> GetCosts()
        {
            var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId);

            CostRule costRule  = new CostRule();
            var      costQuery = await costRule.GetAllByOrganIdAsync(organId);

            return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = ZhivarEnums.ResultCode.Successful, data = costQuery.ToList() }));
        }
예제 #2
0
        private async Task <string> createNumberCost(int organId)
        {
            var      count     = 0;
            CostRule costRule  = new CostRule();
            var      costQuery = await costRule.GetAllByOrganIdAsync(organId);

            count = costQuery.Count();
            count++;
            string code = "";

            if (count < 10)
            {
                code = "00000" + count;
            }
            else if (count < 100)
            {
                code = "0000" + count;
            }
            else if (count < 1000)
            {
                code = "000" + count;
            }
            else if (count < 10000)
            {
                code = "00" + count;
            }
            else if (count < 100000)
            {
                code = "0" + count;
            }
            else
            {
                code = count.ToString();
            }

            return(code);
        }