private void myProfileToolStripMenuItem_Click(object sender, EventArgs e) { using (AddUser form = new AddUser(Helper.UserID)) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { } } }
private void toolStripMenuItem17_Click(object sender, EventArgs e) { using (AddUser form = new AddUser(null)) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { toolStripMenuItem18_Click(null, null); } } }
private void button2_Click(object sender, EventArgs e) { using (AddUser form = new AddUser(null)) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { autocomplete(); } } }
private void toolStripButton2_Click(object sender, EventArgs e) { using (AddUser form = new AddUser(null)) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { LoadData(); } } }
private void dtGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1) { using (AddUser form = new AddUser(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { } } } }
private void LoadUsers() { try { u = Users.List(); if (u.Count() < 1) { using (AddUser form = new AddUser("")) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { lblStatus.Text = lblStatus.Text + " Server connected you can continue to login "; lblStatus.ForeColor = Color.Green; autocomplete(); } } return; } else { lblStatus.Text = lblStatus.Text + " Server connected you can continue to login "; lblStatus.ForeColor = Color.Green; autocomplete(); return; } } catch (Exception c) { System.Diagnostics.Debug.WriteLine(c.ToString()); MessageBox.Show(c.Message.ToString()); lblStatus.Text = ("No users defined"); lblStatus.ForeColor = Color.Red; return; } }
private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == dtGrid.Columns["Select"].Index && e.RowIndex >= 0) { dtGrid.CurrentCell.Value = dtGrid.CurrentCell.FormattedValue.ToString() == "True" ? false : true; dtGrid.RefreshEdit(); if (selectedIDs.Contains(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString())) { selectedIDs.Remove(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()); } else { selectedIDs.Add(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()); } } if (e.ColumnIndex == dtGrid.Columns["View"].Index && e.RowIndex >= 0) { if (Convert.ToInt32(Helper.Level) < 5) { MessageBox.Show("Access Denied !"); return; } using (AddUser form = new AddUser(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString())) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { LoadData(); } } } try { if (e.ColumnIndex == dtGrid.Columns["Delete"].Index && e.RowIndex >= 0) { try { if (Convert.ToInt32(Helper.Level) < 5) { MessageBox.Show("Access Denied !"); return; } } catch (Exception c) { //MessageBox.Show(c.Message.ToString()); Helper.Exceptions(c.Message, "Access level error "); MessageBox.Show("Access Denied WITH ERROR !"); return; } if (MessageBox.Show("YES or No?", "Are you sure you want to delete this User? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string Query = "DELETE from users WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'"; MySQL.Query(Query); GenericCollection.users.RemoveAll(r => r.Id == dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()); MessageBox.Show("Information deleted"); Helper.Log(Helper.UserName, "Deleted user " + dtGrid.Rows[e.RowIndex].Cells["name"].Value.ToString() + " " + DateTime.Now); LoadData(); } } } catch { } try { if (e.ColumnIndex == dtGrid.Columns["Active"].Index && e.RowIndex >= 0) { //string URI = "https://platform.clickatell.com/messages/http/send?apiKey=jKgp8Hx8SpyqTrt_Mg69Eg==&to=+19784579809&content=test"; //string myParameters = "param1=value1¶m2=value2¶m3=value3"; //using (WebClient wc = new WebClient()) //{ // wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; // string HtmlResult = wc.UploadString(URI, myParameters); //} Dictionary <string, string> Params = new Dictionary <string, string>(); //adding the parameters to the dictionary Params.Add("content", "WE ARE TESTING"); Params.Add("to", "+19784579809"); //if (from != "") { Params.Add("from", from); } //if (delivery != "") { Params.Add("scheduledDeliveryTime", delivery); } //if (api != "") //{ //response = Api.SendSMS("jKgp8Hx8SpyqTrt_Mg69Eg==", Params); MessageBox.Show(response); dynamic results = Api.SendSMS("jKgp8Hx8SpyqTrt_Mg69Eg==", Params); foreach (dynamic res in results) { Console.Write((string)res["number"] + ","); Console.Write((string)res["status"] + ","); // status is either "Success" or "error message" Console.Write((string)res["statusCode"] + ","); Console.Write((string)res["messageId"] + ","); Console.WriteLine((string)res["cost"]); } //} //else //{ // MessageBox.Show("Error: API Key cannot be blank"); //} try { if (Convert.ToInt32(Helper.Level) < 5) { MessageBox.Show("Access Denied !"); return; } } catch (Exception c) { //MessageBox.Show(c.Message.ToString()); Helper.Exceptions(c.Message, "Access level error "); MessageBox.Show("Access Denied WITH ERROR !"); return; } if (MessageBox.Show("YES or No?", "Change user status ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string Query = ""; string status = dtGrid.Rows[e.RowIndex].Cells["active"].Value.ToString(); string id = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); var obj = GenericCollection.users.FirstOrDefault(x => x.Id == id); if (status == "Yes") { Query = "UPDATE users SET active = 'No' WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'"; if (obj != null) { obj.Active = "No"; } } else { Query = "UPDATE users SET active = 'Yes' WHERE id ='" + dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString() + "'"; if (obj != null) { obj.Active = "Yes"; } } MySQL.Query(Query); MessageBox.Show("Information updated"); Helper.Log(Helper.UserName, "Changed user status " + dtGrid.Rows[e.RowIndex].Cells["name"].Value.ToString() + " " + DateTime.Now); LoadData(); } } } catch { } }