Ejemplo n.º 1
0
    protected void dgWewenangDireksi_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        List<WewenangDireksi> coll = new List<WewenangDireksi>();
        if (ViewState["WewenangDireksi"] != null)
            coll = ViewState["WewenangDireksi"] as List<WewenangDireksi>;

        if (e.CommandName == "add")
        {
            TextBox txtNamaAdd = e.Item.FindControl("txtNamaAdd") as TextBox;

            WewenangDireksi o = new WewenangDireksi();
            o.Nama = txtNamaAdd.Text.Trim();
            o.ID = 0;
            coll.Add(o);

            ViewState["WewenangDireksi"] = coll;
        }
        if (e.CommandName == "save")
        {
            TextBox txtNamaEdit = e.Item.FindControl("txtNamaEdit") as TextBox;

            WewenangDireksi o = new WewenangDireksi();
            o.Nama = txtNamaEdit.Text.Trim();
            o.ID = 0;

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

            dgWewenangDireksi.EditItemIndex = -1;
            dgWewenangDireksi.ShowFooter = true;
        }
        if (e.CommandName == "edit")
        {
            dgWewenangDireksi.ShowFooter = false;
            dgWewenangDireksi.EditItemIndex = e.Item.ItemIndex;
        }
        if (e.CommandName == "cancel")
        {
            dgWewenangDireksi.EditItemIndex = -1;
            dgWewenangDireksi.ShowFooter = true;
        }
        if (e.CommandName == "delete")
        {
            coll.RemoveAt(e.Item.ItemIndex);
            ViewState["WewenangDireksi"] = coll;
        }
        BindWewenangDireksi();
    }
        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);
        }