public static BaySettings CreateNewBaySettings(bool enabled, string creationService, int phasePickUp, double phaseTAP, int phaseCurveId, double phaseDial, double phaseMRT, double phaseTimeAdd, int neutralPickUp, double neutralTAP, int neutralCurveId, double neutralDial, double neutralMRT, double neutralTimeAdd, int numpOp, int opt1, int opt2, int opt3, int rearm, int instantPhasePickUp, int instantNeutralPickUp, double instantPhaseTAP, double instantNeutralTAP) { int id = 0; using (IQueryAdapter dbClient = Core.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO ajustes_bay (creation_service, ftemp_pickup, ftemp_tap, ftemp_curve, ftemp_dial, ftemp_mrt, ftemp_timeadd, finst_pickup," + "finst_tap,ntemp_pickup,ntemp_tap, ntemp_curve, ntemp_dial, ntemp_mrt,ntemp_timeadd, ninst_pickup, ninst_tap, num_op, temp_op_1, temp_op_2, temp_op_3, temp_rearm) VALUES " + "(@scres,@ftp,@ftt,@ftc,@ftd,@ftm,@fta,@fip,@fit,@ntp,@ntt,@ntc,@ntd,@ntm,@nta,@nip,@nit,@snum,@top1,@top2,@top3,@tr);"); dbClient.AddParameter("scres", creationService); dbClient.AddParameter("ftp", phasePickUp); dbClient.AddParameter("ftt", phaseTAP); dbClient.AddParameter("ftc", phaseCurveId); dbClient.AddParameter("ftd", phaseDial); dbClient.AddParameter("ftm", phaseMRT); dbClient.AddParameter("fta", phaseTimeAdd); dbClient.AddParameter("fip", instantPhasePickUp); dbClient.AddParameter("fit", instantPhaseTAP); dbClient.AddParameter("ntp", neutralPickUp); dbClient.AddParameter("ntt", neutralTAP); dbClient.AddParameter("ntc", neutralCurveId); dbClient.AddParameter("ntd", neutralDial); dbClient.AddParameter("ntm", neutralMRT); dbClient.AddParameter("nta", neutralTimeAdd); dbClient.AddParameter("nip", instantNeutralPickUp); dbClient.AddParameter("nit", instantNeutralTAP); dbClient.AddParameter("snum", numpOp); dbClient.AddParameter("top1", opt1); dbClient.AddParameter("top2", opt2); dbClient.AddParameter("top3", opt3); dbClient.AddParameter("tr", rearm); id = Convert.ToInt32(dbClient.InsertQuery()); } if (id == 0) { SystemLogging.SendFatalErrorLog("Falha ao criar ajuste de Bay"); return(null); } else { SystemLogging.SendProcessLog("Ajuste criado de Bay: " + id + " " + creationService); BaySettings myNewSettings = new BaySettings(id, enabled, creationService, phasePickUp, phaseTAP, phaseCurveId, phaseDial, phaseMRT, phaseTimeAdd, neutralPickUp, neutralTAP, neutralCurveId, neutralDial, neutralMRT, neutralTimeAdd, numpOp, opt1, opt2, opt3, rearm, instantPhasePickUp, instantNeutralPickUp, instantPhaseTAP, instantNeutralTAP); return(myNewSettings); } }
public static RecloserSettings CreateNewRecloserSettings(int status, string creationService, int phasePickUp, int phaseCurveId, double phaseDial, double phaseMRT, double phaseTimeAdd, int neutralPickUp, int neutralCurveId, double neutralDial, double neutralMRT, double neutralTimeAdd, string s_class, int numpOp, int opt1, int opt2, int opt3, int rearm, int instantaneousNeutralPickUp = 0, int instantaneousPhasePickUp = 0) { int id = 0; using (IQueryAdapter dbClient = Core.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO ajustes_linha (creation_service, ftemp_pickup, ftemp_curve, ftemp_dial, ftemp_mrt, finst_pickup," + "ntemp_pickup, ntemp_curve, ntemp_dial, ntemp_mrt, ninst_pickup, class, num_op, temp_op_1, temp_op_2, temp_op_3, temp_rearm) VALUES " + "(@scres,@ftp,@ftc,@ftd,@ftm,@ftip,@ntp,@ntc,@ntd,@ntm,@ntip,@sclass,@snum,@top1,@top2,@top3,@tr);"); dbClient.AddParameter("scres", creationService); dbClient.AddParameter("ftp", phasePickUp); dbClient.AddParameter("ftc", phaseCurveId); dbClient.AddParameter("ftd", phaseDial); dbClient.AddParameter("ftm", phaseMRT); dbClient.AddParameter("ftip", instantaneousPhasePickUp); dbClient.AddParameter("ntp", neutralPickUp); dbClient.AddParameter("ntc", neutralCurveId); dbClient.AddParameter("ntd", neutralDial); dbClient.AddParameter("ntm", neutralMRT); dbClient.AddParameter("ntip", instantaneousNeutralPickUp); dbClient.AddParameter("sclass", s_class); dbClient.AddParameter("snum", numpOp); dbClient.AddParameter("top1", opt1); dbClient.AddParameter("top2", opt2); dbClient.AddParameter("top3", opt3); dbClient.AddParameter("tr", rearm); id = Convert.ToInt32(dbClient.InsertQuery()); } if (id == 0) { SystemLogging.SendFatalErrorLog("Falha ao criar ajuste"); return(null); } else { SystemLogging.SendProcessLog("Ajuste criado: " + id + " " + creationService); return(new RecloserSettings(id, status, creationService, phasePickUp, phaseCurveId, phaseDial, phaseMRT, phaseTimeAdd, neutralPickUp, neutralCurveId, neutralDial, neutralMRT, neutralTimeAdd, s_class, numpOp, opt1, opt2, opt3, rearm, DateTime.Now)); } }