public async Task <IActionResult> PutBu([FromRoute] string id, [FromBody] BU bu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bu.BuId) { return(BadRequest()); } _context.Entry(bu).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuExist(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public List <BU> GetBUList() { List <BU> accountList = new List <BU>(); BU account; try { using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(BaseDbContext.databasestring)) { using (System.Data.SQLite.SQLiteCommand com = new System.Data.SQLite.SQLiteCommand(con)) { con.Open(); // Open the connection to the database com.CommandText = "Select BUID,BUName,BUDescription FROM BU"; // Select all rows from our database table using (System.Data.SQLite.SQLiteDataReader reader = com.ExecuteReader()) { while (reader.Read()) { account = new BU(); account.BUID = Convert.ToInt32(reader["BUID"]); account.BUName = Convert.ToString(reader["BUName"]); account.BUDescription = Convert.ToString(reader["BUDescription"]); accountList.Add(account); } } con.Close(); // Close the connection to the database } } return(accountList); } catch (Exception ex) { return(null); } }
public ActionResult DeleteConfirmed(int id) { BU bU = db.BUs.Find(id); db.BUs.Remove(bU); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,FsuID,Code,Name,Lead,Note")] BU bU) { if (ModelState.IsValid) { db.Entry(bU).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FsuID = new SelectList(db.FSUs, "Id", "Code", bU.FsuID); return(View(bU)); }
public ActionResult Create([Bind(Include = "Id,FsuID,Code,Name,Lead,Note")] BU bU) { if (ModelState.IsValid) { db.BUs.Add(bU); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FsuID = new SelectList(db.FSUs, "Id", "Code", bU.FsuID); return(View(bU)); }
public async Task <IActionResult> PostBu([FromBody] BU bu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.bu.Add(bu); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBu", new { id = bu.BuId }, bu)); }
// GET: BUs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BU bU = db.BUs.Find(id); if (bU == null) { return(HttpNotFound()); } return(View(bU)); }
// GET: BUs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BU bU = db.BUs.Find(id); if (bU == null) { return(HttpNotFound()); } ViewBag.FsuID = new SelectList(db.FSUs, "Id", "Code", bU.FsuID); return(View(bU)); }
public static string GetConnectionString(ENV env, BU bu, PERIOD period, bool useLocalIS = true) { string BUPart = bu == (int)BU.ILVB ? "ILH" : "ILSB"; string periodPart = period == (int)PERIOD.DAG ? "DAG" : "MAAND"; string databasePart = "; Database=" + BUPart + "_LOGGING_" + periodPart; string cs = ""; switch ((int)env) { case (int)ENV.LOCAL: if (useLocalIS == false) { cs = NNConnectionStrings.SQL_LOCALHOST.Replace("<LocalAdminPassword>", Utility.DecryptString(Properties.Settings.Default.LocalAdminPassword)) + databasePart; } else { cs = NNConnectionStrings.SQL_LOCALHOST_IS + databasePart; } //cs = NNConnectionStrings.SQL_LOCALHOST.Replace("<LocalAdminPassword>", "MacyMarle2") + databasePart; break; case (int)ENV.DEV: cs = (BUPart == "ILH" ? NNConnectionStrings.SQL_ILH_DEV_IS : NNConnectionStrings.SQL_ILSB_DEV_IS) + databasePart; break; case (int)ENV.TEST: cs = (BUPart == "ILH" ? NNConnectionStrings.SQL_ILH_TEST_IS : NNConnectionStrings.SQL_ILSB_TEST_IS) + databasePart; break; case (int)ENV.ACC: cs = (BUPart == "ILH" ? NNConnectionStrings.SQL_ILH_ACC_IS : NNConnectionStrings.SQL_ILSB_ACC_IS) + databasePart; break; case (int)ENV.PROD: cs = (BUPart == "ILH" ? NNConnectionStrings.SQL_ILH_PROD_IS : NNConnectionStrings.SQL_ILSB_PROD_IS) + databasePart; break; default: cs = ""; break; } return(cs); }
public async Task <BsonDocument> GetNewVersion(string symbol, BsonDocument version = null) { version = version ?? new BsonDocument(); var version_num = await _version_numbers.FindOneAndUpdateAsync( BF.Eq("symbol", symbol), BU.Inc("version", 1), new FindOneAndUpdateOptions <BsonDocument> { IsUpsert = true, ReturnDocument = ReturnDocument.After } ); version ["version"] = version_num.Unwrap(v => v["version"], 1); if (version.GetValue("_id", null) == null) { version ["_id"] = new BsonObjectId(ObjectId.GenerateNewId()); } version ["symbol"] = symbol; return(version); }
protected void StartRun() { if (ENV == Utility.ENV.LOCAL) { try { string envMessage = BU.ToString() + " - " + ENV.ToString() + " - " + Period.ToString(); if (MessageBox.Show("Start run " + envMessage + " ?", "Start Run", MessageBoxButtons.YesNo) == DialogResult.Yes) { string cs = Utility.GetConnectionString(ENV, BU, Period); string startRunQuery = (BU == Utility.BU.ILVB ? SQLQueries.SQL_START_RUN_ILH : SQLQueries.SQL_START_RUN_ILSB); startRunQuery = startRunQuery.Replace("<PERIOD>", Period == Utility.PERIOD.MAAND ? "MAAND" : "DAG"); startRunQuery = startRunQuery.Replace("<Kalenderdatum>", FormatDate4DB(CalendarDate)); int rc = this.SqlDA.ExecuteSQLCommand(cs, startRunQuery); string message = "Run Started, " + envMessage; _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": " + message; MessageBox.Show(message); this.Close(); } } catch (Exception ex) { string message = ex.Message; if (message.Length > 100) { message = message.Substring(0, 100); } _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": " + message; MessageBox.Show(ex.Message); } } else { _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": Function only available on local machine"; } }
protected void AbortRun() { if (ENV == Utility.ENV.LOCAL) { if (SsisRunID > 0) { try { string envMessage = BU.ToString() + " - " + ENV.ToString() + " - " + Period.ToString(); if (MessageBox.Show("Abort run " + envMessage + " ?", "Abort Run", MessageBoxButtons.YesNo) == DialogResult.Yes) { string cs = Utility.GetConnectionString(ENV, BU, Period); string abortRunQuery = SQLQueries.SQL_ABORT_RUN.Replace("<RunID>", this.SsisRunID.ToString()); int rc = SqlDA.ExecuteSQLCommand(cs, abortRunQuery); string message = "Run Aborted, " + envMessage; _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": " + message; MessageBox.Show(message); this.Close(); } } catch (Exception ex) { ShowMessage(ex.Message); } } else { _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": No valid SSIS Run ID available"; } } else { _toolStripStatusLabel.Text = DateTime.Now.ToString() + ": Function only available on local machine"; } }