public bool updateOrganizationMainPage(int orgID, string orgName, string description, string meetTime, string meetDay, string meetbuilding, string meetRoom, string cxCode, int categoryID,
                                               bool requirementsMet, string requirementsMetDate, string registarApprovalDate, int statusID, List <AdvisorList> newAdvisorList, string meetFrequency,
                                               string OAcct, string ProjCode)
        {
            try
            {
                dataContext.sp_UpdateOrganizationMainPage(orgID, orgName, description, meetTime, meetDay, meetbuilding, meetRoom,
                                                          cxCode, categoryID, requirementsMet, requirementsMetDate, registarApprovalDate, statusID, meetFrequency,
                                                          OAcct, ProjCode);

                dataContext.SubmitChanges();
            }
            catch (Exception e)
            {
                return(false);
            }
            List <AdvisorList> oldAdvisorList = new List <AdvisorList>();
            var advis = dataContext.sp_GetAdvisorList();

            foreach (var x in advis)
            {
                AdvisorList advisor = new AdvisorList();
                advisor.AdvisorID = x.Advisor_ID;
                advisor.LastName  = x.LastName;
                advisor.FirstName = x.FirstName;
                advisor.Name      = x.FirstName + " " + x.LastName;
                oldAdvisorList.Add(advisor);
            }

            for (int i = 0; i < oldAdvisorList.Count; ++i)
            {
                for (int j = 0; j < newAdvisorList.Count; ++j)
                {
                    if (oldAdvisorList[i].AdvisorID == newAdvisorList[j].AdvisorID)
                    {
                        oldAdvisorList[i].FirstName = "Please Delete";
                    }
                }
            }

            for (int i = 0; i < oldAdvisorList.Count; ++i)
            {
                if (oldAdvisorList[i].FirstName != "Please Delete")
                {
                    dataContext.sp_UpdateOrgAdvisorRow(oldAdvisorList[i].AdvisorID, orgID);
                }
            }

            for (int i = 0; i < newAdvisorList.Count; ++i)
            {
                dataContext.sp_NewOrgAdvisorRow(orgID, newAdvisorList[i].AdvisorID);
            }

            return(true);
        }
Exemplo n.º 2
0
        public IList getAdvisorList()
        {
            List <AdvisorList> advisors = new List <AdvisorList>();
            var advis = dataContext.sp_GetAdvisorList();

            foreach (var x in advis)
            {
                AdvisorList advisor = new AdvisorList();
                advisor.AdvisorID = x.Advisor_ID;
                advisor.LastName  = x.LastName;
                advisor.FirstName = x.FirstName;
                advisor.Name      = x.LastName + ", " + x.FirstName;
                advisors.Add(advisor);
            }
            return(advisors);
        }