示例#1
0
        public void BindNotifyList(PSsqmEntities ctx, decimal companyID, decimal busorgID, decimal plantID, List <TaskRecordType> recordTypeList)
        {
            ToggleVisible(pnlNotifyList);
            NOTIFY notify = null;

            scopeList = recordTypeList.Select(l => ((int)l).ToString()).ToList();
            List <NOTIFY> notifyList = new List <NOTIFY>();

            hfNotifyCompanyID.Value = SessionManager.EffLocation.Company.COMPANY_ID.ToString();
            hfNotifyBusorgID.Value  = busorgID.ToString();
            hfNotifyPlantID.Value   = plantID.ToString();
            hfNotifyB2BID.Value     = "0";

            if (plantID > 0)
            {
                staticPersonList = SQMModelMgr.SelectPlantPersonList(SessionManager.EffLocation.Company.COMPANY_ID, SessionManager.EffLocation.Plant.PLANT_ID, "");
                notifyList       = SQMModelMgr.SelectNotifyList(ctx, 0, SessionManager.EffLocation.Plant.PLANT_ID, 0, scopeList);
            }
            else
            {
                staticPersonList = SQMModelMgr.SelectBusOrgPersonList(SessionManager.EffLocation.Company.COMPANY_ID, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID);
                notifyList       = SQMModelMgr.SelectNotifyList(ctx, SessionManager.EffLocation.BusinessOrg.BUS_ORG_ID, 0, 0, scopeList);
            }

            foreach (string scope in scopeList)
            {
                if ((notify = notifyList.Where(l => l.NOTIFY_SCOPE == scope).FirstOrDefault()) == null)
                {
                    notify = new NOTIFY();
                    notify.NOTIFY_SCOPE = scope; // xlat.Key;
                    notify.COMPANY_ID   = companyID;
                    if (busorgID > 0)
                    {
                        notify.BUS_ORG_ID = busorgID;
                    }
                    if (plantID > 0)
                    {
                        notify.PLANT_ID = plantID;
                    }
                    notifyList.Add(notify);
                }
            }

            notifyList = (from n in scopeList join s in notifyList on n equals s.NOTIFY_SCOPE select s).ToList();
            gvNotifyList.DataSource = notifyList;
            gvNotifyList.DataBind();
        }