private String CRUD()
    {
        param1 = Request.Params["param1"].ToString();
         param2 = Request.Params["param2"].ToString();

         param4 = Request.Params["param4"].ToString();
         param5 = Request.Params["param5"].ToString();
         param6 = Request.Params["param6"].ToString();
         param7 = Request.Params["param7"].ToString();
         param8 = Request.Params["param8"].ToString();
         param9 = Request.Params["param9"].ToString();
         param10 = Request.Params["param10"].ToString();
         param11 = Request.Params["param11"].ToString();
         param12 = Request.Params["param12"].ToString();
         param13 = Request.Params["param13"].ToString();
         param14 = Request.Params["param14"].ToString();
         param15 = Request.Params["param15"].ToString();
         param16 = Request.Params["param16"].ToString();
         param17 = Request.Params["param17"].ToString();
         param18 = Request.Params["param18"].ToString();
         param19 = Request.Params["param19"].ToString();
         param20 = Request.Params["param20"].ToString();
         param21 = Request.Params["param21"].ToString();
         param22 = Request.Params["param22"].ToString();
         param23 = Request.Params["param23"].ToString();
         param24 = Request.Params["param24"].ToString();
         param25 = Request.Params["param25"].ToString();

         param28 = Request.Params["param28"].ToString();

         String sql = "";
         String output = "";

         try
         {

             output = param1;

                 if (output == "I")
                 {

                     ALMIS.ExecuteSTP eSTP = new ALMIS.ExecuteSTP();
                     eSTP.Datas();
                     DataSet ds = new DataSet();
                     ds = eSTP.List29("P_MINDENT", "X", param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21, param22, param23, param24, param25, userid, param27, param28, "0");
                     dt = ds.Tables[0];

                         if (dt.Rows.Count > 0)
                         {
                             if (output == "I")
                                 output = "notambah";

                             return output;
                         }
                 }

             if (output == "I" || output == "E" || output == "D")
             //if (output == "E" || output == "D")
             {

                 ALMIS.ExecuteSTP eSTP = new ALMIS.ExecuteSTP();
                 eSTP.Datas();
                 DataSet ds = new DataSet();
                 eSTP.save29("P_MINDENT", param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21, param22, param23, param24, param25, userid, param27, param28, "0");

                 return output;
             }

             //if (output == "I")
             //{

             //    LANDCOMP.ExecuteSTP eSTP = new LANDCOMP.ExecuteSTP();
             //    eSTP.Datas();
             //    DataSet ds = new DataSet();
             //    eSTP.save26("P_MINDENT", "E", param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18, param19, param20, param21, param22, param23, param24, param25, param26);

             //    return output;
             //}

             else
                 output = "gagal";
         }

         catch (Exception ex)
         {
             Response.Write(ex.Message);
             dt.Dispose();
             Response.End();
             return ex.Message;
         }

         return output;
    }
    private bool ServiceSelect(string sm)
    {
        switch (sm)
        {

            case "select":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();

                ALMIS.ExecuteSTP eSTP = new ALMIS.ExecuteSTP();
                eSTP.Datas();
                DataSet ds = new DataSet();
                ds = eSTP.List29("P_MINDENT", param1, param2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");

                dt = ds.Tables[0];

                Response.ContentType = "text/plain";

                Response.Write(dt.Rows[0]["MidentIdents"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentJnsIdn"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentNamass"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentJnsKel"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentTmplhr"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentTgllhr"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentPekerj"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentNmrPeg"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentAlamat"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentNmrHps"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentStatus"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentNmPsng"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentTmpPas"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentTglPas"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentThnNkh"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentNmAyah"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentTglAyh"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentKrjAyh"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentAlmAyh"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentNmIbus"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentTglIbu"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentKrjIbu"].ToString() + "|");
                Response.Write(dt.Rows[0]["MidentAlmIbu"].ToString() + "|");
                Response.Write(dt.Rows[0]["Midentkodper"].ToString() + "|");

                dt.Dispose();

                Response.End();
                Response.End();

                return false;

            case "SA":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();

                ALMIS.ExecuteSTP eSTP_SA = new ALMIS.ExecuteSTP();
                eSTP_SA.Datas();
                DataSet ds_SA = new DataSet();
                ds_SA = eSTP_SA.List12("P_MINDENT_A", param1, param2, "", "", "", "", "", "", "", "", "", "");

                dt = ds_SA.Tables[0];

                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++)
                {
                    Random r = new Random();
                    Response.Write("<row id=\"" + (i + 1).ToString() + "\">");
                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>"); // Untuk Membuat Angka
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentNamass"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentTgllhr"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentPkrjan"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentAlamat"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace("Delete^javascript:Hapus(\"" +"DA" + "\",\"" + "DA" + "\",\"" + dt.Rows[i]["MidentIdents"].ToString() + "\",\"" + dt.Rows[i]["midentSequen"].ToString() + "\");^_self") + "</cell>");

                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();

                Response.End();
                Response.End();

                return false;

            case "SS":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();

                ALMIS.ExecuteSTP eSTP_SS = new ALMIS.ExecuteSTP();
                eSTP_SS.Datas();
                DataSet ds_SS = new DataSet();
                ds_SA = eSTP_SS.List12("P_MINDENT_S", param1, param2, "", "", "", "", "", "", "", "", "", "");

                dt = ds_SA.Tables[0];

                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++)
                {
                    Random r = new Random();
                    Response.Write("<row id=\"" + (i + 1).ToString() + "\">");
                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>"); // Untuk Membuat Angka
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentNamass"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentTgllhr"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentPkrjan"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["midentAlamat"].ToString()) + "</cell>");
                    //Response.Write("<cell>" + RemoveWhiteSpace("View^javascript:View(\"" + "SS" + "\",\"" + "SS" + "\",\"" + dt.Rows[i]["MidentIdents"].ToString() + "\",\"" + dt.Rows[i]["midentSequen"].ToString() + "\");^_self") + "</cell>");
                    //Response.Write("<cell>" + RemoveWhiteSpace("Edit^javascript:Edit(\"" + "US" + "\",\"" + "US" + "\",\"" + dt.Rows[i]["MidentIdents"].ToString() + "\",\"" + dt.Rows[i]["midentSequen"].ToString() + "\");^_self") + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace("Delete^javascript:Hapus(\"" + "DS" + "\",\"" + "DS" + "\",\"" + dt.Rows[i]["MidentIdents"].ToString() + "\",\"" + dt.Rows[i]["midentSequen"].ToString() + "\");^_self") + "</cell>");

                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();

                Response.End();
                Response.End();

                return false;

            case "ListUploadIdentitasLahan":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["IDRegistrasi"].ToString();

                String path_pic = (HttpContext.Current.Request.Url.AbsolutePath).ToLower();

                ALMIS.ExecuteSTP eSTPz = new ALMIS.ExecuteSTP();
                eSTPz.Datas();
                DataSet dsz = new DataSet();
                dsz = eSTPz.List29("P_MINDENT", param1, param2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");

                dt = dsz.Tables[0];

                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++)
                {
                    Random r = new Random();
                    Response.Write("<row id=\"" + (i + 1).ToString() + "\">");

                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>");
                    //Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["codessDescs1"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumFiless"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumFiless"].ToString()) + "</cell>");

                    Response.Write("<cell>" + "Download^" + path_pic + "?sm=df&amp;namafile=" + dt.Rows[i]["hdocumIdLink"].ToString() + "&amp;filelama=" + dt.Rows[i]["hdocumFiless"].ToString() + "</cell>");
                    //Response.Write("<cell>" + "Delete^" + path_pic + "?sm=Deletepic&amp;IDSOURCE=" + dt.Rows[i]["IDSource"].ToString() + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace("Delete^javascript:DeletePic(\"" + dt.Rows[i]["hdocumIdLink"].ToString()) + "\",\"" + param2 + "\");^_self" + "</cell>");

                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumIdSour"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumIdLink"].ToString()) + "</cell>");
                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();
                //conn.myConnectionClose();
                Response.End();
                return false;

            case "ListUploadKelengkapan":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["IDRegistrasi"].ToString();

                String path_pica = (HttpContext.Current.Request.Url.AbsolutePath).ToLower();

                ALMIS.ExecuteSTP eSTPa = new ALMIS.ExecuteSTP();
                eSTPa.Datas();
                DataSet dsa = new DataSet();
                dsa = eSTPa.List6("P_REGIST_D", param1, param2, "", "", "", "");

                dt = dsa.Tables[0];

                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++)
                {
                    Random r = new Random();
                    Response.Write("<row id=\"" + (i + 1).ToString() + "\">");

                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumFiless"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumFiless"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumFiless"].ToString()) + "</cell>");

                    Response.Write("<cell>" + "Download^" + path_pica + "?sm=df&amp;namafile=" + dt.Rows[i]["hdocumIdLink"].ToString() + "&amp;filelama=" + dt.Rows[i]["hdocumFiless"].ToString() + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace("Delete^javascript:DeletePic(\"" + dt.Rows[i]["hdocumIdLink"].ToString()) + "\",\"" + param2 + "\");^_self" + "</cell>");

                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumIdSour"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["hdocumIdLink"].ToString()) + "</cell>");
                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();
                Response.End();
                return false;

            case "df":
                Response.Clear();
                string namafile = (Request.Params["filelama"] is object ? Request.Params["filelama"].ToString() : "");
                String urlfile = (Request.Params["namafile"] is object ? Request.Params["namafile"].ToString() : "");
                String randomfile = (Request.Params["random"] is object ? Request.Params["random"].ToString() : "");
                string type = "";
                switch (namafile.Substring(namafile.Length - 4))
                {
                    case ".htm":
                    case ".html":
                        type = "text/HTML";
                        break;

                    case ".txt":
                        type = "text/plain";
                        break;

                    case ".doc":
                    case ".docx":
                    case ".rtf":
                        type = "Application/msword";
                        break;
                    case ".xls":
                    case ".xlsx":
                        type = "Application/msexcel";
                        break;

                    case ".zip":
                    case ".rar":
                        type = "application/zip";
                        break;

                    case ".pdf":
                        type = "application/pdf";
                        break;
                    case ".jpg":
                        type = "image/JPG";
                        break;
                    case ".pgn":
                        type = "image/PNG";
                        break;
                    case ".tif":
                        type = "image/tif";
                        break;
                }

                Response.AddHeader("content-disposition", "attachment;filename=" + namafile + "");
                Response.ContentType = type;

                Response.WriteFile(Server.MapPath(@"~/uploaddocument/" + Request.Params["namafile"].ToString().Replace("&amp;", "&")));
                dt.Dispose();
                Response.End();
                return false;

            case "SaveUploadRegistrasi":
                Response.ContentType = "text/plain";
                Response.Write(SaveUploadRegistrasi());
                Response.End();
                return false;

            case "IA":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();
                param5 = Request.Params["param5"].ToString();
                param6 = Request.Params["param6"].ToString();
                param7 = Request.Params["param7"].ToString();
                param8 = Request.Params["param8"].ToString();
                param11 = Request.Params["param11"].ToString();

                ALMIS.ExecuteSTP eSTP_IA = new ALMIS.ExecuteSTP();
                eSTP_IA.Datas();
                eSTP_IA.save12("P_MINDENT_A", param1, param2, param3, param4, param5, param6, param7, param8, userid, param10, param11, "0");

                dt.Dispose();
                return false;

            case "IS":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();
                param5 = Request.Params["param5"].ToString();
                param6 = Request.Params["param6"].ToString();
                param7 = Request.Params["param7"].ToString();
                param8 = Request.Params["param8"].ToString();
                param11 = Request.Params["param11"].ToString();

                ALMIS.ExecuteSTP eSTP_IS = new ALMIS.ExecuteSTP();
                eSTP_IS.Datas();
                eSTP_IS.save12("P_MINDENT_S", param1, param2, "", param4, param5, param6, param7, param8, userid, param10, param11, "0");

                dt.Dispose();
                return false;

            case "DA":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();
                param4 = Request.Params["param4"].ToString();

                ALMIS.ExecuteSTP eSTP_DA = new ALMIS.ExecuteSTP();
                eSTP_DA.Datas();
                eSTP_DA.save12("P_MINDENT_A", param1, param2, param3, param4, param5, param6, param7, param8, userid, param10, param11, "0");

                dt.Dispose();
                return false;

            case "DS":

                param1 = Request.Params["param1"].ToString();
                param2 = Request.Params["param2"].ToString();
                param4 = Request.Params["param4"].ToString();

                ALMIS.ExecuteSTP eSTP_DS = new ALMIS.ExecuteSTP();
                eSTP_DS.Datas();
                eSTP_DS.save12("P_MINDENT_S", param1, param2, param3, param4, param5, param6, param7, param8, userid, param10, param11, "0");

                dt.Dispose();
                return false;

            case "CRUD":
                Response.ContentType = "text/plain";
                Response.Write(CRUD());
                dt.Dispose();
                Response.End();
                return false;

            default:
                Response.ContentType = "text/plain";
                dt.Dispose();
                Response.End();
                return true;
        }
    }
    private bool ServiceSelect(string sm)
    {
        switch (sm)
        {

            case "L":

                HakAkses();
                var param1L = Request.Params["param1"].ToString();
                var param2L = Request.Params["param2"].ToString();
                var param4L = Request.Params["param4"].ToString();
                var param5L = Request.Params["param5"].ToString();

                ALMIS.ExecuteSTP eSTP_L = new ALMIS.ExecuteSTP();
                eSTP_L.Datas();
                DataSet ds_L = new DataSet();
                ds_L = eSTP_L.List29("P_MINDENT", param1L, param2L, "", param4L, param5L, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", userid, "", "", "");

                dt = ds_L.Tables[0];

                Response.ContentType = "application/xhtml+xml";
                Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                Response.Write("<rows>");

                groupsid = Session["groups"].ToString();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Random r = new Random();
                    Response.Write("<row id=\"" + (i + 1).ToString() + "\">");
                    Response.Write("<cell>" + (i + 1).ToString() + "</cell>"); // Untuk Membuat Angka
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["MidentIdents"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["MidentNamass"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["MidentJnsKel"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["MidentTmplhr"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["MidentTglLhr"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["MidentStatus"].ToString()) + "</cell>");
                    Response.Write("<cell>" + RemoveWhiteSpace(dt.Rows[i]["perusaNamass"].ToString()) + "</cell>");
                    if (groups.ToString() == "1")
                    {

                        Response.Write("<cell>" + RemoveWhiteSpace("View^MasterIdentitasForm.aspx?rand=" + r.Next() + "&param1=F" + "&param2=" + dt.Rows[i]["MidentIdents"].ToString() + "") + "</cell>");
                        Response.Write("<cell>" + RemoveWhiteSpace("Edit^MasterIdentitasForm.aspx?rand=" + r.Next() + "&param1=E" + "&param2=" + dt.Rows[i]["MidentIdents"].ToString() + "") + "</cell>");
                        Response.Write("<cell>" + RemoveWhiteSpace("Delete^MasterIdentitasForm.aspx?rand=" + r.Next() + "&param1=D" + "&param2=" + dt.Rows[i]["MidentIdents"].ToString() + "") + "</cell>");
                    }

                    else
                    {
                        if (MasterIdentitasView.ToString() == "1")
                        {
                            Response.Write("<cell>" + RemoveWhiteSpace("View^MasterIdentitasForm.aspx?rand=" + r.Next() + "&param1=F" + "&param2=" + dt.Rows[i]["MidentIdents"].ToString() + "") + "</cell>");
                        }
                        if (MasterIdentitasEdit.ToString() == "1")
                        {
                            Response.Write("<cell>" + RemoveWhiteSpace("Edit^MasterIdentitasForm.aspx?rand=" + r.Next() + "&param1=E" + "&param2=" + dt.Rows[i]["MidentIdents"].ToString() + "") + "</cell>");
                        }
                        if (MasterIdentitasDelete.ToString() == "1")
                        {
                            Response.Write("<cell>" + RemoveWhiteSpace("Delete^MasterIdentitasForm.aspx?rand=" + r.Next() + "&param1=D" + "&param2=" + dt.Rows[i]["MidentIdents"].ToString() + "") + "</cell>");

                        }
                    }

                    Response.Write("</row>");
                }
                Response.Write("</rows>");
                dt.Dispose();

                Response.End();
                Response.End();

                return false;

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