Esempio n. 1
0
 function refresh()
 {
     $p_maximumValue = 0;
     $sql = '
         SELECT 
            IsoneDayAheadBidID,
            i.AssetIdentifier,
            ObjectName,
            StartDay,
            StopDay,
            MW,
            OfferPrice,
            CurtailmentInitiationPrice,
            MinimumInterruptionDuration,
            IsSent,
            i.CreatedBy,
            i.CreatedDate,
            i.UpdatedBy,
            i.UpdatedDate
         FROM 
            t_isonedayaheadbids i,
            t_pointchannels pc,
            t_objects o 
         WHERE
            pc.AssetIdentifier = i.AssetIdentifier and 
            o.ObjectID = pc.ObjectID 
         order by 
            StartDay,
            StopDay
         ';
     $result = $this->processQuery($sql, $this->sqlConnection(), 'select');
     //$this->preDebugger($result);
     if ($result['error'] != null) {
         $this->p_bidList['error'] = true;
     } else {
         if ($result['records'] > 0) {
             $this->p_size = 0;
             foreach ($result['items'] as $inx => $bidItem) {
                 if ($this->p_oUser->HasPrivilege("Read." . $bidItem->ObjectName)) {
                     $updatedBy = $bidItem->UpdatedBy == null ? 0 : $bidItem->UpdatedBy;
                     $updateDate = $bidItem->UpdatedDate == null ? 0 : $bidItem->UpdatedDate;
                     $oBid = new IsoneDayAheadBid();
                     $oBid->load($bidItem->IsoneDayAheadBidID, $bidItem->AssetIdentifier, $bidItem->StartDay, $bidItem->StopDay, $bidItem->MW, $bidItem->OfferPrice, $bidItem->CurtailmentInitiationPrice, $bidItem->MinimumInterruptionDuration, $bidItem->IsSent, $bidItem->CreatedBy, $bidItem->CreatedDate, $updatedBy, $updatedDate);
                     $this->p_bidList[$this->p_size] = $oBid;
                     $this->p_size++;
                 }
             }
         }
     }
 }
Esempio n. 2
0
function dayAheadBidsAccept($Loader, $User, $post)
{
    $Loader->includeIsoneDayAheadBids();
    $Bid = new IsoneDayAheadBid();
    $startDayParts = explode('-', $post['dayAheadStart']);
    $stopDayParts = explode('-', $post['dayAheadStop']);
    $Bid->load(0, $post['assetIdentifier'], $startDayParts[2] . '-' . $startDayParts[0] . '-' . $startDayParts[1], $stopDayParts[2] . '-' . $stopDayParts[0] . '-' . $stopDayParts[1], $post['dayAheadMW'], $post['dayAheadOfferPrice'], $post['dayAheadCurtailmentPrice'], $post['dayAheadInterruptionDuration'], 0, $User->id(), 0, 0, 0);
    if ($Bid->save()) {
        $pcIdentifier = explode(':', $post['dayAheadPoint']);
        $result = '<div class="error" style="width: 700px;">The bid was successfully submitted.</div>';
        if (!($bidList = initBidList($Loader, $User, $pcIdentifier[0], $pcIdentifier[1]))) {
            return '<div class="error" style="width: 700px;">We were unable to process your request.  Please try again. If the problem persists, please contact the <a href="http://help.crsolutions.us/">Help Desk</a>.</div>';
        }
        if (strlen($bidList) > 1) {
            $result .= $bidList;
        }
        $result .= '</form>
                    </table>
                    </div>';
        return $result;
    } else {
        return '<div class="error" style="width: 700px;">We were unable to process your request.  Please try again. If the problem persists, please contact the <a href="http://help.crsolutions.us/">Help Desk</a>.</div>';
    }
}