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

Legend:
Removed from v.102  
changed lines
  Added in v.103

  ViewVC Help
Powered by ViewVC 1.1.20