private void btnLogin_Click_1(object sender, EventArgs e) { String uname = txtUName.Text; String pword = txtPWord.Text; DBController dbc = new DBController(); //Create method to check if user exists in DB or not if (dbc.logInUser(uname, pword) == "incorrect") { lblError.Text = "Please input the correct credentials"; uname = ""; pword = ""; txtUName.Text = ""; txtPWord.Text = ""; } else if (dbc.logInUser(uname, pword) == "success") { Manager man = new Manager(uname); man.Show(); } else lblError.Text = "Log in not sucessfull"; }
private void txtRegister_Click(object sender, EventArgs e) { //Check to see if credentials are inputted correctly String uname = txtUName.Text; String pword = txtPWord.Text; DBController dbc = new DBController(); if (dbc.createUser(uname, pword) == "incorrect") { lblError.Text = "Please input the correct credentials"; uname = ""; pword = ""; txtUName.Text = ""; txtPWord.Text = ""; } else { Manager man = new Manager(uname); txtUName.Text = ""; txtPWord.Text = ""; man.ShowDialog(); } }
public ControllerCatalog() { dbc = new DBController(); ec = new EmployeeCatalog(); tc = new TaskCatalog(); oc = new OrderCatalog(); cc = new CustomerCatalog(); ofc = new OfferCatalog(); ic = new ItemCatalog(); xml = new XML(); }
private void buttonAccept_Click(object sender, EventArgs e) { if (testForInvalidValues()) { Customer c = new Customer(); c.Name = txtName.TextWithoutWatermark; c.LastName = txtLastName.TextWithoutWatermark; c.EmailAddress = txtEmail.TextWithoutWatermark; c.PhoneNumber = txtPhoneNumber.TextWithoutWatermark; c.PasswordHash = customerOld.PasswordHash; c.Birthday = DateTime.Parse(txtBirthDate.TextWithoutWatermark); c.Street = txtStreet.TextWithoutWatermark; c.HouseNumber = txtHouseNumber.TextWithoutWatermark; c.PLZ = txtPlz.TextWithoutWatermark; c.City = txtCity.TextWithoutWatermark; c.Country = txtCountry.TextWithoutWatermark; c.IsAdmin = checkAdmin.Checked; if (DBController.TryUpdateCustomer(c, customerOld.EmailAddress) == 0) { FormController.MainView.UpdateCustomersList(); Feedback.SuccessCustomersEdit(); if (FormController.CurrentCustomer.EmailAddress == customerOld.EmailAddress) { FormController.CurrentCustomer = c; } } else { Feedback.ErrorDatabaseCustomersEdit(); } ParentForm.Close(); } }
/// <summary> /// Private method to select based on status /// </summary> /// <param name="status"></param> /// <param name="flag"></param> /// <param name="ShowAll"></param> /// <returns></returns> public List <EventManager> Select(string EventID) { List <EventManager> _result = null; Config ObjConfig = (Config)HttpContext.Current.Session["__Config__"]; string Query = "SP_EventManager"; switch (ObjConfig.DBType) { // MS-SQL case "0": { DBController ObjDB = new DBController(DBController.DBTypes.MSSQL); List <SqlParameter> parms = new List <SqlParameter>(); parms.Add(new SqlParameter("EventID", EventID)); parms.Add(new SqlParameter("Flag", 9)); DataTable _data = ObjDB.ExecuteDataTable(Query, parms.ToArray()); _result = Helper.DataTableToList <EventManager>(_data); break; } } return(_result); }
public ActionResult Login(string Email, string Password) { DBController db = new DBController(); int id = db.Select_User_ID(Email, Password); if (id == 0) // not found { //TODO uncorrect email or Password return(View()); } else { //view of user (home page) DataRow dr = db.SelectUserNameByID(id).Rows[0]; string UserName = Convert.ToString(dr["Fname"]) + " " + Convert.ToString(dr["Lname"]); Session["ID"] = id; Session["UserName"] = UserName; return(RedirectToAction("Index", "Home")); } }
public ActionResult ViewAllBlogs() { DBController dbController = new DBController(); DataTable dt = dbController.SelectBlogs(); if (dt == null) { return(RedirectToAction("EmptyBlogs")); } List <BlogModel> Blogs = new List <BlogModel>(); for (int i = 0; i < dt.Rows.Count; ++i) { Models.BlogModel Blog = new BlogModel(); Blog.BlogTitle = Convert.ToString(dt.Rows[i]["BlogTitle"]); Blog.BlogContent = Convert.ToString(dt.Rows[i]["BlogContent"]); Blog.BlogID = Convert.ToInt32(dt.Rows[i]["BlogID"]); Blog.BlogWriter = Convert.ToInt32(dt.Rows[i]["BlogWriter"]); if (Convert.ToString(dt.Rows[i]["GroupID"]) != "") { Blog.GroupID = Convert.ToInt32(dt.Rows[i]["GroupID"]); } else { Blog.GroupID = 0; } DataTable tmp_dt = dbController.SelectUserNameByID(Blog.BlogWriter); Blog.BlogWriterName = Convert.ToString(tmp_dt.Rows[0]["Fname"]) + Convert.ToString(tmp_dt.Rows[0]["Lname"]); Blogs.Add(Blog); } return(View(Blogs)); }
/// <summary> /// Update a Role in db (Master) /// </summary> /// <returns></returns> public int Update() { int _result = 0; Role objRole = this; Config ObjConfig = (Config)HttpContext.Current.Session["__Config__"]; string Query = "SP_Roles"; switch (ObjConfig.DBType) { // MS-SQL case "0": { DBController ObjDB = new DBController(DBController.DBTypes.MSSQL); List <SqlParameter> parms = new List <SqlParameter>(); parms.Add(new SqlParameter("RoleID", objRole.RoleID)); parms.Add(new SqlParameter("RoleName", objRole.RoleName)); parms.Add(new SqlParameter("Description", objRole.Description)); parms.Add(new SqlParameter("CompanyID", objRole.CompanyID)); parms.Add(new SqlParameter("WorkAreaID", objRole.WorkAreaID)); parms.Add(new SqlParameter("CreatedDate", objRole.CreatedDate)); parms.Add(new SqlParameter("CreatedTime", objRole.CreatedTime)); parms.Add(new SqlParameter("CreatedBy", objRole.CreatedBy)); parms.Add(new SqlParameter("ModifiedDate", objRole.ModifiedDate)); parms.Add(new SqlParameter("ModifiedTime", objRole.ModifiedTime)); parms.Add(new SqlParameter("ModifiedBy", objRole.ModifiedBy)); parms.Add(new SqlParameter("Status", ((int)objRole.Status).ToString())); parms.Add(new SqlParameter("Flag", ((int)DB_Flags.Update).ToString())); _result = ObjDB.ExecuteNonQuery(Query, parms.ToArray()); break; } } return(_result); }
public User retrieveFriendInfo(int userID) { DBController db = new DBController(); string connectionString = db.getConnectionString(); User user = new User(); string Query = "SELECT profilePicture, username FROM users WHERE userID = @userID"; MySqlConnection conn = new MySqlConnection(connectionString); MySqlCommand cmd = new MySqlCommand(Query, conn); conn.Open(); cmd.Parameters.AddWithValue("@userID", userID); MySqlDataReader dr = cmd.ExecuteReader(); try { while (dr.Read() == true) { user.userID = userID; user.profilePicture = dr["profilePicture"].ToString(); user.friendUsername = dr["username"].ToString(); } } catch (Exception) { } finally { dr.Close(); conn.Close(); } return(user); }
void Start() { _dbController = DBController.Instance; _pupilGazeTracker = FindObjectOfType <PupilGazeTracker>(); _pressStartText.enabled = false; //If data is stored from TestLoader scene, use that if (_storedTestBlock != null) { LoadTestData(_storedTestBlock); } else { //If you need to run this scene repeatedly to test, create TestBlockData and load with LoadTestData(TestBlockData) and play project from MainScene LoadTestData(new TestBlock(TestBlock.VRHMD.NoHMD, "TestBlockData", "TestParticipant", "TestCondition", 11, new List <int>() { 80 }, new List <float>() { 50, 50 }, 100, 2, TestBlock.ControlMethod.Mouse, TestBlock.ConfirmationMethod.Click, 200, 80000, 5, 12, false, true, true, true, true, false, new Color32(67, 67, 67, 255), Color.yellow, Color.black, new Color32(200, 200, 200, 255), new Color32(128, 128, 128, 255), Color.red)); } }
//[TestMethod] public void Test_Workflow_Steps_Run_Ok() { DBController db = DBController.Create(connectionString); Workflow wf = db.WorkflowMetadataGet("Test100"); WorkflowGraph wfg = WorkflowGraph.Create(wf, db); Task[] tasks = new Task[wfg.Count]; WfResult wf_status = wfg.Start(); WorkflowStep step = null; int i = 0; while (wfg.TryTake(out step, TimeSpan.FromMinutes(5))) { wfg.SetNodeExecutionResult(step.Key, WfResult.Started); tasks[i++] = Task.Factory.StartNew((object obj) => { WorkflowStep s = obj as WorkflowStep; Console.WriteLine(String.Format("Processing step {0}", s.Key)); Thread.Sleep(1000); wfg.SetNodeExecutionResult(s.Key, WfResult.Succeeded); //wfg.SetNodeExecutionResult(Key, WfResult.Failed); }, step); } Task.WaitAll(tasks); WfResult wr = wfg.WorkflowRunStatus; WfResult wc = wfg.WorkflowCompleteStatus; Console.WriteLine(String.Format("Run status {0}", wr.StatusCode.ToString())); Console.WriteLine(String.Format("Complete status {0}", wc.StatusCode.ToString())); Assert.IsTrue(wr.StatusCode == WfStatus.Succeeded); }
public JsonResult YSY_Data_ShuiChangByPage(Guid waterJZID, int pageIndex, int PageSize, DateTime?StartTime, DateTime?EndTime) { StringBuilder str = new StringBuilder(); string msg = ""; string success = ""; List <FY_Data_ShuiChang> FY_Data_ShuiChang = new List <FY_Data_ShuiChang>(); int total = 0; try { using (var DB = new DBController()) { string userType = GetUserType(); var query = DB.FY_Data_ShuiChang.Where(x => x.BaseID == waterJZID && x.TempTime <= EndTime.Value && x.TempTime >= StartTime.Value).ToList(); FY_Data_ShuiChang = query.OrderByDescending(x => x.TempTime).Skip((pageIndex - 1) * PageSize).Take(PageSize).ToList(); total = query.Count(); switch (userType) { case "1": msg = "无权限"; success = "false"; break; case "2": msg = "无权限"; success = "false"; break; case "3": msg = "查询成功"; success = "true"; break; case "4": msg = "无权限"; success = "false"; break; } } return(Json(new { success = success, msg = msg, FY_Data_ShuiChang = FY_Data_ShuiChang, total = total }, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(new { success = "false", msg = "查询失败" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult ViewAllTeams() { DBController dbController = new DBController(); DataTable dt = dbController.SelectTeams(); if (dt == null) { return(RedirectToAction("EmptyTeams")); } List <TeamModel> Teams = new List <TeamModel>(); for (int i = 0; i < dt.Rows.Count; ++i) { TeamModel Team = new TeamModel(); Team.TeamName = Convert.ToString(dt.Rows[i]["TeamName"]); Team.TeamID = int.Parse(Convert.ToString(dt.Rows[i]["TeamID"])); Team.LeaderID = Convert.ToInt32(dt.Rows[i]["LeaderID"]); Teams.Add(Team); } return(View(Teams)); }
public static void Update(Hashtable has, string UpdSql, string keyName) { string set = ""; string where = ""; foreach (DictionaryEntry de in has) { if (!(',' + keyName + ',').Contains(',' + de.Key.ToString() + ',')) { set += " " + de.Key + " = @" + de.Key + ","; } else { where += " " + de.Key + " = @" + de.Key + " and "; } } string sql = string.Format(UpdSql, set.Substring(0, set.Length - 1), where); sql = sql.Substring(0, sql.Length - 4); using (var DB = new DBController()) { DB.Execute(sql, has); } }
public ActionResult AddFriend(int UserID = 0, string UserName = "", string Email = "") { DBController db = new DBController(); int FriendID = db.Select_UserID_By_Email(Email); if (UserID == FriendID) { return(RedirectToAction("CanNot", new { id = UserID, UserName = UserName })); } ViewBag.ID = UserID; ViewBag.UserName = UserName; if (FriendID == 0) // not found { //TODO uncorrect email or Password return(View()); } else { db.InsertFriend(UserID, FriendID); return(RedirectToAction("ViewUser", "User", new { ID = FriendID, IV = UserID, UserName = UserName })); } }
private void Button7_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox2.Text) || String.IsNullOrWhiteSpace(textBox2.Text)) { return; } DBController dBController = new DBController(); string startdate = Convert.ToString(dateTimePicker1.Value.Date.ToString("yyyy/MM/dd")); string slutdate = Convert.ToString(dateTimePicker2.Value.Date.ToString("yyyy/MM/dd")); string search = textBox2.Text; dBController.FindFrietilbehoerMaerkelNavn(startdate, slutdate, search); foreach (var item in dBController.tilbehoer) { ListViewItem itm = new ListViewItem(Convert.ToString(item.tnr), 0); itm.SubItems.Add(item.navn); itm.SubItems.Add(item.maerke); itm.SubItems.Add(Convert.ToString(item.anr)); itm.SubItems.Add(Convert.ToString(item.pris)); itm.SubItems.Add(Convert.ToString(item.aargang)); // til føj til ressourcerlisten listView2.Items.Add(itm); } }
public IEnumerable <Клиент_Поля> Select() { using (DBController db = new DBController()) { System.Data.SqlClient.SqlDataReader reader = db.ExecuteReader($"SELECT * FROM Клиент"); List <Клиент_Поля> list = new List <Клиент_Поля>(); if (reader.HasRows) { while (reader.Read()) { list.Add(new Клиент_Поля() { ID_Клиента = reader.GetInt32(0), Фамилия = reader.GetString(1), Имя = reader.GetString(2), Отчество = reader.GetString(3), Номер_паспорта = reader.GetString(4), }); } } return(list); } }
public List <MasterMenu> getMenuItems(string UserID) { List <MasterMenu> _result = null; Config ObjConfig = (Config)HttpContext.Current.Session["__Config__"]; string Query = "SP_Roles"; switch (ObjConfig.DBType) { // MS-SQL case "0": { DBController ObjDB = new DBController(DBController.DBTypes.MSSQL); List <SqlParameter> parms = new List <SqlParameter>(); parms.Add(new SqlParameter("UserId", UserID)); parms.Add(new SqlParameter("Flag", 11)); DataTable _data = ObjDB.ExecuteDataTable(Query, parms.ToArray()); _result = Helper.DataTableToList <MasterMenu>(_data); break; } } return(_result); }
public void SetMirroring(string key, string MirrorPath, bool UseAlram) { //미러링 id 초기화 필요하면 초기화 한다 if (MirrorIDStorage[key] == 0) { MirrorIDStorage[key] = 1; } StringBuilder sbShadow = new StringBuilder(); sbShadow.Append("Create Shadow "); sbShadow.Append(MirrorIDStorage[key]); sbShadow.Append(" "); if (UseAlram) { sbShadow.Append("AUTO "); } else { sbShadow.Append("MANUAL "); } sbShadow.AppendFormat("'{0}' ", MirrorPath); StringCollection sc = new StringCollection(); sc.Add(sbShadow.ToString()); try { DBController.getInstance().SetData(key, sc); MirrorIDStorage[key]++; } catch (Exception) { throw new Exception("미러링(쉐도잉) 을 세팅하지 못했습니다");; } }
public int Execute(int jobId) { DataTable dt = DBController.GetBySql("Select * from Hospital_Service where Status = 1 order by ID desc"); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DataTable dtUser = DBController.Hospital_User_GetUser_SendAlertMT(ConvertUtility.ToInt32(row["ID"])); if (dtUser != null && dtUser.Rows.Count > 0) { foreach (DataRow item in dtUser.Rows) { //đẩy vào Mt queue string mt = row["WaitingMT"].ToString(); string User_ID = item["User_ID"].ToString(); string Command_Code = item["Command_Code"].ToString(); DBController.Send(User_ID, mt, "8779", Command_Code, ((int)Constant.MessageType.NoCharge).ToString(), DateTime.Now.Ticks.ToString(), "1", "1", "0", ((int)Constant.ContentType.Text).ToString()); } } } } return(1); }
static public bool UpdateUser(DBController gs, string Login, string Senha) { STRUCT_ACCOUNTFILE target = new STRUCT_ACCOUNTFILE(); if (!gs.ReadAccount(Login, out target)) { W2Log.Write(String.Format("fail to read account file {0}", Login), ELogType.GAME_EVENT); return(false); } if (0 != String.Compare(target.Info.AccountName, Login)) { W2Log.Write(String.Format("fail to read account file {0}/{1}", Login, target.Info.AccountName), ELogType.GAME_EVENT); return(false); } // W2Log.Write(String.Format("pass teste file {0}/{1}", target.Info.AccountPass, Senha), ELogType.GAME_EVENT); target.Info.AccountPass = Senha; try { string CorrectPatch = Functions.getCorrectPath(target.Info.AccountName); using (StreamWriter file = File.CreateText(CorrectPatch + ".json")) { string indented = JsonConvert.SerializeObject(target, Formatting.Indented); file.Write(indented); } W2Log.Write(String.Format("save account sucess: {0}", target.Info.AccountName), ELogType.GAME_EVENT); return(true); } catch (Exception e) { W2Log.Write(String.Format("save account fail: {0}/{1}", target.Info.AccountName, e.Message), ELogType.GAME_EVENT); return(false); } }
private List <KeyValuePair <string, String> > getcontent(int id) // media id to question content { DBController db = new DBController(); MCDataSet.MediaDataTable mdt = db.getQID_MID_Diff(id); System.Diagnostics.Debug.WriteLine(mdt.Rows[0]["questionID"].ToString()); // Int32 qid = (Int32) mdt.Rows[0]["questionID"]; // Int32 aid = (Int32) mdt.Rows[0]["answerID"]; // MCDataSet.MediaDataTable qlink = db.getMediaFromQID(qid); //mdt.Rows[0].Table.Columns["link"].DefaultValue.ToString(); //mdt.Rows[0].Table.Columns["rating"].DefaultValue.ToString(); List <KeyValuePair <string, String> > cont = new List <KeyValuePair <string, String> >() { new KeyValuePair <string, string>("title", "default"), new KeyValuePair <string, string>("description", "default"), new KeyValuePair <string, string>("rating", "default"), }; return(cont); }
/// <summary> /// Insert a new Department to db (Master) /// </summary> /// <returns></returns> public int Insert() { int _result = 0; Department objDepartment = this; Config ObjConfig = (Config)HttpContext.Current.Session["__Config__"]; string Query = "SP_Department"; switch (ObjConfig.DBType) { // MS-SQL case "0": { DBController ObjDB = new DBController(DBController.DBTypes.MSSQL); List <SqlParameter> parms = new List <SqlParameter>(); parms.Add(new SqlParameter("CompanyID", objDepartment.CompanyID)); parms.Add(new SqlParameter("WorkareaID", objDepartment.WorkareaID)); parms.Add(new SqlParameter("DivisionID", objDepartment.DivisionID)); parms.Add(new SqlParameter("DepartmentID", objDepartment.DepartmentID)); parms.Add(new SqlParameter("DepartmentName", objDepartment.DepartmentName)); parms.Add(new SqlParameter("CreatedDate", objDepartment.CreatedDate)); parms.Add(new SqlParameter("CreatedTime", objDepartment.CreatedTime)); parms.Add(new SqlParameter("CreatedBy", objDepartment.CreatedBy)); parms.Add(new SqlParameter("ModifiedDate", objDepartment.ModifiedDate)); parms.Add(new SqlParameter("ModifiedTime", objDepartment.ModifiedTime)); parms.Add(new SqlParameter("ModifiedBy", objDepartment.ModifiedBy)); parms.Add(new SqlParameter("Status", ((int)objDepartment.Status).ToString())); parms.Add(new SqlParameter("Flag", ((int)DB_Flags.Insert).ToString())); _result = ObjDB.ExecuteNonQuery(Query, parms.ToArray()); break; } } return(_result); }
/// <summary> /// 히트판 DB와 서버 연동 /// </summary> /// <param name="userName"></param> /// <param name="password"></param> private void ValidateWithHitpanDB(string userName, string password) { if (userName.Contains("'")) { userName = userName.Replace("'", "''"); } string query = string.Format("select * from users where userid='{0}'", userName); DataTable dt = DBController.getInstance().GetData(this.serviceURL, query); string pwd = string.Empty; try { pwd = dt.Rows[0]["userPassword"].ToString(); } catch (IndexOutOfRangeException) { throw new FaultException("해당되는 사용자가 없습니다");; } if (pwd != password) { throw new FaultException("사용자 암호가 틀립니다"); } }
/// <summary> /// Select by Custormer ID /// </summary> /// <returns></returns> public List <Company> Select(string CustomerID) { List <Company> _result = null; Config ObjConfig = (Config)HttpContext.Current.Session["__Config__"]; string Query = "SP_Company"; switch (ObjConfig.DBType) { // MS-SQL case "0": { DBController ObjDB = new DBController(DBController.DBTypes.MSSQL); List <SqlParameter> parms = new List <SqlParameter>(); parms.Add(new SqlParameter("CustomerID", CustomerID)); parms.Add(new SqlParameter("Status", ((int)Status.Active).ToString())); parms.Add(new SqlParameter("Flag", 10)); DataTable _data = ObjDB.ExecuteDataTable(Query, parms.ToArray()); _result = Helper.DataTableToList <Company>(_data); break; } } return(_result); }
private IEnumerable <Product> GetProducts(string searchString = null) { List <Product> toReturn = new List <Product>(); try { using (var msSql = DBController.GetDBConnection()) { DynamicParameters p = new DynamicParameters(); if (!string.IsNullOrWhiteSpace(searchString)) { p.Add("SearchString", searchString); } toReturn = msSql.Query <Product>("up_FindProducts", param: p, commandType: CommandType.StoredProcedure).ToList(); } } catch (Exception ex) { logger.Error("Error retrieving DB products", ex); } return(toReturn); }
private void AddNewItemToDatabase() { //Constructing "Sharable" table item Sharable TableItem = new Sharable { Name = SharableName, Type = sharableType, Periodicity = periodicity, Price = Price }; //Check existence of a table if (DBController.TableExists(nameof(Sharable))) { //Insertion table item into the table DBController.InsertItem(TableItem); } else { //Creation of a table then insertion item into it DBController.AddTable(TableItem); DBController.InsertItem(TableItem); } }
private void popuniIspitniRokovi() { try { rezultati = DBController.PrikaziIspitniRok(); if (rezultati.Rows.Count == 1) { // txtIspitniRok.Content = rezultati.Rows[0][0].ToString(); txtPocetak.Content = rezultati.Rows[0][2].ToString(); txtKraj.Content = rezultati.Rows[0][3].ToString(); } // txtCena.Content = rezultati.Rows[0][5].ToString(); // txtMaks.Content = rezultati.Rows[0][4].ToString(); // tbIspitniRok.Text = (rezultati.Rows[0][0].ToString() + " rok pocinje " + rezultati.Rows[2][0].ToString() + " i zavrsava " + rezultati.Rows[3][0].ToString()); /* lblIspitniRok.Content = rezultati.Rows[0][0].ToString() + " Ispitni Rok"; * lblPocetak.Content = rezultati.Rows[0][2].ToString(); * lblKraj.Content = rezultati.Rows[0][3].ToString();*/ } catch (Exception ex) { //MessageBox.Show("Bla"); } }
/// <summary> /// Insert a new EventManager to db (Master) /// </summary> /// <returns></returns> public int Insert() { int _result = 0; EventManager objEventManager = this; Config ObjConfig = (Config)HttpContext.Current.Session["__Config__"]; string Query = "SP_EventManager"; switch (ObjConfig.DBType) { // MS-SQL case "0": { DBController ObjDB = new DBController(DBController.DBTypes.MSSQL); List <SqlParameter> parms = new List <SqlParameter>(); parms.Add(new SqlParameter("EventID", objEventManager.EventID)); parms.Add(new SqlParameter("EventName", objEventManager.EventName)); parms.Add(new SqlParameter("EventState", ((int)objEventManager.EventState).ToString())); parms.Add(new SqlParameter("FormID", objEventManager.FormID)); parms.Add(new SqlParameter("ModuleID", objEventManager.ModuleID)); parms.Add(new SqlParameter("CreatedDate", objEventManager.CreatedDate)); parms.Add(new SqlParameter("CreatedTime", objEventManager.CreatedTime)); parms.Add(new SqlParameter("CreatedBy", objEventManager.CreatedBy)); parms.Add(new SqlParameter("ModifiedDate", objEventManager.ModifiedDate)); parms.Add(new SqlParameter("ModifiedTime", objEventManager.ModifiedTime)); parms.Add(new SqlParameter("ModifiedBy", objEventManager.ModifiedBy)); parms.Add(new SqlParameter("Status", ((int)objEventManager.Status).ToString())); parms.Add(new SqlParameter("Flag", ((int)DB_Flags.Insert).ToString())); _result = ObjDB.ExecuteNonQuery(Query, parms.ToArray()); break; } } return(_result); }
public void popuniPredmete() { DataTable rezultati = DBController.StudentPredmeti(trenutniKorisnik.getUserName()); string[] predmet; int broj = rezultati.Rows.Count; predmet = new string[broj]; for (int i = 0; i < broj; i++) { predmet[i] = rezultati.Rows[i][0].ToString(); ComboPredmeti.Items.Add(predmet[i]); } string selected = ComboPredmeti.Text; string prof = DBController.getProfesora(selected); if (prof != null) { ComboProf1.Items.Add(prof); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { this.WindowTitle = $"Add {ContactType} Contact"; L_Number.Content = $"{ContactType} Name"; TB_Number.Text = companyNumber; if (!edit) { AddNumber(new Phone(this)); } else { DataTable contact = new DataTable(); DataTable contactPhone = new DataTable(); DataTable contactSocial = new DataTable(); DataTable contactEmail = new DataTable(); contact = DBController.GetTableFromQuery(connstring, "Title, Notes", $"{ContactType}_Contacts"); contactPhone = DBController.GetTableFromQuery(connstring, "Phone_No, Type", $"{ContactType}_Contact_Phones"); contactEmail = DBController.GetTableFromQuery(connstring, "Email", $"{ContactType}_Contact_Email"); contactSocial = DBController.GetTableFromQuery(connstring, "Social_Media_Page", $"{ContactType}_Contact_Social_Media"); TB_Name.Text = contactName; TB_Title.Text = contact.Rows[0]["Title"].ToString(); TB_Notes.Text = contact.Rows[0]["Notes"].ToString(); TB_Email.Text = string.Join("\n", contactEmail.Rows.OfType <DataRow>().Select(x => x.Field <string>("Email")).ToList()); TB_Social.Text = string.Join("\n", contactSocial.Rows.OfType <DataRow>().Select(x => x.Field <string>("Social_Media_Page")).ToList()); Numbers = contactPhone.AsEnumerable().Select(x => new Phone(this) { Number = x[0].ToString(), Type = x[1].ToString() }).ToList(); Numbers.ForEach(x => Console.WriteLine(x.Number + " " + x.Type)); Numbers.ForEach(x => AddNumber(x)); } }
protected void btnCardType_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtCardType.Text)) { var cardMasterTypes = new CardMasterTypes() { CardTypeId = -1, CreatedBy = 1, CreatedOnDate = System.DateTime.Now, DisplayName = txtCardType.Text, IsDeleted = false, IsPublic = chkIsPublish.Checked, ModifiedBy = 1, ModifiedOnDate = System.DateTime.Now }; var oController = new DBController(); oController.InsertCardType(cardMasterTypes); GetCardType(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "SuccessNotification('Success','Record has been added successfully')", true); } }
static public void Start(DBController gs) { foreach (string file in Directory.EnumerateFiles("./npc/")) { using (StreamReader sr = new StreamReader(file)) { try { STRUCT_MOB CurrentMob = Functions.ReadAccount <STRUCT_MOB>(file); string indented = JsonConvert.SerializeObject(CurrentMob, Formatting.Indented); int update = gs.MySQL.nQuery(string.Format("INSERT INTO `mobs_json` (`nome`, `conteudo`) VALUES ('{0}', '{1}') ON DUPLICATE KEY UPDATE `nome` = '{2}' ", CurrentMob.Name, indented, CurrentMob.Name)); if (update != 0) { W2Log.Write(string.Format("Sucess update drops: {0}", file)); } } catch (Exception e) { return; } } } }
void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if (this != _instance) Destroy(this.gameObject); } }