// Stuff for putting the focus on the content private void MainPage_LayoutUpdated(object sender, object e) { if (_isPageLoaded == true) { Text1.Focus(FocusState.Programmatic); // Set focus on the main content so the user can start typing right away //set default font to UIs that still not depend on binding Fonts.PlaceholderText = QSetting.DefaultFont; Fonts.SelectedItem = QSetting.DefaultFont; FontSelected.Text = Convert.ToString(Fonts.SelectedItem); Text1.Document.Selection.CharacterFormat.Name = QSetting.DefaultFont; //check what default font color is if (QSetting.DefaultFontColor == "Default") { SelectedDefaultFontColor = 0; } else { SelectedDefaultFontColor = FontColorCollections.IndexOf(FontColorCollections.First(i => i.TechnicalName == QSetting.DefaultFontColor)); } Text1.Document.Selection.CharacterFormat.Size = QSetting.DefaultFontSize; LaunchCheck(); //call method to check what mode the app should launch in _isPageLoaded = false; } }
private void Command2_Click(System.Object _sender, System.EventArgs _e1) { Adodc1.Recordset.Find("No_TP='" + Text1.Text + "'", nce.adodb.SearchDirection.adSearchForward, 1); if (!(Adodc1.Recordset.Eof)) { MessageBox.Show("Kode TP sudah ada sebelumnya atau nomor urut telah ada sebelumnya", "Project1"); } else { if (Text1.Text == "" || Text2.Text == "" || Text3.Text == "") { MessageBox.Show("Data Kurang Lengkap", "Project1", MessageBoxButtons.OK, MessageBoxIcon.Error); Text1.Focus(); } else { Adodc1.Recordset.Fields["No_TP"].Value = Text1.Text; Adodc1.Recordset.Fields["Nama_TP"].Value = Text2.Text; Adodc1.Recordset.Fields["alamat"].Value = Text3.Text; Adodc1.Recordset.Update(); Adodc1.Refresh(); TDBGrid1.Refresh(); Text1.Text = ""; Text2.Text = ""; Text3.Text = ""; Command2.Enabled = false; Command1.Enabled = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserType"] == null || Convert.ToInt32(Session["UserType"]) != Global.AdminUserType) //admin { Global.Application_AccessDenied(sender, e); } else { SqlDataSource1.ConnectionString = Global.getConnectionString(); } Text1.Focus(); }
private void Command3_Click(System.Object _sender, System.EventArgs _e1) { if (Adodc1.Recordset.RecordCount == 0) { MessageBox.Show("Data Tidak Ada", "Project1", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Adodc1.Recordset.Delete(); Adodc1.Recordset.Update(); Adodc1.Refresh(); TDBGrid1.Refresh(); Text1.Focus(); } }
protected void sendMail_Click(object sender, EventArgs e) { if (Text1.Value == "") { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Please enter a recipient email address" + "');", true); Text1.Focus(); } else if (TextArea1.Value == "") { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Please enter a non-empty message" + "');", true); TextArea1.Focus(); } else if else { date = DateTime.Now.ToString("d"); cmd.CommandText = "INSERT INTO Emails([fromUser],[toUser],[subject],[text],[date],[status],[deleted]) Values ('" + Session["user"].ToString() + "','" + Text1.Value.ToString() + "','" + Text3.Value.ToString() + "','" + TextArea1.Value + "','" + date + "','u','n');"; cmd.ExecuteNonQuery(); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Your email has been sent." + "');", true); Response.Redirect("inbox.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserType"] == null || (Convert.ToInt32(Session["UserType"]) != Global.ManagerUserType && Convert.ToInt32(Session["UserType"]) != Global.AdminUserType)) //manager & admin { Global.Application_AccessDenied(sender, e); } else if (!IsPostBack) { SqlConnection con = new SqlConnection(Global.getConnectionString()); DataTable roles = new DataTable(), industries = new DataTable(); SqlDataAdapter adptrole = new SqlDataAdapter("SELECT name FROM pms_resource_role;", con); adptrole.Fill(roles); SqlDataAdapter adptindustry = new SqlDataAdapter("SELECT name FROM pms_industry;", con); adptindustry.Fill(industries); if (Request.QueryString["ProjectID"] == null) { GridView1.Columns[8].Visible = false; } else { GridView1.Columns[9].Visible = false; } //String temp; //foreach (DataRow row in roles.Rows) { // temp = row["name"].ToString(); // row["name"] = char.ToUpper(temp[0]) + temp.Substring(1).ToLower(); //} //foreach (DataRow row in industries.Rows) { // temp = row["name"].ToString(); // row["name"] = char.ToUpper(temp[0]) + temp.Substring(1).ToLower(); //} try { con.Open(); DropDownList1.DataSource = roles; DropDownList1.DataTextField = "name"; DropDownList1.DataValueField = "name"; // "id" if SELECT * DropDownList1.DataBind(); DropDownList2.DataSource = industries; DropDownList2.DataTextField = "name"; DropDownList2.DataValueField = "name"; DropDownList2.DataBind(); } catch (Exception ex) { throw (ex); } finally { adptrole.Dispose(); adptindustry.Dispose(); roles.Dispose(); con.Dispose(); con.Close(); } DropDownList1.Items.Insert(0, new ListItem("Any", "Any")); DropDownList2.Items.Insert(0, new ListItem("Any", "Any")); DropDownList4.SelectedIndex = 2; DropDownList5.SelectedIndex = 4; Text5.Value = 40.ToString(); } else { } Text1.Focus(); }