Example #1
0
    private void GenerateGrid(DataTable dt)
    {
        String grid = "";
        String sql  = "";

        conn = new Connection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStrLANDCOMPLocal2"].ToString());

        if ((Session["usersWilay"] is object) && (Session["userID"] is object))
        {
            wilayah = "0" + Session["usersWilay"].ToString();
            user    = Session["userID"].ToString();
        }

        try
        {
            sql = "DECLARE @LookupType varchar(10); SET @LookupType='" + lt + "'; "
                  + "DECLARE @LookupParams varchar(1000); SET @LookupParams='" + lps + "'; "
                  + "DECLARE @LookupSearch varchar(1000); SET @LookupSearch='" + ls + "'; "
                  + "DECLARE @LookupWilayah varchar(10); SET @LookupWilayah='" + wilayah + "'; "
                  + "EXEC landcomp.[c_lookup] "
                  + "@LookupType"
                  + ",@LookupParams"
                  + ",@LookupSearch"
                  + ",@LookupWilayah"
                  + "";
            dt = conn.sqlQuery(sql);

            grid = "<rows>" + grid + GenerateHead(dt);
            grid = grid + GenerateContent(dt) + "</rows>";

            Response.ContentType = "application/xhtml+xml";
            //Response.ContentType = "text/plain"; // for debuging
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Response.Write(grid);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        Response.End();
    }
Example #2
0
    private bool ServiceSelect(string sm)
    {
        String sql = "";

        conn = new Connection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStrLANDCOMPLocal2"].ToString());
        DataTable dt = new DataTable();

        switch (sm)
        {
        case "l":
            sql = "SELECT codessHeadss, codessCodess, codessDescs1, codessDescs2, codessStatss "
                  + " from landcomp.CODESS where codessCodess=0"
                  + "";
            dt = conn.sqlQuery(sql);

            Response.ContentType = "application/xhtml+xml";
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Response.Write("<rows>");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Response.Write("<row id=\"" + RemoveWhiteSpace(dt.Rows[i]["codessHeadss"].ToString()) + "\">");
                Response.Write("<cell>" + (i + 1).ToString() + "</cell>");
                Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessHeadss"].ToString()) + "</cell>");
                Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessDescs1"].ToString()) + "</cell>");
                Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessDescs2"].ToString()) + "</cell>");
                Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessStatss"].ToString()) + "</cell>");
                Response.Write("</row>");
            }
            Response.Write("</rows>");
            dt.Dispose();
            conn.myConnectionClose();
            Response.End();
            return(false);


        case "li":
            idcodehead.Value = Request.Params["id"].ToString();
            String idrow = Request.Params["id"].ToString();
            sql = "SELECT codessHeadss,codessCodess,ISNULL(codessDescs1,'') codessDescs1,ISNULL(codessDescs2,'') codessDescs2,codessStatss FROM landcomp.CODESS  where codessStatss!=0 and codessHeadss=" + idrow
                  + "ORDER BY codessCodess";
            dt = conn.sqlQuery(sql);

            Response.ContentType = "application/xhtml+xml";
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Response.Write("<rows>");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Response.Write("<row id=\"" + dt.Rows[i]["codessCodess"].ToString() + "\">");
                Response.Write("<cell>" + (i + 1).ToString() + "</cell>");
                Response.Write("<cell>" + dt.Rows[i]["codessCodess"].ToString() + "</cell>");
                Response.Write("<cell>" + dt.Rows[i]["codessDescs1"].ToString() + "</cell>");
                Response.Write("<cell>" + dt.Rows[i]["codessDescs2"].ToString() + "</cell>");
                Response.Write("<cell>" + dt.Rows[i]["codessStatss"].ToString() + "</cell>");
                Response.Write("<cell>" + dt.Rows[i]["codessHeadss"].ToString() + "</cell>");
                Response.Write("</row>");
            }
            Response.Write("</rows>");
            dt.Dispose();
            conn.myConnectionClose();
            Response.End();
            return(false);

        case "s":
            String id = Request.Params["id"].ToString();
            sql = "SELECT codessHeadss,codessCodess,codessDescs1,codessDescs2,codessStatss FROM landcomp.CODESS where codessHeadss=" + Request.Params["codeid"].ToString()
                  + "  and codessCodess= " + id
                  + "";
            dt = conn.sqlQuery(sql);

            Response.ContentType = "text/plain";

            Response.Write(dt.Rows[0]["codessHeadss"].ToString() + "|");
            Response.Write((dt.Rows[0]["codessCodess"].ToString()) + "|");
            Response.Write((dt.Rows[0]["codessDescs1"].ToString()) + "|");
            Response.Write(dt.Rows[0]["codessDescs2"].ToString() + "|");
            Response.Write(dt.Rows[0]["codessStatss"].ToString());

            dt.Dispose();
            conn.myConnectionClose();
            Response.End();
            return(false);

        case "i":
            String tipe         = Request.Params["tipe"].ToString();
            String codehead     = Request.Params["id"].ToString();
            String idcodes      = Request.Params["idcodes"].ToString();
            String codessDescs1 = Request.Params["codessDescs1"].ToString();
            String codessDescs2 = Request.Params["codessDescs2"].ToString();
            string user         = (string)Session["userID"].ToString();
            String output       = "";
            String idCLS        = Request.Params["id"].ToString();
            Response.ContentType = "text/plain";
            if (tipe == "1")
            {
                sql = @"select codessCodess from landcomp.CODESS where codessHeadss='" + codehead + @"'
                            and codessDescs1='" + codessDescs1 + "' ";

                DataTable dt0 = new DataTable();
                dt0    = conn.sqlQuery(sql);
                output = dt0.Rows.Count.ToString();
                if (output != "0")
                {
                    Response.Write("Nama Item tidak boleh sama");
                }
            }
            if (output == "0" || tipe != "1")
            {
                sql = "exec landcomp.updateCodesCodes "
                      + "'" + tipe + "' "
                      + ",'" + codehead + "' "
                      + ",'" + idcodes + "' "
                      + ",'" + codessDescs1 + "' "
                      + ",'" + codessDescs2 + "' "
                      + "";
                dt = conn.sqlQuery(sql);
            }


            dt.Dispose();
            conn.myConnectionClose();
            Response.End();
            return(false);

        default:
            Response.ContentType = "text/plain";
            Response.End();
            return(true);
        }
    }
