/[H8]/trunk/h8server/h8serverDlg.cpp
ViewVC logotype

Diff of /trunk/h8server/h8serverDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 100 by kevin, Fri May 25 08:34:08 2007 UTC revision 104 by kevin, Sun May 27 15:03:22 2007 UTC
# Line 205  void mysocket::OnReceive(int nErrorCode) Line 205  void mysocket::OnReceive(int nErrorCode)
205          CString senddata, termID, ssum, hellodata1, hellodata2;          CString senddata, termID, ssum, hellodata1, hellodata2;
206          unsigned char Output[30];          unsigned char Output[30];
207          unsigned int price, isum, cash, bytte;          unsigned int price, isum, cash, bytte;
208          int status;          int status, intlogid;
209          unsigned char reqID;          unsigned char reqID;
210          log l;          log l;
211          translog tl;          translog tl;
# Line 214  void mysocket::OnReceive(int nErrorCode) Line 214  void mysocket::OnReceive(int nErrorCode)
214          status = worksock.Receive(buffer,30);          status = worksock.Receive(buffer,30);
215          if (status != SOCKET_ERROR) {          if (status != SOCKET_ERROR) {
216                    
         //getvareinfo og sendvareinfo  
         if(status < 18 && status > 10)  
         {  
                 reqID = buffer[0];  
                 unsigned char antal = buffer[1];  
                 unsigned char length = buffer[2];  
                 int test;  
                 if(length == 'A')  
                 {  
                         test = 10;  
                 }  
                   
                 //l.logID = "5";  
   
                 for (int i=3; i < (3+test); i++){  
                         barcode[i-3] = buffer[i];  
                         }  
                 barcode[test] = '\0';  
                 eq = CommonStorage::Instance()->getDBLayer()->GetEquipment(barcode,0,0);  
                 price = (atoi(eq.price)*100);  
                 Output[0] = 1;  
                 Output[1] = 1;  
                 Output[2] = price >> 24;  
                 Output[3] = price >> 16;  
                 Output[4] = price >> 8;  
                 Output[5] = price;  
                 Output[6] = eq.description.GetLength();  
                 int outputlength;  
                 outputlength = Output[6];  
                 for (int i = 7; i < (7+outputlength); i++){  
                         Output[i] = eq.description[i-7];  
                 }  
                 Output[outputlength] = '\0';  
   
                 worksock.Send(Output,7);  
   
                 //LOG SKAL LAVES NUUUUUUUUUUUUUUUUUUUUUUU  
                 if(atoi(tl.logID) > 0)  
                 {  
                         CString logantal;  
                         logantal.Format("%d",antal-48);  
                         CommonStorage::Instance()->getDBLayer()->TransaktionsEnhed(tl.logID, eq.price, barcode,logantal);  
                 }  
         }  
           
217          switch(buffer[0])          switch(buffer[0])
218          {          {
219                                    
# Line 270  void mysocket::OnReceive(int nErrorCode) Line 225  void mysocket::OnReceive(int nErrorCode)
225                                    
226                          senddata.Format("%d", ack);                          senddata.Format("%d", ack);
227                          worksock.Send(senddata, senddata.GetLength(),0);                          worksock.Send(senddata, senddata.GetLength(),0);
228                          CommonStorage::Instance()->getDBLayer()->Transaktionslog(termID,0);                          tl = CommonStorage::Instance()->getDBLayer()->Transaktionslog(termID,0);
229                            intlogid = (atoi(tl.logID));
230                          break;                          break;
231    
232          case '2':          case '2':
# Line 327  void mysocket::OnReceive(int nErrorCode) Line 283  void mysocket::OnReceive(int nErrorCode)
283                    
284          }          }
285    
286            //getvareinfo og sendvareinfo
287            if(status < 18 && status > 10)
288            {
289                    reqID = buffer[0];
290                    unsigned char antal = buffer[1];
291                    unsigned char length = buffer[2];
292                    int test;
293                    if(length == 'A')
294                    {
295                            test = 10;
296                    }
297                    
298    
299                    for (int i=3; i < (3+test); i++){
300                            barcode[i-3] = buffer[i];
301                            }
302                    barcode[test] = '\0';
303                    eq = CommonStorage::Instance()->getDBLayer()->GetEquipment(barcode,0,0);
304                    price = (atoi(eq.price)*100);
305                    Output[0] = 1;
306                    Output[1] = price >> 24;
307                    Output[2] = price >> 16;
308                    Output[3] = price >> 8;
309                    Output[4] = price;
310                    Output[5] = eq.description.GetLength();
311                    int outputlength;
312                    outputlength = Output[5];
313                    for (int i = 6; i < (6+outputlength); i++){
314                            Output[i] = eq.description[i-6];
315                    }
316                    Output[outputlength] = '\0';
317    
318                    worksock.Send(Output,6);
319    
320                    //LOG SKAL LAVES NUUUUUUUUUUUUUUUUUUUUUUU
321                    if(intlogid > 0)
322                    {
323                            CString logantal;
324                            logantal.Format("%d",antal-48);
325                            CommonStorage::Instance()->getDBLayer()->TransaktionsEnhed(tl.logID, eq.price, barcode,logantal);
326                    }
327            }
328    
329          }          }
330    
331          CSocket::OnReceive(nErrorCode);          CSocket::OnReceive(nErrorCode);

Legend:
Removed from v.100  
changed lines
  Added in v.104

  ViewVC Help
Powered by ViewVC 1.1.20