示例#1
0
        //****************************************
        public void updateOrderStatus(Order o, orderStatus s)
        {
            HostingUnit  hhelp = getHostingUnitByKey(o.HostingUnitKey);
            GuestRequest gr    = getGuestRequestByKey(o.GuestRequestKey);


            if (o.Status == orderStatus.closedResponse || o.Status == orderStatus.closedNoResponse)
            {
                throw new Exception("BL:updateOrderStatus: The order has been closed");
            }
            //if (daysBetween(o.CreateDate) >= Configuration.ExpireRequest)
            //{
            //    dal.updateOrderStatus(o, orderStatus.closedNoResponse);
            //} thread :)


            if (s == orderStatus.emailSent)
            {
                o.OrderDate = DateTime.Now.Date;
                //  sendAnEmail( o);  //the mail will be sent when we will create the wpf


                if (dal.GetHostingUnitsList().Find(item => o.HostingUnitKey == item.HostingUnitKey).Owner.CollectionClearance == false)
                {
                    throw new Exception("ERROR:updateOrderStatus: the guest didnt sign for Direct debit authorization");
                }
                else
                {
                    o.Status    = s;
                    o.OrderDate = DateTime.Now.Date;
                    dal.updateOrderStatus(o, s);
                    dal.GetOrderList().Find(item1 => o.HostingUnitKey == item1.HostingUnitKey).OrderDate = DateTime.Now;
                    Console.WriteLine("mail sent");
                }
            }
            if (s == orderStatus.closedResponse)//closedNoResponse
            {
                orderclose(o, s);
            }
            if (s == orderStatus.closedNoResponse)//
            {
                dal.updateOrderStatus(o, orderStatus.closedNoResponse);
            }
        }