Example #1
0
        public string GetItemGroups(int userId, string session, int currPage, int NumberRowOfPage, string funcPara)
        {
            //string pInput = string.Format("<InputValue PageIndex='{0}' RowsPerPage='{1}' {2}/>", currPage, NumberRowOfPage, inputValue);
            string InputValue = CXmlPara.CreatePara(new CPara[]
            {
                new CPara("PageIndex", currPage.ToString()),
                new CPara("RowsPerPage", NumberRowOfPage.ToString()),
            },
                                                    funcPara
                                                    );

            COutputValue pageinfo = new COutputValue();

            CItemGroup[]  list = service.GetInventoryItemGroupList(InputValue, ref pageinfo);
            StringBuilder ret  = new StringBuilder();

            try
            {
                string format = "\"ID\":\"{0}\", \"Code\":\"{1}\", \"Name\":\"{2}\", \"Description\":\"{3}\", \"CreatedBy\":\"{4}\", \"Action\":\"{5}\"";

                ret.Append("{");
                ret.AppendFormat("\"currpage\":\"{0}\",\"totalpages\":\"{1}\",\"totalrecords\":\"{2}\",\"invdata\":[", currPage, pageinfo.TotalPage, pageinfo.TotalRow);
                for (int i = 0; i < list.Length; i++)
                {
                    string item = string.Format(format, list[i].ID, list[i].Code, list[i].Name, list[i].Description, list[i].CreatedByName.ToString(), list[i].Active);
                    ret.Append("{" + item + "}");
                    if (i < list.Length - 1)
                    {
                        ret.Append(",");
                    }
                }
                ret.Append("]}");
            }
            catch (Exception)
            {
            }
            return(ret.ToString());
        }