コード例 #1
0
ファイル: DepartmentFacade.cs プロジェクト: tianhang/SA39_AD
        public List<CollectionPoint> getCollectionPoints()
        {
            List<CollectionPoint> collectionPointCollection;
            try
            {
                collectionPointCollection = new List<CollectionPoint>();

                var cPList = from c in ctx.collectionPoints
                             select c;

                foreach(var c in cPList)
                {
                    CollectionPoint collectionPoint = new CollectionPoint();
                    collectionPoint.CollectionPointId = c.collectionPointId;
                    collectionPoint.Address = c.address;
                    collectionPoint.Time = c.time.ToString() ;

                    collectionPointCollection.Add(collectionPoint);
                }
            }
            catch (Exception exception)
            {
                errorobj.WriteErrorLog("DepartmentFacade-getCollectionPoints():::" + exception.ToString());
                collectionPointCollection = new List<CollectionPoint>();
            }
            return collectionPointCollection;
        }
コード例 #2
0
        public void selectSubmit(string departmentId, string departmentName, CollectionPoint collectionPoint, bool representative)
        {
            try
            {
                departmentFacade.updateCollectionPoint(departmentId, collectionPoint.CollectionPointId);

                userFacade = new UserFacade();

                string subject = "Notification for change of collection point";

                string bodyStart = "<HTML>"
                              + "<HEAD>"
                              + "</HEAD>"
                              + "<BODY>"
                              + "<BR/>"
                              + "<P>Dear ";

                string body ;

                if (representative == true)
                {
                    List<User> userCollection = userFacade.getUsersWithRole("storeClerk");

                    body = ",</P><BR/><P>The collection point of the " + departmentName + "department has been changed to " + collectionPoint.Address + " </P>";

                    body = body
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                    notifyUserController = new NotifyUserController();

                    foreach (User user in userCollection)
                    {
                        notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
                    }
                }
                else
                {
                    body = ",</P><BR/><P>The collection point of your department has been changed to " + collectionPoint.Address + " </P>";

                    body = body
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                    List<User> userCollection = userFacade.getUsersWithRole("departmentRepresentative",departmentId);

                    notifyUserController = new NotifyUserController();

                    foreach (User user in userCollection)
                    {
                        notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
                    }
                }
            }
            catch (Exception exception)
            {
                errorobj.WriteErrorLog("ChangeCollectionPointController-selectSubmit():::" + exception.ToString());
            }
        }