private void Display(string mode) { SPList list = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "PendirianPerusahaanBaruForeign")); SPListItem item = list.GetItemById(IDP); if (item["Status"] != null) ViewState["Status"] = item["Status"].ToString(); else { if (item["ApprovalStatus"] != null) ViewState["Status"] = item["ApprovalStatus"].ToString(); } if (item.Workflows.Count > 0 || ViewState["Status"].ToString() == "Approved") btnSaveUpdateRunWf.Visible = false; if (mode == "edit") { btnSaveUpdate.Text = "Update"; btnSaveUpdateRunWf.Text = "Update & Run Workflow"; } else if (mode == "display") { btnSaveUpdate.Visible = false; btnSaveUpdateRunWf.Visible = false; } ltrRequestCode.Text = item["Title"].ToString(); ltrDate.Text = Convert.ToDateTime(item["Date"].ToString()).ToString("dd-MMM-yyyy HH:mm"); txtProject.Text = item["Project"].ToString(); if (item["Requestor"] != null) { int IDPemohon = Convert.ToInt32(item["Requestor"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[0]); hfIDRequestor.Value = IDPemohon.ToString(); SPList listPemohon = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "Pemohon")); SPListItem itemPemohon = listPemohon.GetItemById(IDPemohon); txtRequestor.Text = itemPemohon.Title; txtRequestorEmail.Text = itemPemohon["EmailPemohon"].ToString(); } txtCompanyName.Text = item["CompanyName"].ToString(); txtCountryEst.Text = item["CountryOfEstablishment"].ToString(); txtActivities.Text = item["Activities"].ToString(); txtAuthorizedCapital.Text = Convert.ToDouble(item["AuthorizeCapital"]).ToString("#,##0"); txtPaidUpCapital.Text = Convert.ToDouble(item["PaidUpCapital"]).ToString("#,##0"); txtParValue.Text = Convert.ToDouble(item["ParValue"]).ToString("#,##0"); txtKeterangan.Text = item["Keterangan"] == null ? string.Empty : item["Keterangan"].ToString(); ltrProject.Text = txtProject.Text; ltrRequestor.Text = txtRequestor.Text; ltrRequestorEmail.Text = txtRequestorEmail.Text; ltrCompanyName.Text = txtCompanyName.Text; ltrCountryEst.Text = txtCountryEst.Text; ltrActivities.Text = txtActivities.Text; ltrAuthorizedCapital.Text = txtAuthorizedCapital.Text; ltrPaidUpCapital.Text = txtPaidUpCapital.Text; ltrParValue.Text = txtParValue.Text; ltrKeterangan.Text = txtKeterangan.Text; SPList shareholder = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "Shareholder")); SPQuery query = new SPQuery(); query.Query = "<Where>" + "<Eq>" + "<FieldRef Name='PendirianPerusahaanBaruForeign' LookupId='True' />" + "<Value Type='Lookup'>" + IDP + "</Value>" + "</Eq>" + "</Where>" + "<OrderBy>" + "<FieldRef Name='Created' Ascending='False' />" + "</OrderBy>"; SPListItemCollection coll = shareholder.GetItems(query); List<Shareholder> collShareholder = new List<Shareholder>(); foreach (SPListItem i in coll) { Shareholder o = new Shareholder(); o.ID = i.ID; o.Address = i["Address"].ToString(); o.Country = i["CountryOfEstablishment"].ToString(); o.Name = i.Title; collShareholder.Add(o); } ViewState["Shareholder"] = collShareholder; ViewState["ShareholderEdit"] = collShareholder; BindShareholder(); SPList officer = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "Officer")); coll = officer.GetItems(query); List<Officer> collOfficer = new List<Officer>(); foreach (SPListItem i in coll) { Officer o = new Officer(); o.ID = i.ID; o.Name = i.Title; if (i["Roles"] != null) { o.Role = i["Roles"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[1]; o.RoleID = Convert.ToInt32(i["Roles"].ToString().Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[0]); } collOfficer.Add(o); } ViewState["Officer"] = collOfficer; ViewState["OfficerEdit"] = collOfficer; BindOfficer(); /* Akta */ if (item["NoMA"] != null) { txtNoMA.Text = item["NoMA"].ToString(); ltrNoMA.Text = item["NoMA"].ToString(); } if (item["DateOfEntryMA"] != null) { dtTanggalMulaiBerlakuMA.SelectedDate = Convert.ToDateTime(item["DateOfEntryMA"]); ltrTanggalMulaiBerlakuMA.Text = Convert.ToDateTime(item["DateOfEntryMA"]).ToString("dd-MMM-yyyy"); } if (item["NoteMA"] != null) { txtKeteranganMA.Text = item["NoteMA"].ToString(); ltrKeteranganMA.Text = item["NoteMA"].ToString(); } /* CI */ if (item["NoCI"] != null) { txtNoCI.Text = item["NoCI"].ToString(); ltrNoCI.Text = item["NoCI"].ToString(); } if (item["DateOfEntryCI"] != null) { dtTanggalMulaiBerlakuCI.SelectedDate = Convert.ToDateTime(item["DateOfEntryCI"]); ltrTanggalMulaiBerlakuCI.Text = Convert.ToDateTime(item["DateOfEntryCI"]).ToString("dd-MMM-yyyy"); } if (item["NoteCI"] != null) { txtKeteranganCI.Text = item["NoteCI"].ToString(); ltrKeteranganCI.Text = item["NoteCI"].ToString(); } /* BP */ if (item["NoBP"] != null) { txtNoBP.Text = item["NoBP"].ToString(); ltrNoBP.Text = item["NoBP"].ToString(); } if (item["DateOfEntryBP"] != null) { dtTanggalMulaiBerlakuBP.SelectedDate = Convert.ToDateTime(item["DateOfEntryBP"]); ltrTanggalMulaiBerlakuBP.Text = Convert.ToDateTime(item["DateOfEntryBP"]).ToString("dd-MMM-yyyy"); } if (item["NoteBP"] != null) { txtKeteranganBP.Text = item["NoteBP"].ToString(); ltrKeteranganBP.Text = item["NoteBP"].ToString(); } DisplayDocument(ltrfuMA, item.Title, "M&A"); DisplayDocument(ltrfuCI, item.Title, "Certification of Incorporation"); DisplayDocument(ltrfuBP, item.Title, "Business Profile"); if (ViewState["Status"].ToString() == PIC_CORSEC) pnlPICCorsec.Visible = true; if (item["ApprovalStatus"] != null) { if (item["ApprovalStatus"].ToString() == APPROVED) { pnlPICCorsec.Visible = true; pnlAssigned.Visible = true; } } HiddenControls(mode, ViewState["Status"].ToString()); }
protected void dgShareholder_ItemCommand(object source, DataGridCommandEventArgs e) { List<Shareholder> coll = new List<Shareholder>(); if (ViewState["Shareholder"] != null) coll = ViewState["Shareholder"] as List<Shareholder>; if (e.CommandName == "add") { TextBox txtNameAdd = e.Item.FindControl("txtNameAdd") as TextBox; TextBox txtAddressAdd = e.Item.FindControl("txtAddressAdd") as TextBox; TextBox txtCountryEstablishmentAdd = e.Item.FindControl("txtCountryEstablishmentAdd") as TextBox; if (isExistInShareholderGrid(txtNameAdd.Text)) { Util.ShowMessage(Page, SR.DataIsExist(txtNameAdd.Text.Trim())); return; } Shareholder o = new Shareholder(); o.Name = txtNameAdd.Text.Trim(); o.Address = txtAddressAdd.Text.Trim(); o.Country = txtCountryEstablishmentAdd.Text.Trim(); o.ID = 0; coll.Add(o); ViewState["Shareholder"] = coll; } if (e.CommandName == "save") { TextBox txtNameEdit = e.Item.FindControl("txtNameEdit") as TextBox; TextBox txtAddressEdit = e.Item.FindControl("txtAddressEdit") as TextBox; TextBox txtCountryEstablishmentEdit = e.Item.FindControl("txtCountryEstablishmentEdit") as TextBox; if (isExistInShareholderGrid(txtNameEdit.Text)) { Util.ShowMessage(Page, SR.DataIsExist(txtNameEdit.Text.Trim())); return; } Shareholder o = new Shareholder(); o.Name = txtNameEdit.Text.Trim(); o.Address = txtAddressEdit.Text.Trim(); o.Country = txtCountryEstablishmentEdit.Text.Trim(); coll[e.Item.ItemIndex] = o; ViewState["Shareholder"] = coll; dgShareholder.EditItemIndex = -1; dgShareholder.ShowFooter = true; } if (e.CommandName == "edit") { dgShareholder.ShowFooter = false; dgShareholder.EditItemIndex = e.Item.ItemIndex; } if (e.CommandName == "cancel") { dgShareholder.EditItemIndex = -1; dgShareholder.ShowFooter = true; } if (e.CommandName == "delete") { coll.RemoveAt(e.Item.ItemIndex); ViewState["Shareholder"] = coll; } BindShareholder(); }