コード例 #1
0
 public ctl_fly ReadAndAnalysis(ctl_fly lastCommand, out string msg)
 {
     try
     {
         CtlFlyDal dal        = new CtlFlyDal();
         ctl_fly   newCommand = dal.GetSingle();
         if (lastCommand == null && newCommand == null)
         {
             msg = null;
             return(null);
         }
         else if (lastCommand == null && newCommand != null)
         {
             msg = CommandToString(newCommand);
             return(newCommand);
         }
         else if (lastCommand != null && newCommand == null)
         {
             msg = "命令已初始化完成";
             return(null);
         }
         else
         {
             if (lastCommand.input_time == newCommand.input_time && lastCommand.fly_code == newCommand.fly_code)
             {
                 msg = null;
                 return(newCommand);
             }
             else
             {
                 msg = CommandToString(newCommand);
                 return(newCommand);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
 private bool Update(ctl_fly ctlFly)
 {
     if (ctlFly == null || ctlFly.id != 1)
     {
         throw new Exception("couldnot be null and id must be 1");
     }
     try
     {
         CtlFlyDal dal = new CtlFlyDal();
         if (dal.GetCount() > 0)
         {
             return(dal.Update(ctlFly) > 0);
         }
         else
         {
             return(dal.Insert(ctlFly) > 0);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }