Пример #1
0
        //public static void PostServiceAndDayVolunteer(List<Dto.ServiceAndDayToVolunteerDto> d)
        //{

        //    MediationDal.PostServiceAndDayVolunteer(converterEF.ServiceAndDayToVolunteerConverters.ToDalServiceAndDayToVolunteer(d));

        //}

        public static void MediationFindMother(long VolunteerId)
        {
            List <selectMotherByServiceAndDay_Result> Mother = new List <selectMotherByServiceAndDay_Result>();

            Mother = MediationDal.selectMotherByServiceAndDay(VolunteerId);
            if (Mother != null)

            {
                foreach (var item in Mother)
                {
                    string massage = "האם תוכלי להתנדב ביום:" + item.DescribeDay + "בתאריך: " + item.BirthDateOfService +
                                     "לעשות:" + item.DescribeService
                                     + "קוד אישור התנדבות" + item.ServiceManagementId +
                                     "לינק לאישור התנדבות " + "http://localhost:4200/volunteer-approval.component";

                    string subject = "אישור התנדבות";
                    EmailBll.mail(item.volunteerEmail, massage, subject);
                    break;
                }
            }
        }
Пример #2
0
        public static void PostServiceVolunteer(List <Dto.ServiceAndDayToVolunteerDto> d)
        {
            long a = MediationDal.PostServiceAndDayVolunteer(converterEF.ServiceAndDayToVolunteerConverters.ToDalServiceAndDayToVolunteer(d));
            List <SelectVolunteerByServiceNew_Result> VolunteerByService = new List <SelectVolunteerByServiceNew_Result>();

            VolunteerByService = MediationDal.SelectByService(a);
            foreach (var item in VolunteerByService)
            {
                volunteerEmail = item.volunteerEmail;
                serviceId      = item.serviceId;
                break;
            }
            StringBuilder SB = new StringBuilder();

            SB.Append("http://localhost:4200/volunteer-approval.component");
            if (serviceId == 1)
            {
                SB.Append("?param1="); SB.Append(HttpUtility.UrlEncode("1"));
            }
            else if (serviceId == 2)
            {
                SB.Append("?param1="); SB.Append(HttpUtility.UrlEncode("2"));
            }
            else if (serviceId == 3)
            {
                SB.Append("?param1="); SB.Append(HttpUtility.UrlEncode("3"));
            }
            else if (serviceId == 4)
            {
                SB.Append("?param1="); SB.Append(HttpUtility.UrlEncode("4"));
            }
            else if (serviceId == 5)
            {
                SB.Append("?param1="); SB.Append(HttpUtility.UrlEncode("5"));
            }
            else if (serviceId == 6)
            {
                SB.Append("?param1="); SB.Append(HttpUtility.UrlEncode("6"));
            }

            string massage = " כל התוצאות עבור ההתנדבות שבחרת " +
                             "לבחירת התנדבות לחצי על הלינק" + SB;
            string subject = "אישור התנדבות";

            EmailBll.mail(volunteerEmail, massage, subject);


            //פה אנחנו רוצות להחזיר לאנגולר את כל הרשימה של הסלקט לפי הסרוויס VolunteerByService
            //if (VolunteerByService != null)
            //{



            //    int[] array = { 0, 0, 0, 0, 0, 0, 0, 0 };

            //    int count = 0;
            //    foreach (var item in VolunteerByService)
            //    {
            //        volunteerId = item.volunteer;
            //        FirstName = item.VolunteerName;
            //        TheService = item.TheService;
            //        ServiceManagementId = item.ServiceManagementId;
            //        array[(int)item.MotherDay] += 1;
            // לבדוק האם זה יעיל!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            //count = 0;
            //for (int i = 0; i <array.Length; i++)
            //{
            //    if (i != 0)
            //        count++;
            //}
            //if (count == 7)
            //    break;
            //}
            //List<string> day = new List<string>();

            //for (int i = 0; i < array.Length; i++)
            //{
            //    if (array[i] != 0)
            //    {
            //        var code = DaysBll.GetDayById(i);
            //        day.Add(code);

            //    }
            //}

            //string massage1;
            //string massage2;

            //string subject = "אישור התנדבות";
            //massage1 = " האם תוכלי להתנדב ב" + TheService
            //+ "  באחד מהימים הבאים";


            //massage2 = "לבחירת ימים לחץ על הקישור" +
            //      " http://localhost:4200/volunteer-approval.component" +
            //    "קוד אישור" + ServiceManagementId;
            //foreach (var item in day)
            //{
            //    massage1 += item;
            //}
            //var volunteerEmail = UserDal.selectUserById(volunteerId);
            //massage1 += massage2;
            //EmailBll.mail(volunteerEmail.Email, massage1, subject);
        }
Пример #3
0
 public static List <SelectVolunteerByServiceNew_Result> selectvolunteerByService(long MotherId)
 {
     return(MediationDal.selectvolunteerByService(MotherId));
 }
