public void rptOrgList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { Label lbl; HiddenField hfField; try { BUSINESS_ORG busOrg = (BUSINESS_ORG)e.Item.DataItem; lbl = (Label)e.Item.FindControl("lblParentBUHdr_out"); if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1) { lbl.Text = "Top Level"; } else { BUSINESS_ORG parentOrg = null; if ((parentOrg = SQMModelMgr.LookupParentBusOrg(null, busOrg)) != null) { lbl.Text = parentOrg.ORG_NAME; } } lbl = (Label)e.Item.FindControl("lblStatus"); hfField = (HiddenField)e.Item.FindControl("hfStatus"); lbl.Text = WebSiteCommon.GetStatusString(hfField.Value); GridView gv = (GridView)e.Item.FindControl("gvPlantList"); gv.DataSource = busOrg.PLANT.OrderBy(l => l.PLANT_NAME).ToList(); // order by plant name gv.DataBind(); Label divLabel = (Label)e.Item.FindControl("lblPlantListEmpty"); HtmlGenericControl div = (HtmlGenericControl)e.Item.FindControl("divPlantGVScroll"); SetGridViewDisplay(gv, divLabel, div, 20, gv.Rows.Count, "scrollArea"); if (UserContext.GetMaxScopePrivilege(SysScope.busloc) <= SysPriv.admin) { if (busOrg.PLANT.Count > 0) { Button btnAddPlant = (Button)gv.HeaderRow.FindControl("btnAddPlant"); btnAddPlant.CommandArgument = busOrg.BUS_ORG_ID.ToString(); btnAddPlant.Visible = true; } else { Button btnAddPlant = (Button)e.Item.FindControl("btnAddPlantEmpty"); btnAddPlant.CommandArgument = busOrg.BUS_ORG_ID.ToString(); btnAddPlant.Visible = true; } } } catch { } } }
private void DisplayBusOrg() { BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg; DropDownList ddl = (DropDownList)hfBase.FindControl("ddlCurrencyCodes"); if (ddl.Items.Count == 0) { SQMBasePage.FillCurrencyDDL(ddl, "USD"); List <BUSINESS_ORG> parent_orgs = SQMModelMgr.SelectBusOrgList(entities, SessionManager.EffLocation.Company.COMPANY_ID, 0, true); ddl = (DropDownList)hfBase.FindControl("ddlParentBusOrg"); ddl.DataSource = parent_orgs; ddl.DataTextField = "ORG_NAME"; ddl.DataValueField = "BUS_ORG_ID"; ddl.DataBind(); List <Settings> status_codes = SQMSettings.Status; ddl = (DropDownList)hfBase.FindControl("ddlStatus"); ddl.DataSource = status_codes; ddl.DataTextField = "short_desc"; ddl.DataValueField = "code"; ddl.DataBind(); } if (busOrg != null) { if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1) { SetFindControlValue("lblParentBU_out", hfBase, "Top Level"); } else { if (SessionManager.ParentBusinessOrg == null) { SessionManager.ParentBusinessOrg = SQMModelMgr.LookupParentBusOrg(entities, busOrg); } BUSINESS_ORG parentOrg = (BUSINESS_ORG)SessionManager.ParentBusinessOrg; SetFindControlValue("lblParentBU_out", hfBase, parentOrg.ORG_NAME); } // editable fields SetFindControlValue("tbOrgname", hfBase, busOrg.ORG_NAME); SetFindControlValue("tbOrgLocCode", hfBase, busOrg.DUNS_CODE); SetFindControlValue("ddlCurrencyCodes", hfBase, busOrg.PREFERRED_CURRENCY_CODE); SetFindControlValue("ddlStatus", hfBase, busOrg.STATUS); if (busOrg.PARENT_BUS_ORG_ID > 0) { SetFindControlValue("ddlParentBusOrg", hfBase, busOrg.PARENT_BUS_ORG_ID.ToString()); } SetFindControlValue("lblLastUpdate_out", hfBase, busOrg.LAST_UPD_BY); lblLastUpdateDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "d", false); } }
private void SetupPage() { BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.BusinessOrg; pnlBusOrgDetail.Visible = true; // bu summary section SetFindControlValue("lblOrgName_out", hfBase, busOrg.ORG_NAME); SetFindControlValue("lblLocCode_out", hfBase, busOrg.DUNS_CODE); SetFindControlValue("lblCurrency_out", hfBase, busOrg.PREFERRED_CURRENCY_CODE); SetFindControlValue("lblCaseThreshold_out", hfBase, busOrg.THRESHOLD_AMT.ToString()); SetFindControlValue("lblStatus_out", hfBase, WebSiteCommon.GetStatusString(busOrg.STATUS)); SetFindControlValue("lblUpdatedBy_out", hfBase, busOrg.LAST_UPD_BY); SetFindControlValue("lblUpdatedDate_out", hfBase, WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString()); if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1) { SetFindControlValue("lblParentBU_out", hfBase, "Top Level"); } else { if (SessionManager.ParentBusinessOrg == null) { SessionManager.ParentBusinessOrg = SQMModelMgr.LookupParentBusOrg(entities, busOrg); } BUSINESS_ORG parentOrg = (BUSINESS_ORG)SessionManager.ParentBusinessOrg; SetFindControlValue("lblParentBU_out", hfBase, parentOrg.ORG_NAME); } // editable fields SetFindControlValue("tbOrgname", hfBase, busOrg.ORG_NAME); SetFindControlValue("tbOrgLocCode", hfBase, busOrg.DUNS_CODE); SetFindControlValue("tbThreshold", hfBase, busOrg.THRESHOLD_AMT.ToString()); SetFindControlValue("ddlCurrencyCodes", hfBase, busOrg.PREFERRED_CURRENCY_CODE); SetFindControlValue("ddlStatus", hfBase, busOrg.STATUS); if (busOrg.PARENT_BUS_ORG_ID > 0) { SetFindControlValue("ddlParentBusOrg", hfBase, busOrg.PARENT_BUS_ORG_ID.ToString()); } SetFindControlValue("lblLastUpdate_out", hfBase, busOrg.LAST_UPD_BY); SetFindControlValue("lblLastUpdateDate_out", hfBase, WebSiteCommon.LocalTime((DateTime)busOrg.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString()); }
public void DisplayBusOrg(COMPANY company, BUSINESS_ORG busOrg) { pnlBusOrgHdr.Visible = true; lblOrgName_out.Text = busOrg.ORG_NAME; lblLocCode_out.Text = busOrg.DUNS_CODE; if (busOrg.PARENT_BUS_ORG_ID == busOrg.BUS_ORG_ID || busOrg.PARENT_BUS_ORG_ID < 1) { lblParentBU_out.Text = "Top Level"; } else { if (SessionManager.ParentBusinessOrg == null) { if ((SessionManager.ParentBusinessOrg = SQMModelMgr.LookupParentBusOrg(null, busOrg)) == null) { SessionManager.ParentBusinessOrg = busOrg; } } BUSINESS_ORG parentOrg = (BUSINESS_ORG)SessionManager.ParentBusinessOrg; lblParentBU_out.Text = parentOrg.ORG_NAME; } }