public FormOfficersCommon(ref Officer officer) { InitializeComponent(); _officer = officer; txtRank.Text = officer.MilRank; txtName.Text = officer.Name; txtSurname.Text = officer.Surname; txtPatronymic.Text = officer.Patronymic; }
public static void SetData(object obj, String name, ref Officer newOfficer) { if (name == "Имя") { newOfficer.Name = (String)obj; return; } if (name == "Фамлия") { newOfficer.Surname = (String)obj; return; } if (name == "Отчество") { newOfficer.Patronymic = (String)obj; return; } if (name == "Звание") { newOfficer.MilRank = (String)obj; return; } }
public static object GetData(Officer officer, String name) { if (name == "Имя") return officer.Name; if (name == "Фамилия") return officer.Surname; if (name == "Отчество") return officer.Patronymic; if (name == "Звание") return officer.MilRank; return null; }
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 dgOfficer_ItemCommand(object source, DataGridCommandEventArgs e) { List<Officer> coll = new List<Officer>(); if (ViewState["Officer"] != null) coll = ViewState["Officer"] as List<Officer>; if (e.CommandName == "add") { TextBox txtNameAdd = e.Item.FindControl("txtNameAdd") as TextBox; DropDownList ddRoleAdd = e.Item.FindControl("ddRoleAdd") as DropDownList; if (isExistInOfficerGrid(txtNameAdd.Text)) { Util.ShowMessage(Page, SR.DataIsExist(txtNameAdd.Text.Trim())); return; } Officer o = new Officer(); o.Name = txtNameAdd.Text.Trim(); o.Role = ddRoleAdd.SelectedItem.Text; o.RoleID = Convert.ToInt32(ddRoleAdd.SelectedValue); o.ID = 0; coll.Add(o); ViewState["Officer"] = coll; } if (e.CommandName == "save") { TextBox txtNameEdit = e.Item.FindControl("txtNameEdit") as TextBox; DropDownList ddlRoleEdit = e.Item.FindControl("ddlRoleEdit") as DropDownList; if (isExistInOfficerGrid(txtNameEdit.Text)) { Util.ShowMessage(Page, SR.DataIsExist(txtNameEdit.Text.Trim())); return; } Officer o = new Officer(); o.Name = txtNameEdit.Text.Trim(); o.Role = ddlRoleEdit.SelectedItem.Text; o.RoleID = Convert.ToInt32(ddlRoleEdit.SelectedValue); coll[e.Item.ItemIndex] = o; ViewState["Officer"] = coll; dgOfficer.EditItemIndex = -1; dgOfficer.ShowFooter = true; } if (e.CommandName == "edit") { dgOfficer.ShowFooter = false; dgOfficer.EditItemIndex = e.Item.ItemIndex; } if (e.CommandName == "cancel") { dgOfficer.EditItemIndex = -1; dgOfficer.ShowFooter = true; } if (e.CommandName == "delete") { coll.RemoveAt(e.Item.ItemIndex); ViewState["Officer"] = coll; } BindOfficer(); }
/// <summary> /// 绑定部门树 /// </summary> /// <param name="tOffice"></param> /// <param name="oTree"></param> private void BindingTree() { tOffice.Nodes.Clear(); TreeNodeInfo<OfficerInfo> oTree = new Officer().GetTree(OfficerInfo.ROOT_ID); foreach (TreeNodeInfo<OfficerInfo> node in oTree.SubNodeList) { string name = node.STInstance.Name; string id = node.STInstance.ID; TreeNode treeNode = new TreeNode(name, id); tOffice.Nodes.Add(treeNode); if (node.Count != 0) { BindingTree(node, treeNode); } } tOffice.ExpandAll(); }
protected void btnSub_Click(object sender, EventArgs e) { try { this.ParentID = this.OfficeID; string parentID = this.OfficeID; string name = tbName.Text; string remark = tbRemark.Text; int sortNum = Convert.ToInt16(tbSortNum.Text); string id = new Officer().Add(name, parentID, remark, sortNum.ToString()); this.OfficeID = id; BindingTree(); } catch (Exception exc) { ShowMsg(exc.Message); LogEntry.Log.Write(exc.ToString(), EventLogEntryType.Error, LogSourceType.联系人管理); } }
protected void tOffice_SelectedNodeChanged(object sender, EventArgs e) { try { //选中节点值 string officerID = tOffice.SelectedNode.Value; this.OfficeID = officerID; OfficerInfo oInfo = new Officer().GetByID(officerID); this.ParentID = oInfo.ParentID; tbName.Text = oInfo.Name; tbSortNum.Text = oInfo.SortNum; tbRemark.Text = oInfo.Remark; BindingList(); } catch (Exception exc) { ShowMsg(exc.Message); LogEntry.Log.Write(exc.ToString(), EventLogEntryType.Error, LogSourceType.联系人管理); } }