public static void Main(string[] args) { PLCModel model = new PLCModel(); GLApplication<PLCController> app = new GLApplication<PLCController>("PLC GL"); app.Run(model); }
protected override void UnpackMessageDetail(string messageDetail) { string[] splitInformation; if (Regex.IsMatch(messageDetail, OldVersionRegex)) { splitInformation = Regex.Split(messageDetail, OldVersionRegex); } else if (Regex.IsMatch(messageDetail, NewVersionRegex)) { splitInformation = Regex.Split(messageDetail, NewVersionRegex); } else if (Regex.IsMatch(messageDetail, ShortVersionRegex)) { splitInformation = Regex.Split(messageDetail, ShortVersionRegex); } else { throw new PComAException("The Get Identification Response Message Format was Invalid"); } if (int.TryParse(splitInformation[3], out int majorVersion) == false || int.TryParse(splitInformation[4], out int minorVersion) == false || int.TryParse(splitInformation[5], out int buildVersion) == false) { throw new PComAException("The Get Identification Response Message Version was Invalid"); } _version = new Version(majorVersion, minorVersion, buildVersion); _model = extractPLCModel(splitInformation[1]); }
public int AddPLC(PLCModel model) { using (REMSDBEntities context = new REMSDBEntities()) { try { Mapper.CreateMap <PLCModel, PLC>(); var mdl = Mapper.Map <PLCModel, PLC>(model); context.PLCs.Add(mdl); int i = context.SaveChanges(); return(i); } catch (Exception ex) { Helper hp = new Helper(); hp.LogException(ex); return(0); } } }
public string GenerateTowerAddFlat(int TotalFloor, List <int> FlatNo, List <bool> PreIncrement, string[] PLCIDs, int TowerID, string FltType, string FltTSize) { int i = 0; //foreach (int flat in FlatNo) //{ List <PLCModel> pmodel = new List <PLCModel>(); PLCModel pm = new PLCModel(); foreach (string s in PLCIDs) { if (s != null && s != "") { pmodel.Add(new PLCModel { PLCID = Convert.ToInt32(s), PLCName = s }); } } int ss = fservice.AddFlats(TotalFloor, 0, FlatNo, PreIncrement, pmodel, User.Identity.Name, TowerID, FltType, FltTSize); i++; // } return("1"); }
public string EditPLC(PLCModel plc) { int i = pservice.EditPLC(plc); return(Newtonsoft.Json.JsonConvert.SerializeObject(i)); }
public ConnectionManager(PLCModel PLCModel) { this.PLCModel = PLCModel; ConnectToPLC(); }