public string GetCollVsCompAssmnt(string token, string code = "1")
    {
        string        secKey = System.Configuration.ConfigurationManager.AppSettings["SECKEY"].ToString();
        string        conStr = System.Configuration.ConfigurationManager.ConnectionStrings["CONSTR"].ToString();
        DataTable     dt;
        utility       util       = new utility();
        DB_Utility    objDbuTil  = new DB_Utility(conStr);
        StringBuilder jsonString = new StringBuilder();

        jsonString.Append("{");
        jsonString.Append(@"""CollVsCompAssmnt"":{");
        StringBuilder filterExp = new StringBuilder();
        string        ret       = "error";

        if (token != secKey)
        {
            return("Ivalid Token.");
        }
        try
        {
            if (!string.IsNullOrEmpty(code))
            {
                filterExp.AppendFormat("LEN(SDIVCODE) >= {0} and LEN(SDIVCODE) <= {1}", (code.Length).ToString(), (code.Length + 1).ToString());
            }

            dt = objDbuTil.GetCollVsCompAssmnt(code);

            if (dt != null)
            {
                int      i  = 0;
                DataView dv = dt.DefaultView;
                dv.RowFilter = filterExp.ToString();
                dv.Sort      = "SRT_ORDER2 ASC";
                foreach (DataRowView dr in dv)
                {
                    util.GetCollVsCompAssmntPJSON1(dv.ToTable(), jsonString, dr["SDIVCODE"].ToString());
                    if (i == dv.ToTable().Rows.Count - 1)
                    {
                        jsonString.Append("}");
                    }
                    else
                    {
                        jsonString.Append("},");
                    }

                    i++;
                }
            }

            jsonString.Append("}");
            jsonString.Append("}");
            ret = jsonString.ToString();
        }
        catch (Exception ex)
        {
            ret = ex.ToString();
        }

        return(ret);
    }
        public List <CollectCompAssMnt> GetCollVsCompAssMnt(string token, string code)
        {
            DataTable  dt;
            utility    util      = new utility();
            DB_Utility objDbuTil = new DB_Utility(conStr);
            List <CollectCompAssMnt> collCompAssMnt = new List <CollectCompAssMnt>();
            StringBuilder            filterExp      = new StringBuilder();

            if (token != secKey)
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(code))
            {
                filterExp.AppendFormat("LEN(SDIVCODE) >= {0} and LEN(SDIVCODE) <= {1}", (code.Length).ToString(),
                                       (code.Length + 1).ToString());
            }

            dt = objDbuTil.GetCollVsCompAssmnt(code);

            if (dt != null)
            {
                //int i = 0;
                DataView dv = dt.DefaultView;
                dv.RowFilter = filterExp.ToString();
                dv.Sort      = "SRT_ORDER2 ASC";
                foreach (DataRowView dr in dv)
                {
                    collCompAssMnt.Add(new CollectCompAssMnt(dr));
                }
            }

            return(collCompAssMnt);
        }