public string GetGrid(int userId, string session, int currPage, int NumberRowOfPage, string funcPara) { StringBuilder ret = new StringBuilder(); //string pInput = string.Format("<InputValue UserID='{0}' Session='{1}' PageIndex='{2}' RowsPerPage='{3}' {4}/>", userId, session, currPage, NumberRowOfPage, inputValue); string InputValue = CXmlPara.CreatePara(new CPara[] { new CPara("PageIndex", currPage.ToString()), new CPara("RowsPerPage", NumberRowOfPage.ToString()), }, funcPara ); COutputValue outputValue = new COutputValue(); CEmployee[] list = service.GetEmployeeList(InputValue, ref outputValue); if (list != null && list.Length > 0) { ret.Append("{"); ret.AppendFormat("'currpage':'{0}',", currPage); ret.AppendFormat("'totalpages':'{0}',", outputValue.TotalPage); ret.AppendFormat("'totalrecords':'{0}',", outputValue.TotalRow); ret.Append("'invdata':["); foreach (var item in list) { ret.Append(GetItem(item)); if (item != list[list.Length - 1]) { ret.Append(","); } } ret.Append("]"); ret.Append("}"); } string result = string.Empty; if (ret.Length > 0) { result = ret.ToString().Replace("'", "\""); } return(result); }
public string GetDataAutoComplete(int currPage, int NumberRowOfPage, string inputName, string inputType) { string _template = "{0}|{1}|{2}\n"; StringBuilder result = new StringBuilder(); string InputValue = CXmlPara.CreatePara(new CPara[] { new CPara("PageIndex", currPage.ToString()), new CPara("RowsPerPage", NumberRowOfPage.ToString()), new CPara("Name", inputName), }, ""); switch (inputType) { case "1": ServiceREF.CustomerService.CustomerService cus_service = new ServiceREF.CustomerService.CustomerService(); ServiceREF.CustomerService.COutputValue cus_output = new ServiceREF.CustomerService.COutputValue(); ServiceREF.CustomerService.CCustomer[] cusList = cus_service.GetCustomerList(InputValue, ref cus_output); foreach (var item in cusList) { result.AppendFormat(_template, item.ID, item.Code, item.Name); } break; case "2": ServiceREF.VendorService.VendorService ven_service = new ServiceREF.VendorService.VendorService(); ServiceREF.VendorService.COutputValue ven_output = new ServiceREF.VendorService.COutputValue(); ServiceREF.VendorService.CVendor[] venList = ven_service.GetVendorList(InputValue, ref ven_output); foreach (var item in venList) { result.AppendFormat(_template, item.ID, item.Code, item.Name); } break; case "3": ServiceREF.GeneralLedgerService.COutputValue gl_output = new ServiceREF.GeneralLedgerService.COutputValue(); ServiceREF.GeneralLedgerService.CEmployee[] empList = gl_service.GetEmployeeList(InputValue, ref gl_output); foreach (var item in empList) { result.AppendFormat(_template, item.ID, item.Code, item.Name); } break; } return(result.ToString()); }