protected void dgPKPLainnya_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            List<PKP> coll = new List<PKP>();
            if (ViewState["PKP"] != null)
                coll = ViewState["PKP"] as List<PKP>;

            if (e.CommandName == "add")
            {
                TextBox txtPKPAdd = e.Item.FindControl("txtPKPAdd") as TextBox;
                TextBox txtKeteranganAdd = e.Item.FindControl("txtKeteranganAdd") as TextBox;
                FileUpload fuAdd = e.Item.FindControl("fuAdd") as FileUpload;

                if (isExistInPKPGrid(txtPKPAdd.Text, "lblNPWP"))
                {
                    Util.ShowMessage(Page, SR.DataIsExist(txtPKPAdd.Text.Trim()));
                    return;
                }

                if (isExistInPKPGrid(fuAdd.FileName, "lblAtttachmentHidden"))
                {
                    Util.ShowMessage(Page, SR.DataIsExist(fuAdd.FileName));
                    return;
                }

                PKP o = new PKP();
                o.NoPKP = txtPKPAdd.Text.Trim();

                Stream strm = fuAdd.PostedFile.InputStream;
                byte[] bytes = new byte[Convert.ToInt32(fuAdd.PostedFile.ContentLength)];
                strm.Read(bytes, 0, Convert.ToInt32(fuAdd.PostedFile.ContentLength));
                strm.Close();

                o.Attachment = bytes;
                o.NamaFile = fuAdd.FileName;
                o.Keterangan = txtKeteranganAdd.Text.Trim();
                o.ID = 0;
                coll.Add(o);

                ViewState["PKP"] = coll;
            }
            if (e.CommandName == "save")
            {
                TextBox txtPKPEdit = e.Item.FindControl("txtPKPEdit") as TextBox;
                TextBox txtKeteranganEdit = e.Item.FindControl("txtKeteranganEdit") as TextBox;
                FileUpload fuEdit = e.Item.FindControl("fuEdit") as FileUpload;

                if (isExistInPKPGrid(txtPKPEdit.Text, "lblNPWP"))
                {
                    Util.ShowMessage(Page, SR.DataIsExist(txtPKPEdit.Text.Trim()));
                    return;
                }

                if (isExistInPKPGrid(fuEdit.FileName, "lblAtttachmentHidden"))
                {
                    Util.ShowMessage(Page, SR.DataIsExist(fuEdit.FileName));
                    return;
                }

                PKP o = coll[e.Item.ItemIndex];
                o.NoPKP = txtPKPEdit.Text.Trim();

                if (fuEdit.PostedFile != null)
                {
                    if (fuEdit.PostedFile.ContentLength > 0)
                    {
                        Stream strm = fuEdit.PostedFile.InputStream;
                        byte[] bytes = new byte[Convert.ToInt32(fuEdit.PostedFile.ContentLength)];
                        strm.Read(bytes, 0, Convert.ToInt32(fuEdit.PostedFile.ContentLength));
                        strm.Close();

                        o.Attachment = bytes;
                        o.NamaFile = fuEdit.FileName;
                        o.Url = string.Empty;
                    }
                }

                o.Keterangan = txtKeteranganEdit.Text.Trim();

                coll[e.Item.ItemIndex] = o;
                ViewState["PKP"] = coll;

                dgPKPLainnya.EditItemIndex = -1;
                dgPKPLainnya.ShowFooter = true;
            }
            if (e.CommandName == "edit")
            {
                dgPKPLainnya.ShowFooter = false;
                dgPKPLainnya.EditItemIndex = e.Item.ItemIndex;
            }
            if (e.CommandName == "cancel")
            {
                dgPKPLainnya.EditItemIndex = -1;
                dgPKPLainnya.ShowFooter = true;
            }
            if (e.CommandName == "delete")
            {
                coll.RemoveAt(e.Item.ItemIndex);
                ViewState["PKP"] = coll;
            }
            BindPKP();
        }
        private void BindAllRelatedData(SPListItem item)
        {
            SPList listPemegangSaham = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "PemegangSaham"));
            SPQuery query = new SPQuery();
            query.Query = "<Where>" +
                              "<Eq>" +
                                 "<FieldRef Name='PerusahaanBaru' LookupId='True' />" +
                                 "<Value Type='Lookup'>" + IDP + "</Value>" +
                              "</Eq>" +
                          "</Where>" +
                          "<OrderBy>" +
                            "<FieldRef Name='Created' Ascending='False' />" +
                          "</OrderBy>";
            SPListItemCollection collSPPemegangSaham = listPemegangSaham.GetItems(query);

            List<PemegangSaham> collPemegangSaham = new List<PemegangSaham>();
            foreach (SPListItem i in collSPPemegangSaham)
            {
                PemegangSaham o = new PemegangSaham();
                o.ID = i.ID;
                if (i["PemegangSaham"] != null)
                {
                    string IDMasterData = i["PemegangSaham"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    SPListItem itemPSKMaster = Util.GetPemegangSahamKomisarisMasterData(web, Convert.ToInt32(IDMasterData));

                    o.IDPemegangSaham = itemPSKMaster.ID;
                    o.Nama = itemPSKMaster["Title"].ToString();
                }
                o.JumlahNominal = Convert.ToDouble(i["JumlahNominal"]);
                o.JumlahSaham = Convert.ToDouble(i["JumlahSaham"]);
                o.Partner = Convert.ToBoolean(i["Partner"]);
                o.Percentages = Convert.ToDouble(i["Percentages"]);
                collPemegangSaham.Add(o);
            }
            ViewState["PemegangSaham"] = collPemegangSaham;
            ViewState["PemegangSahamEdit"] = collPemegangSaham;
            BindPemegangSaham();

            SPList listWewenangDireksi = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "WewenangDireksi"));
            SPListItemCollection collSPWewenangDireksi = listWewenangDireksi.GetItems(query);

            List<WewenangDireksi> collWewenangDireksi = new List<WewenangDireksi>();
            foreach (SPListItem i in collSPWewenangDireksi)
            {
                WewenangDireksi o = new WewenangDireksi();
                o.ID = i.ID;
                o.Nama = i["Title"].ToString();
                collWewenangDireksi.Add(o);
            }
            ViewState["WewenangDireksi"] = collWewenangDireksi;
            ViewState["WewenangDireksiEdit"] = collWewenangDireksi;
            BindWewenangDireksi();

            SPList listKomisarisDireksi = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "KomisarisDireksi"));
            SPListItemCollection collSPKomisarisDireksi = listKomisarisDireksi.GetItems(query);

            List<KomisarisDireksi> collKomisarisDireksi = new List<KomisarisDireksi>();
            foreach (SPListItem i in collSPKomisarisDireksi)
            {
                KomisarisDireksi o = new KomisarisDireksi();
                o.ID = i.ID;
                if (i["KomisarisDireksi"] != null)
                {
                    string IDMasterData = i["KomisarisDireksi"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    SPListItem itemPSKMaster = Util.GetPemegangSahamKomisarisMasterData(web, Convert.ToInt32(IDMasterData));

                    o.IDKomisaris = itemPSKMaster.ID;
                    o.Nama = itemPSKMaster["Title"].ToString();
                }
                String[] split = i["Jabatan"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries);
                o.IDJabatan = Convert.ToInt32(split[0]);
                o.Jabatan = split[1];
                if (i["TanggalMulaiMenjabat"] != null)
                    o.MulaiMenjabat = Convert.ToDateTime(i["TanggalMulaiMenjabat"]);
                if (i["TanggalAkhirMenjabat"] != null)
                    o.AkhirMenjabat = Convert.ToDateTime(i["TanggalAkhirMenjabat"]);
                collKomisarisDireksi.Add(o);
            }
            ViewState["KomisarisDireksi"] = collKomisarisDireksi;
            ViewState["KomisarisDireksiEdit"] = collKomisarisDireksi;
            BindKomisarisDireksi();

            SPList listDokumen = web.GetList(Util.CreateSharePointDocLibStrUrl(web.Url, "DokumenLainnya"));
            SPListItemCollection collSPDokumen = listDokumen.GetItems(query);

            List<Dokumen> collDokumen = new List<Dokumen>();
            foreach (SPListItem i in collSPDokumen)
            {
                Dokumen o = new Dokumen();
                o.ID = i.ID;
                o.NamaFile = i["Name"].ToString();
                if (i["Penjelasan"] != null)
                    o.Penjelasan = i["Penjelasan"].ToString();
                o.TipeDokumen = i["TipeDokumen"] == null ? string.Empty : i["TipeDokumen"].ToString();
                o.Attachment = i.File.OpenBinary();
                o.AttachmentOld = o.Attachment;
                o.Url = string.Format("<a href='{0}/DokumenLainnya/{1}'>{1}</a>", web.Url, i["Name"].ToString());
                collDokumen.Add(o);
            }
            ViewState["Dokumen"] = collDokumen;
            ViewState["DokumenEdit"] = collDokumen;
            BindDokumen();

            SPList listNPWP = web.GetList(Util.CreateSharePointDocLibStrUrl(web.Url, "NPWPLainnya"));
            SPListItemCollection collSPNPWP = listNPWP.GetItems(query);

            List<NPWP> collDokumenNPWP = new List<NPWP>();
            foreach (SPListItem i in collSPNPWP)
            {
                NPWP o = new NPWP();
                o.ID = i.ID;
                o.NamaFile = i["Name"].ToString();
                o.NoNPWP = i["NoNPWP"].ToString();
                if (i["Keterangan"] != null)
                    o.Keterangan = i["Keterangan"].ToString();
                o.Attachment = i.File.OpenBinary();
                o.AttachmentOld = o.Attachment;
                o.Url = string.Format("<a href='{0}/NPWPLainnya/{1}'>{1}</a>", web.Url, i["Name"].ToString());
                collDokumenNPWP.Add(o);
            }
            ViewState["NPWP"] = collDokumenNPWP;
            ViewState["NPWPEdit"] = collDokumenNPWP;
            BindNPWP();

            SPList listPKP = web.GetList(Util.CreateSharePointDocLibStrUrl(web.Url, "PKPLainnya"));
            SPListItemCollection collSPPKP = listPKP.GetItems(query);

            List<PKP> collDokumenPKP = new List<PKP>();
            foreach (SPListItem i in collSPPKP)
            {
                PKP o = new PKP();
                o.ID = i.ID;
                o.NamaFile = i["Name"].ToString();
                o.NoPKP = i["NoPKP"].ToString();
                if (i["Keterangan"] != null)
                    o.Keterangan = i["Keterangan"].ToString();
                o.Attachment = i.File.OpenBinary();
                o.AttachmentOld = o.Attachment;
                o.Url = string.Format("<a href='{0}/PKPLainnya/{1}'>{1}</a>", web.Url, i["Name"].ToString());
                collDokumenPKP.Add(o);
            }
            ViewState["PKP"] = collDokumenPKP;
            ViewState["PKPEdit"] = collDokumenPKP;
            BindPKP();

            DisplayDocument(ltrfuSKDP, item.Title, "SKDP", ltrOriginalSKDP, chkOriginalSKDP);
            DisplayDocument(ltrfuAkte, item.Title, "Akta", ltrOriginalAkte, chkOriginalAkte);
            DisplayDocument(ltrfuNPWP, item.Title, "NPWP", ltrOriginalNPWP, chkOriginalNPWP);
            DisplayDocument(ltrfuPKP, item.Title, "PKP", ltrOriginalPKP, chkOriginalPKP);
            DisplayDocument(ltrfuAPV, item.Title, "Journal Voucher", ltrOriginalAPV, chkOriginalAPV);
            DisplayDocument(ltrfuSetoranModal, item.Title, "Setoran Modal", ltrOriginalSetoranModal, chkOriginalSetoranModal);
            DisplayDocument(ltrfuAkte, item.Title, "Akta and SK Pengesahan Pendirian", ltrOriginalAkte, chkOriginalAkte);
            DisplayDocument(ltrfuBNRI, item.Title, "BNRI", ltrOriginalBNRI, chkOriginalBNRI);
        }