public static bool event_catched_and_performed(xAjax ajax, Global global) { bool bRetVal = true; string sProcedure = ajax.getProcedure(); if (sProcedure == "level_2_live_start_show()") { StringBuilder s = new StringBuilder(); string sLiveTable = build_live_table(global); s.Append("<div id=shop_live_main>"); s.Append(sLiveTable); s.Append("</div>"); ajax.WriteHtml("work_page", s.ToString()); } else if (sProcedure == "shop_live_card_inserted_event()") { string sBax = ajax.getString("parameter_1"); string sToken = ajax.getString("parameter_2"); string sEventType = ajax.getString("parameter_3"); string sHourMinuteSecond = ajax.getString("parameter_4"); ajax.WriteHtml("live_shop_single_events", sBax + ";" + sToken + ";" + sEventType + ";" + sHourMinuteSecond); int t = 0; } else if (sProcedure == "shop_live_accepted_membership_event()") { string sToken = ajax.getString("parameter_1"); string sEventType = ajax.getString("parameter_2"); string sHourMinuteSecond = ajax.getString("parameter_3"); ajax.WriteHtml("live_shop_single_events", sToken + ";" + sEventType + ";" + sHourMinuteSecond); } else if (sProcedure == "shop_live_basket_event()") { string sBasketRowId = ajax.getString("parameter_1"); string sToken = ajax.getString("parameter_2"); string sEventType = ajax.getString("parameter_3"); string sHourMinuteSecond = ajax.getString("parameter_4"); backoffice.admin_basket basket = global.www_backoffice().get_basket(sBasketRowId); string sModified = isBasketModified(basket.sBasket_B).ToString(); ajax.WriteHtml("live_shop_single_events", sBasketRowId + ";" + sToken + ";" + sEventType + ";" + sHourMinuteSecond + ";Modifisert?" + sModified); } else if (sProcedure == "shop_live_date_clicked()") { global.bShopLiveTimeDialogIsOpen = true; ajax.WriteHtml(SHOP_LIVE_DATE_MODIFY.getContainerId(), SHOP_LIVE_DATE_MODIFY.B_get_maximized_dialog(global)); } else if (sProcedure == "shop_live_date_clicked_cancel()") { global.bShopLiveTimeDialogIsOpen = false; ajax.WriteHtml("shop_live_main", build_live_table(global)); // ajax.WriteHtml(SHOP_LIVE_DATE_MODIFY.getContainerId(), SHOP_LIVE_DATE_MODIFY.A_get_minimized_dialog(global.shop_live_current_timestamp,false)); } else if (sProcedure == "shop_live_refresh_hours_and_to_hour()") { global.iHours = ajax.getInt("parameter_1"); global.iToHour = ajax.getInt("parameter_2"); ajax.WriteHtml("shop_live_main", build_live_table(global)); } else if (sProcedure == "shop_live_refresh()") { int year = ajax.getInt("parameter_1"); int month = ajax.getInt("parameter_2"); int day = ajax.getInt("parameter_3"); int iHours = ajax.getInt("parameter_4"); int iToHours = ajax.getInt("parameter_5"); global.shop_live_current_timestamp = new DateTime(year, month, day, iToHours, 0, 0); ajax.WriteHtml("shop_live_main", build_live_table(global)); } else if (sProcedure == "shop_live_start_timer_job()") { // global.shop_live_current_timestamp = DateTime.Now.Subtract(new TimeSpan(178,0,0)); global.shop_live_current_timestamp = DateTime.Now; global.iToHour = (int)global.shop_live_current_timestamp.Hour; global.iToMinute = (int)global.shop_live_current_timestamp.Minute; global.iToSecond = (int)global.shop_live_current_timestamp.Second; /* * if (global.iToHour < 22) ++global.iToHour; * else * global.iToHour = 23; */ global.iHours = global.iToHour - 10; if (global.iHours < 1) { global.iHours = 1; } global.bRunningLive = true; ajax.WriteHtml("shop_live_main", build_live_table(global)); } else if (sProcedure == "shop_live_stop_timer_job()") { global.bRunningLive = false; ajax.WriteHtml("shop_live_main", build_live_table(global)); } else { bRetVal = false; } return(bRetVal); }
public static string build_live_table(Global global) { StringBuilder s = new StringBuilder(); List <backoffice.admin_shop> shopList = global.www_backoffice().get_all_shops(global.MASTER_CHAIN_ID, true); // DateTime startFromTimestamp = DateTime.Now; if (global.shop_live_current_timestamp.Year == 2000) { global.shop_live_current_timestamp = DateTime.Now; if (global.bDEBUG_TESTING_OLD_DATABASE) { global.shop_live_current_timestamp = new DateTime(2015, 6, 30, 20, 0, 0); } } // DateTime startFromTimestamp = new DateTime(2015, 6, 30, 20, 0, 0); // global.shop_live_current_timestamp = startFromTimestamp; if (!global.bRunningLive) { global.iToMinute = 0; global.iToSecond = 0; } global.shop_live_current_timestamp = new DateTime(global.shop_live_current_timestamp.Year, global.shop_live_current_timestamp.Month, global.shop_live_current_timestamp.Day, global.iToHour, global.iToMinute, global.iToSecond); global.www_backoffice().appendAllEventsForAllShops(global, shopList, global.shop_live_current_timestamp); // { A_PHONE_ENROLLED, A_PHONE_SKIPPED, A_PHONE_ALREADY_MEMBER, B_BASKET_NOT_CONFIRMED, C_BASKET_CONFIRMED, D_MEMBERSHIP_ACCEPTED, UNKNOWN } global.www_backoffice().setRelationsToHigherLevel(shopList); if (global.bShopLiveTimeDialogIsOpen) { s.Append(SHOP_LIVE_DATE_MODIFY.B_get_maximized_dialog(global)); } else { s.Append(SHOP_LIVE_DATE_MODIFY.A_get_minimized_dialog(global.shop_live_current_timestamp, true)); } s.Append("<div class=live_body>"); s.Append("<table class=live_table>"); s.Append(" <tr>"); s.Append(" <td valign=top>"); s.Append(GET_TIMELINE_PART(global, shopList, global.shop_live_current_timestamp, 16)); s.Append(" </td>"); s.Append(" </tr>"); s.Append(" <tr>"); s.Append(" <td>"); s.Append(GET_LAST_EVENTS_PART()); s.Append(" </td>"); s.Append(" </tr>"); s.Append("<table>"); s.Append("</div>"); global.www_backoffice().log_call("live_table_called " + global.shop_live_current_timestamp.ToShortDateString()); return(s.ToString()); }