static void Main(string[] args) { int temp; string tempstr; ClassCtrl classCtrl = new ClassCtrl(); DBCtrl dbCtrl = new DBCtrl(); DBCon dbCon = new DBCon(); int id = 1; SqlDataReader rs = dbCon.ExecuteStringGet("SELECT * FROM Class where id=(SELECT classId FROM Student where id=" + id + ");"); bool tempb = rs.(); Console.WriteLine(tempb); Console.WriteLine(rs.GetInt32(0)); //for (int i = 0; i<10; i++) // { // temp = dbCtrl.GetClassFromStudentId(i).Id; // Console.WriteLine(temp); // } // for (int i = 0; i<10; i++) // { // temp = classCtrl.GetClassByStudentId(i).Id; // } }
public Graph GetWCData(string id) { DBCtrl dbCtrl = new DBCtrl(); string sql = string.Format("EXEC pGetWCData '{0}'", id); var query = dbCtrl.getList(sql); dbCtrl.Close(); return query.ToGoogleChart(); }
//True data for algoritm //Generating desired classrooms public List <ClassRoom> FetchClassRooms() { List <ClassRoom> cr = new List <ClassRoom>(); DBCtrl dbC = new DBCtrl(); cr = dbC.GetClassRoomByAttributes(false, false, false); return(cr); }
public Graph ErrRateByWeight() { DBCtrl db = new DBCtrl(); string sql = "EXEC pErrRateByWeight null,null"; DataTable dt = db.getList(sql); db.Close(); return dt.ToGoogleChart(); }
public Graph ErrorByBatch(string id) { DBCtrl db = new DBCtrl(); string sql = "EXEC pErrByBatch null,null,'" + id + "',null,null"; DataTable dt = db.getList(sql); db.Close(); return dt.ToGoogleChart(); }
public Graph Compare(int year, int month, int day, string line) { DateTime date = new DateTime(year, month, day); DBCtrl db = new DBCtrl(); string sql = "EXEC pErrCompare '" + date.ToString("yyyy/MM/dd") + "'," + line; DataTable dt = db.getList(sql); db.Close(); return dt.ToGoogleChart(); }
public Graph Daily(string id) { DBCtrl dbCtrl = new DBCtrl(); string sql = string.Format("EXEC pGetDailyWCData '{0}'", id); var query = dbCtrl.getList(sql); dbCtrl.Close(); var g = query.ToGoogleChart(); g.cols[1].p = new Dictionary<string, string>(); g.cols[1].p.Add("role", "tooltip"); g.cols[1].p.Add("html", "true"); return g; }
public Graph ErrorByBatch(int year, int month, int day, string line, string shift) { int range = int.Parse(line); DateTime date = new DateTime(year, month, day); DateTime startDate = date.AddDays(-range); DBCtrl db = new DBCtrl(); string sql = "EXEC pErrByBatch null,null,'{0}','{1}','{2}'"; sql = string.Format(sql, shift, startDate.ToString("yyyy-MM-dd"), date.ToString("yyyy-MM-dd")); DataTable dt = db.getList(sql); db.Close(); return dt.ToGoogleChart(); }
static void Main(string[] args) { DBCtrl db = new DBCtrl(); #region Insert Console.WriteLine("Key Enter to start INSERT demostration"); Console.ReadLine(); db.commit(new List <SqlScript>() { new SqlScript("DELETE FROM FEEDER") }); List <SqlScript> sqls = new List <SqlScript>(); #region Entity Framework FEEDER feeder = new FEEDER() { GRIPPERNO = 1, SCARATRAYNO = 2, FEEDERNO = 3 }; sqls.AddRange(db.Create <FEEDER>(eInsertUpdateType.Normal, feeder)); #endregion #region SQL Script sqls.Add(new SqlScript("INSERT INTO FEEDER(GRIPPERNO,SCARATRAYNO,FEEDERNO) VALUES(4,5,6)")); #endregion db.commit(sqls); Console.WriteLine("Insert two rows to FEEDER table by EF & SQL successfully"); #endregion #region Update Console.WriteLine("Key Enter to start UPDATE demostration"); Console.ReadLine(); sqls = new List <SqlScript>(); #region Entity Framework feeder.SCARATRAYNO = 100; sqls.AddRange(db.Update <FEEDER>(feeder)); #endregion db.commit(sqls); Console.WriteLine("Update FEEDER by EF successfully and key Enter to stop"); Console.ReadLine(); #endregion }
public Graph ErrorMatrix() { //var query = from mx in db.vErrorMatrix.AsEnumerable() // orderby mx.Weight // let result = new // { // Weight = mx.Weight, // Line = mx.CodeWorkCenter, // TotalBags = mx.QuantityBagsProduced, // FontErr = mx.Error4, // TotalErr = mx.ErrorTotal, // FontErrRate = mx.Error4Rate, // TotalErrRate = mx.ErrorTotalRate // } // select result; DBCtrl dbCtrl = new DBCtrl(); string sql = "exec pBatchError null,3000,null,null,null"; var dt = dbCtrl.getList(sql); //return query.ToList().ToGoogleChart(); return dt.ToGoogleChart(); }