Beispiel #1
0
        private ActionResult getBasciInfoResult()
        {
            ActionResult result = new ActionResult();
            MTUBasicInfo basic  = comm.GetBasicInfo();

            result.AddParameter(new Parameter("Date", "Date/Time", GetProperty("Date")));
            result.AddParameter(new Parameter("User", "User", GetProperty("User")));
            result.AddParameter(new Parameter("MtuId", "MTU ID", basic.Id));

            return(result);
        }
Beispiel #2
0
        public AddMtuLog(Logger logger, dynamic form, string user, bool isFromScripting)
        {
            this.logger       = logger;
            this.form         = form;
            this.user         = user;
            this.mtuBasicInfo = MtuForm.mtuBasicInfo;
            this.logUri       = this.logger.CreateFileIfNotExist(!isFromScripting);

            this.addMtuAction  = new XElement("Action");
            this.turnOffAction = new XElement("Action");
            this.turnOnAction  = new XElement("Action");
            this.readMtuAction = new XElement("Action");
        }
Beispiel #3
0
        public AddMtuLog(Logger logger, dynamic form, string user)
        {
            this.logger       = logger;
            this.form         = form;
            this.user         = user;
            this.mtuBasicInfo = MtuForm.mtuBasicInfo;
            this.logUri       = this.logger.CreateFileIfNotExist();

            this.config = Singleton.Get.Configuration;
            this.action = Singleton.Get.Action;

            this.addMtuAction  = new XElement("Action");
            this.turnOffAction = new XElement("Action");
            this.turnOnAction  = new XElement("Action");
            this.readMtuAction = new XElement("Action");
        }
Beispiel #4
0
        private ActionResult getBasciInfoResult()
        {
            ActionResult result = new ActionResult();
            MTUBasicInfo basic  = comm.GetBasicInfo();

            result.AddParameter(new Parameter("Date", "Date/Time", GetProperty("Date")));
            result.AddParameter(new Parameter("User", "User", GetProperty("User")));
            result.AddParameter(new Parameter("MtuType", "MTU Type", basic.Type));
            result.AddParameter(new Parameter("MtuId", "MTU ID", basic.Id));

            foreach (Parameter param in this.AdditionalParameters)
            {
                result.AddParameter(param);
            }

            return(result);
        }
Beispiel #5
0
        private ActionResult ReadMTUData(DateTime start, DateTime end, List <LogDataEntry> Entries, MTUBasicInfo mtuInfo, Mtu mtu)
        {
            ActionResult result = new ActionResult();

            string log_path = logger.logReadDataResultEntries(mtuInfo.Id.ToString("d15"), start, end, Entries);

            InterfaceParameters[] parameters = configuration.getAllInterfaceFields(mtu.Id, "DataRead");
            foreach (InterfaceParameters parameter in parameters)
            {
                if (parameter.Name.Equals("Port"))
                {
                    for (int i = 0; i < mtu.Ports.Count; i++)
                    {
                        foreach (InterfaceParameters port_parameter in parameter.Parameters)
                        {
                            if (port_parameter.Source != null && port_parameter.Source.StartsWith("ActionParams"))
                            {
                                Parameter sel_parameter = GetParameterByTag(port_parameter.Name, i + 1);
                                if (sel_parameter != null)
                                {
                                    result.AddParameter(new Parameter(port_parameter.Name, port_parameter.Display, sel_parameter.Value));
                                }
                            }
                        }
                    }
                }
                else
                {
                    try
                    {
                        if (parameter.Source != null && parameter.Source.StartsWith("ActionParams"))
                        {
                            Parameter sel_parameter = GetParameterByTag(parameter.Name);
                            if (sel_parameter != null)
                            {
                                result.AddParameter(new Parameter(parameter.Name, parameter.Display, sel_parameter.Value));
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message + "\r\n" + e.StackTrace);
                    }
                }
            }

            result.AddParameter(new Parameter("ReadRequest", "Number Read Request Days", ""));
            result.AddParameter(new Parameter("ReadResult", "Read Result", "Number of Reads " + Entries.Count.ToString() + " for Selected Period From " + start.ToString("dd/MM/yyyy") + " 0:00:00 Till " + end.ToString("dd/MM/yyyy") + " 23:59:59"));
            result.AddParameter(new Parameter("ReadResultFile", "Read Result File", log_path));

            return(result);
        }
Beispiel #6
0
        private ActionResult ReadMTUData(DateTime start, DateTime end, EventLogList eventLogList, MTUBasicInfo mtuInfo, Mtu mtu)
        {
            /*
             * ActionResult result = new ActionResult();
             *
             * string log_path = logger.ReadDataEntries(mtuInfo.Id.ToString("d15"), start, end, Entries);
             *
             * InterfaceParameters[] parameters = configuration.getAllInterfaceFields(mtu, ActionType.ReadData );
             * foreach (InterfaceParameters parameter in parameters)
             * {
             *  if (parameter.Name.Equals("Port"))
             *  {
             *      for (int i = 0; i < mtu.Ports.Count; i++)
             *      {
             *          foreach (InterfaceParameters port_parameter in parameter.Parameters)
             *          {
             *              if (port_parameter.Source != null && port_parameter.Source.StartsWith("ActionParams"))
             *              {
             *                  Parameter sel_parameter = GetParameterByTag(port_parameter.Name, i + 1);
             *                  if (sel_parameter != null)
             *                  {
             *                      result.AddParameter(new Parameter(port_parameter.Name, port_parameter.Display, sel_parameter.Value));
             *                  }
             *              }
             *
             *          }
             *
             *
             *      }
             *  }
             *  else
             *  {
             *      try
             *      {
             *
             *          if (parameter.Source != null && parameter.Source.StartsWith("ActionParams"))
             *          {
             *              Parameter sel_parameter = GetParameterByTag(parameter.Name);
             *              if (sel_parameter != null)
             *              {
             *                  result.AddParameter(new Parameter(parameter.Name, parameter.Display, sel_parameter.Value));
             *              }
             *          }
             *      }
             *      catch (Exception e)
             *      {
             *          Utils.Print(e.Message + "\r\n" + e.StackTrace);
             *      }
             *  }
             *
             * }
             *
             * result.AddParameter(new Parameter("ReadRequest", "Number Read Request Days", ""));
             * result.AddParameter(new Parameter("ReadResult", "Read Result", "Number of Reads " + Entries.Count.ToString() + " for Selected Period From " + start.ToString("dd/MM/yyyy") + " 0:00:00 Till " + end.ToString("dd/MM/yyyy") + " 23:59:59"));
             * result.AddParameter(new Parameter("ReadResultFile", "Read Result File", log_path));
             *
             * return result;
             */

            return(null);
        }
Beispiel #7
0
 public void SetCurrentMtu(
     MTUBasicInfo mtuBasic)
 {
     CurrentMtu = this.config.GetMtuTypeById(( int )mtuBasic.Type);
 }