Beispiel #1
0
        public string CycleCountry(string system_id, string selected_year)
        {
            clsDataHandling objDataClass = new clsDataHandling();
            DataTable       dt           = objDataClass.CycleCountry(system_id, selected_year);
            StringBuilder   str          = new StringBuilder();

            str.Append("[");
            str.Append("{");
            str.Append("\"code\":\"0\" ,");
            str.Append("\"name\":\"--Select--\"");
            str.Append("},");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                str.Append("{");
                str.Append("\"code\":\"" + dt.Rows[i]["ISO"].ToString() + "\" ,");
                str.Append("\"name\":\"" + dt.Rows[i]["COUNTRY"].ToString() + "\" ");
                str.Append("},");
            }
            str = str.Remove(str.Length - 1, 1);
            str.Append("]");
            return(str.ToString());
        }
Beispiel #2
0
        public string targetFLowList(string system_id, string source_flow)
        {
            clsDataHandling objDataClass = new clsDataHandling();
            DataTable       dt           = objDataClass.targetFLowList(system_id, source_flow);
            StringBuilder   str          = new StringBuilder();

            str.Append("[");
            str.Append("{");
            str.Append("\"code\":\"0\" ,");
            str.Append("\"name\":\"--Select--\"");
            str.Append("},");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                str.Append("{");
                str.Append("\"code\":\"" + dt.Rows[i]["process_id"].ToString() + "\" ,");
                str.Append("\"name\":\"" + dt.Rows[i]["process_name"].ToString() + "\" ");
                str.Append("},");
            }
            str = str.Remove(str.Length - 1, 1);
            str.Append("]");
            return(str.ToString());
        }
Beispiel #3
0
        public string IEDC_DataGroupView(string searchField1, string searchOper1, string searchString1, int page1, string pageSize1, string sortIndex1, string sord1, int totalrows1, string datasetId)
        {
            clsDataHandling objDataClass = new clsDataHandling();

            DataTable dt = null;

            dt = objDataClass.IEDC_DataGroupView(datasetId);
            int page = page1;              // Convert.ToInt32(HttpContext.Current.Request.QueryString["page"].ToString());

            string sidx      = sortIndex1; // HttpContext.Current.Request.QueryString["sidx"].ToString();
            string sord      = sord1;      // HttpContext.Current.Request.QueryString["sord"].ToString();
            int    totalRows = totalrows1; // Convert.ToInt32(HttpContext.Current.Request.QueryString["totalrows"].ToString());


            string searchField  = searchField1;  // HttpContext.Current.Request.QueryString["SEARCHFIELD"];
            string searchString = searchString1; // HttpContext.Current.Request.QueryString["SEARCHSTRING"];
            string searchOper   = searchOper1;   // HttpContext.Current.Request.QueryString["SEARCHOPER"];

            if (page == 0)
            {
                page = 1;
            }
            string result = "";

            if (String.IsNullOrEmpty(sidx))
            {
                sidx = "1";
            }
            int count;

            result = dt.Rows.Count.ToString();
            count  = dt.Rows.Count;
            int   totalpages;
            Int32 limit = 0;

            if (pageSize1 == "All")
            {
                limit = Convert.ToInt32(result);
            }
            else
            {
                limit = Convert.ToInt32(pageSize1);// pageSize1;// Convert.ToInt32(HttpContext.Current.Request.QueryString["rows"].ToString());
            }


            double hasilbagi = Convert.ToDouble(result) / Convert.ToDouble(limit);

            if (int.Parse(result) > 0)
            {
                totalpages = Convert.ToInt32(Math.Ceiling(hasilbagi));
            }
            else
            {
                totalpages = 0;
            }

            if (Convert.ToInt32(page) > totalpages)
            {
                page = totalpages;
            }
            int start = limit * page - limit;

            if (start < 0)
            {
                start = 0;
            }

            string strFilter = objDataClass.SetSearchStr(searchOper, searchField, searchString);
            string strSort   = sidx + " " + sord;

            DataRow[] dr = dt.Select(strFilter, "");
            DataTable dtNew;

            StringBuilder stringBuilder = new StringBuilder("{");

            stringBuilder.Append("total: " + totalpages + ", ");
            stringBuilder.Append("page: " + page + ", ");
            stringBuilder.Append("records: " + count + ", ");
            stringBuilder.Append("  rows : [ ");
            if (dr.Length > 0)
            {
                dtNew = dr.CopyToDataTable <DataRow>();
                for (int i = start; i < dt.Rows.Count; i++)
                {
                    if (i < dtNew.Rows.Count)
                    {
                        stringBuilder.Append("{");

                        stringBuilder.Append("id:" + i + ", ");
                        stringBuilder.Append("cell:[ ");

                        if (dtNew.Rows[i][0].ToString().Contains("'"))
                        {
                            stringBuilder.Append("'" + dtNew.Rows[i][0].ToString().Replace("'", "\\'") + "'" + ",");
                        }

                        else
                        {
                            stringBuilder.Append("'" + dtNew.Rows[i][0] + "'" + ",");
                        }

                        if (dtNew.Rows[i][1].ToString().Contains("'"))
                        {
                            stringBuilder.Append("'" + dtNew.Rows[i][1].ToString().Replace("'", "\\'") + "'" + "");
                        }

                        else
                        {
                            stringBuilder.Append("'" + dtNew.Rows[i][1] + "'" + "");
                        }



                        stringBuilder.Append(" ]");
                        if (i == dt.Rows.Count - 1)
                        {
                            stringBuilder.Append(" }");
                        }
                        else
                        {
                            stringBuilder.Append(" },");
                        }
                    }
                }
            }

            stringBuilder.Append(" ]");
            stringBuilder.Append(" }");
            return(stringBuilder.ToString());
        }