Example #3
0
    private void GenerateGrid(DataTable dt)
    {
        String grid = "";
        String sql = "";
        conn = new Connection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStrLANDCOMPLocal2"].ToString());

        if ((Session["usersWilay"] is object) && (Session["userID"] is object))
        {
            wilayah = "0" + Session["usersWilay"].ToString();
            user = Session["userID"].ToString();
        }

        try
        {
            sql = "DECLARE @LookupType varchar(10); SET @LookupType='"+lt+"'; "
                + "DECLARE @LookupParams varchar(1000); SET @LookupParams='" + lps + "'; "
                + "DECLARE @LookupSearch varchar(1000); SET @LookupSearch='" + ls + "'; "
                + "DECLARE @LookupWilayah varchar(10); SET @LookupWilayah='" + wilayah + "'; "
                + "EXEC landcomp.[c_lookup] "
                + "@LookupType"
                + ",@LookupParams"
                + ",@LookupSearch"
                + ",@LookupWilayah"
                + "";
            dt = conn.sqlQuery(sql);

            grid = "<rows>" + grid + GenerateHead(dt);
            grid = grid + GenerateContent(dt) + "</rows>";

            Response.ContentType = "application/xhtml+xml";
            //Response.ContentType = "text/plain"; // for debuging
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            Response.Write(grid);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        Response.End();
    }
Example #4
0
    private bool ServiceSelect(string sm)
    {
        String sql = "";
        conn = new Connection(System.Configuration.ConfigurationManager.ConnectionStrings["ConStrLANDCOMPLocal2"].ToString());
        DataTable dt = new DataTable();
        switch (sm)
        {
            case "l":
                sql = "SELECT codessHeadss, codessCodess, codessDescs1, codessDescs2, codessStatss "
                     +" from almis.CODESS where codessCodess=0"
                     + "";
                dt = conn.sqlQuery(sql);

                Response.ContentType = "application/xhtml+xml";
                Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                Response.Write("<rows>");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Response.Write("<row id=\"" + RemoveWhiteSpace(dt.Rows[i]["codessHeadss"].ToString()) + "\">");
                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessHeadss"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessDescs1"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessDescs2"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessStatss"].ToString()) + "</cell>");
                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();
                conn.myConnectionClose();
                Response.End();
                return false;

            case "li":
                idcodehead.Value = Request.Params["id"].ToString();
                String idrow = Request.Params["id"].ToString();
                sql = "SELECT codessHeadss,codessCodess,ISNULL(codessDescs1,'') codessDescs1,ISNULL(codessDescs2,'') codessDescs2,codessStatss FROM almis.CODESS  where codessStatss!=0 and codessHeadss=" + idrow
                    + "ORDER BY codessCodess";
                dt = conn.sqlQuery(sql);

                Response.ContentType = "application/xhtml+xml";
                Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                Response.Write("<rows>");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Response.Write("<row id=\"" + dt.Rows[i]["codessCodess"].ToString() + "\">");
                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>");
                    Response.Write("<cell>" + dt.Rows[i]["codessCodess"].ToString() + "</cell>");
                    Response.Write("<cell>" + dt.Rows[i]["codessDescs1"].ToString() + "</cell>");
                    Response.Write("<cell>" + dt.Rows[i]["codessDescs2"].ToString() + "</cell>");
                    Response.Write("<cell>" + dt.Rows[i]["codessStatss"].ToString() + "</cell>");
                    Response.Write("<cell>" + dt.Rows[i]["codessHeadss"].ToString() + "</cell>");
                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();
                conn.myConnectionClose();
                Response.End();
                return false;

            case "s":
                String id = Request.Params["id"].ToString();
                sql = "SELECT codessHeadss,codessCodess,codessDescs1,codessDescs2,codessStatss FROM almis.CODESS where codessHeadss=" + Request.Params["codeid"].ToString()
                    + "  and codessCodess= " + id
                    + "";
                dt = conn.sqlQuery(sql);

                Response.ContentType = "text/plain";

                Response.Write(dt.Rows[0]["codessHeadss"].ToString() + "|");
                Response.Write((dt.Rows[0]["codessCodess"].ToString()) + "|");
                Response.Write((dt.Rows[0]["codessDescs1"].ToString()) + "|");
                Response.Write(dt.Rows[0]["codessDescs2"].ToString() + "|");
                Response.Write(dt.Rows[0]["codessStatss"].ToString());

                dt.Dispose();
                conn.myConnectionClose();
                Response.End();
                return false;

            case "i":
                String tipe = Request.Params["tipe"].ToString();
                String codehead = Request.Params["id"].ToString();
                String idcodes = Request.Params["idcodes"].ToString();
                String codessDescs1 = Request.Params["codessDescs1"].ToString();
                String codessDescs2 = Request.Params["codessDescs2"].ToString();
                string user = (string)Session["userID"].ToString();
                String output = "";
                String idCLS = Request.Params["id"].ToString();
                Response.ContentType = "text/plain";
                if (tipe == "1")
                {
                    sql = @"select codessCodess from almis.CODESS where codessHeadss='" + codehead + @"'
                            and codessDescs1='" + codessDescs1 + "' ";

                    DataTable dt0 = new DataTable();
                    dt0 = conn.sqlQuery(sql);
                    output = dt0.Rows.Count.ToString();
                    if (output != "0")
                        Response.Write("Nama Item tidak boleh sama");
                }
                if (output == "0" || tipe != "1")
                {
                    sql = "exec almis.updateCodesCodes "
                            + "'" + tipe + "' "
                            + ",'" + codehead + "' "
                            + ",'" + idcodes + "' "
                            + ",'" + codessDescs1 + "' "
                            + ",'" + codessDescs2 + "' "
                            + "";
                    dt = conn.sqlQuery(sql);

                }

                dt.Dispose();
                conn.myConnectionClose();
                Response.End();
                return false;

            default:
                Response.ContentType = "text/plain";
                Response.End();
                return true;
        }
    }