private void btnCreateBooking_Click(object sender, EventArgs e)
 {
     if (dtpTodaysDate.Value.Day < dtpExpiryDate.Value.Day)
     {
         if (cbAddress.Checked == true && cbCustomer.Checked == true && cbItem.Checked == true)
         {
             DialogResult dr = new DialogResult();
             dr = MessageBox.Show("Are you sure you want to add this booking?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dr == DialogResult.Yes)
             {
                 CUser    user       = CUser.GetInstance();
                 CLogin   login      = CLogin.GetInstance();
                 CBooking booking    = new CBooking();
                 int      iBookingID = booking.CreateBooking(dtpTodaysDate.Value, dtpExpiryDate.Value);
                 bookinginstance.iUserID    = user.GetUserID(login.GetUser());
                 bookinginstance.iBookingID = iBookingID;
                 bookinginstance.CreateBookingInstance();
                 MessageBox.Show("Booking has been created.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("Ensure that you have selected a customer, an address and an item.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Please select a date greater than todays date.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Exemple #2
0
        private CBooking EditCBooking(
            CustomerItem item,
            int account_id,
            string c_num,
            short quantity,
            DateTime wed_date,
            DateTime?wed_time,
            bool is_reserve,
            CustomerItem currentItem)
        {
            //TrfItemDao.ItemInfo型からCBooking型にコピー
            var booking = new CBooking();

            booking.item_cd    = item.item_cd;
            booking.item_name  = item.item_name;
            booking.account_id = account_id;
            booking.c_num      = c_num;
            booking.area_cd    = item.area_cd;
            //booking.area_name = this.CurrentRegionInfo.CurrentLanguage == "J" ? RegionConfig.GetAreaNameJpn(this.CurrentRegionInfo.CurrentDestination, item.area_cd) : RegionConfig.GetAreaName(this.CurrentRegionInfo.CurrentDestination, item.area_cd);
            string agent_cd     = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["BookingAgentCd"]);
            string sub_agent_cd = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["BookingSubAgentCd"]);

            booking.agent_cd      = agent_cd;
            booking.sub_agent_cd  = sub_agent_cd;
            booking.item_type     = item.item_type;
            booking.wed_date      = wed_date;
            booking.quantity      = quantity;
            booking.price         = item.price.HasValue ? item.price.Value : (Decimal)0;
            booking.price_new     = booking.price;
            booking.price_type    = item.price_type.HasValue ? item.price_type.Value : (short)0;
            booking.price_cur     = item.price_currency;
            booking.price_cur_new = booking.price_cur;
            //通貨表記
            booking.curfmt_withsymbol = RegionConfig.GetCurrencyFormatWithSymbol(this.CurrentRegionInfo.CurrentDestination);
            if (String.IsNullOrEmpty(booking.curfmt_withsymbol))
            {
                booking.curfmt_withsymbol = booking.price_cur_new + RegionConfig.GetCurrencyFormat(this.CurrentRegionInfo.CurrentDestination);
            }
            booking.cnt_picture_s     = item.cnt_picture_s;
            booking.image_upload_date = item.image_upload_date;
            booking.service_date      = wed_date;
            booking.service_time      = wed_time;
            booking.rcp_private_room  = false;
            booking.rcp_room_id       = 0;
            booking.payment_status    = CBooking.PAYSTATUS_INIT;
            //booking.fixed_qty = item.fixed_qty;
            booking.church_cd   = item.church_cd;
            booking.reserve_pkg = is_reserve;

            if (booking.item_type == "DVD")
            {
                booking.dvd_menucolor = currentItem.alb_cover;
            }
            else
            {
                booking.alb_cover = currentItem.alb_cover;
            }
            booking.alb_mount   = currentItem.alb_mount;
            booking.alb_type    = currentItem.alb_type;
            booking.last_person = Constants.LAST_PERSON;

            booking.app_cd = CBooking.APPCD_WATABECOM_PC;  //watabe.comのPC向けサイト

            return(booking);
        }