Пример #4
0
 public static int GetStatusRequest(long ServiceManagmentId)
 {
     return(MediationDal.GetStatusRequest(ServiceManagmentId));
 }
Пример #5
0
        public static void VolunteerApproval(long ServiceManagmentId, long VolunteerId)
        {
            List <VolunteerApproval_Result> Approval = new List <VolunteerApproval_Result>();

            Approval = MediationDal.VolunteerApproval(ServiceManagmentId, VolunteerId);

            string subject = "אישור התנדבות";


            foreach (var item in Approval)
            {
                if (item.BeginningTime != null)
                {
                    if (item.EndTime != null)
                    {
                        string massage = "שלום" + item.MotherFirstName +
                                         "נמצאה מתנדבת לבקשה שלך " + item.DescribeVolunteer
                                         + "בתאריך: " + item.BirthDateOfService +
                                         "בשעה" + item.BeginningTime +
                                         "עד שעה" + item.EndTime +
                                         "שם  המתנדבת" + item.VolunteerName +
                                         "טלפון" + item.VolunteerPhone;
                        EmailBll.mail(item.MotherEmail, massage, subject);
                        BirthId  = item.BirthId;
                        MotherId = item.MotherId;
                        ServiceManagmentToBirthDal.UpdateRequest(ServiceManagmentId);
                        ServiceVolunteerToBirthDal.AddServiceVolunteerToBirth(converterEF.ServiceVolunteerToBirthConverters.ToDalServiceVolunteerToBirth(item.BirthId, item.ServiceId, item.MotherId, VolunteerId, (TimeSpan)item.BeginningTime, (TimeSpan)item.EndTime, item.BirthDateOfService));


                        break;
                    }
                    else
                    {
                        string massage = "שלום" + item.MotherFirstName +
                                         "נמצאה מתנדבת לבקשה שלך " + item.DescribeVolunteer
                                         + "בתאריך: " + item.BirthDateOfService +
                                         "בשעה" + item.BeginningTime +
                                         "שם  המתנדבת" + item.VolunteerName +
                                         "טלפון" + item.VolunteerPhone;
                        EmailBll.mail(item.MotherEmail, massage, subject);
                        BirthId  = item.BirthId;
                        MotherId = item.MotherId;
                        ServiceManagmentToBirthDal.UpdateRequest(ServiceManagmentId);
                        ServiceVolunteerToBirthDal.AddServiceVolunteerToBirth(converterEF.ServiceVolunteerToBirthConverters.ToDalServiceVolunteerToBirth(item.BirthId, item.ServiceId, item.MotherId, VolunteerId, (TimeSpan)item.BeginningTime, (TimeSpan)item.EndTime, item.BirthDateOfService));

                        break;
                    }
                }
                else
                {
                    string massage = "שלום" + item.MotherFirstName +
                                     "נמצאה מתנדבת לבקשה שלך " + item.DescribeVolunteer
                                     + "בתאריך: " + item.BirthDateOfService +
                                     "שם  המתנדבת" + item.VolunteerName +
                                     "טלפון" + item.VolunteerPhone;
                    EmailBll.mail(item.MotherEmail, massage, subject);
                    item.BeginningTime = new TimeSpan(0);
                    item.EndTime       = new TimeSpan(0);
                    BirthId            = item.BirthId;
                    MotherId           = item.MotherId;
                    ServiceManagmentToBirthDal.UpdateRequest(ServiceManagmentId);
                    ServiceVolunteerToBirthDal.AddServiceVolunteerToBirth(converterEF.ServiceVolunteerToBirthConverters.ToDalServiceVolunteerToBirth(item.BirthId, item.ServiceId, item.MotherId, VolunteerId, (TimeSpan)item.BeginningTime, (TimeSpan)item.EndTime, item.BirthDateOfService));
                }
                string massageToVolunteer = "שלום " + item.VolunteerName + " היקרה!!!!" +
                                            "תודה על השתתפותך בחסד האדיר של " + "YoledetGroup" +
                                            "פרטי ההתנדבות: " +
                                            item.DescribeVolunteer +
                                            "בתאריך: " + item.BirthDateOfService +
                                            "שם היולדת: " + item.MotherFirstName + " " + item.MotherLastName +
                                            "כתובת: " + item.MotherAddress + " " + item.MotherNumOfHouse +
                                            "טלפון: " + item.MotherPhone +
                                            "במידה ויש שינויים נא לעדכן את היולדת";
                break;
            }


            List <ServiceManagementToBirth> smtb = new List <ServiceManagementToBirth>();

            smtb = ServiceManagmentToBirthDal.CheckActiveRequest(BirthId);
            foreach (var item in smtb)
            {
                if (item.StatusRequest == 1)
                {
                    c++;
                }
                if (c > 0)
                {
                    break;
                }
            }
            if (c == 0)
            {
                UserDal.UpdateUsersActive(MotherId);
            }
        }