private void update_Click(object sender, EventArgs e) { if (Firstname.Text != "" && Lastname.Text != "" && Middlename.Text != "" && bday.Text != "" && Address.Text != "" && Phonenum.Text != "" && Jobposition.Text != "" && Emailadd.Text != "") { sqlcon.Close(); string query = "Update quickpctbl Set Fname ='" + Firstname.Text.Trim() + "', Mname ='" + Middlename.Text.Trim() + "', Lname ='" + Lastname.Text.Trim() + "', Birthday ='" + bday.Text.Trim() + "', Address ='" + Address.Text.Trim() + "', PhoneNumber ='" + Phonenum.Text.Trim() + "', JobPosition ='" + Jobposition.Text.Trim() + "', EmailAddress ='" + Emailadd.Text.Trim() + "' where IdNumber = '" + idnum.Text.Trim() + "'"; SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon); DataTable dtbl = new DataTable(); sda.Fill(dtbl); MessageBox.Show("Successfuly Update!"); } else { MessageBox.Show("Please Input!"); } idnum.Clear(); Firstname.Clear(); Middlename.Clear(); Lastname.Clear(); bday.Text = String.Empty; Address.Clear(); Phonenum.Clear(); Jobposition.Text = String.Empty; Emailadd.Clear(); }
public int InsertPhoneNum(Phonenum phonenum) { int nflag = 1; MySqlParameter[] par = new MySqlParameter[3]; par[0] = new MySqlParameter("@simulator_id", MySqlDbType.Int32); par[0].Value = phonenum.SimulatorId; par[1] = new MySqlParameter("@phonenum", MySqlDbType.Text); par[1].Value = phonenum.PhoneNum; par[2] = new MySqlParameter("@status", MySqlDbType.Int32); par[2].Value = phonenum.Status; try { nflag = MySqlHelpers.ExecuteNonQuery(MySqlHelpers.ConnectionString, CommandType.Text , strSql_insert_phonenum, par); } catch (Exception ex) { System.Diagnostics.EventLog.WriteEntry("WhatsApp", ex.ToString(), System.Diagnostics.EventLogEntryType.Error); } return(nflag); }
private void Phonenum_PreviewMouseDown(object sender, MouseButtonEventArgs e)//cleaning the text box so you can write the ID { if (Phonenum.Text == "Enter Your Phone Number") { Phonenum.Clear(); } }
public int InsertPhoneNum(Phonenum phonenum) { PhonenumDAL dal = new PhonenumDAL(); int nflag = dal.InsertPhoneNum(phonenum); return(nflag); }
public List <Phonenum> SelectPhoneNumber() { List <Phonenum> list = new List <Phonenum>(); using (MySqlDataReader dr = MySqlHelpers.ExecuteReader(MySqlHelpers.ConnectionString, CommandType.Text, strSql_select_phoneNumber, null)) { while (dr.Read()) { Phonenum phonenum = new Phonenum(); phonenum.Id = Int32.Parse(dr["id"].ToString()); phonenum.PhoneNum = dr["phonenum"].ToString(); phonenum.SimulatorId = Int32.Parse(dr["simulator_id"].ToString()); phonenum.Status = Int32.Parse(dr["status"].ToString()); phonenum.Created = dr["created"].ToString(); list.Add(phonenum); } } return(list); }
private void newaccount_Click(object sender, EventArgs e) { if (Firstname.Text != "" && Lastname.Text != "" && Middlename.Text != "" && bday.Text != "" && Address.Text != "" && Phonenum.Text != "" && Jobposition.Text != "" && Emailadd.Text != "") { string query = "Insert into quickpctbl VALUES('" + idnum.Text.Trim() + "','" + Firstname.Text.Trim() + "','" + Middlename.Text.Trim() + "','" + Lastname.Text.Trim() + "','" + bday.Text.Trim() + "','" + Address.Text.Trim() + "','" + Phonenum.Text.Trim() + "','" + Jobposition.Text.Trim() + "','" + Emailadd.Text.Trim() + "')"; SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon); DataTable dtbl = new DataTable(); sda.Fill(dtbl); MessageBox.Show("Successfuly Added!"); idnum.Clear(); Firstname.Clear(); Middlename.Clear(); Lastname.Clear(); bday.Text = String.Empty; Address.Clear(); Phonenum.Clear(); Jobposition.Text = String.Empty; Emailadd.Clear(); } else { MessageBox.Show("Please Input!"); } }
/// <summary> /// 确定导入号码文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnImport_Click(object sender, RoutedEventArgs e) { //移动文件到指定的目录 var targets = from item in treeviewImportList.ItemsSourceData.FirstOrDefault().Children where item.IsChecked select(int) item.Id - 1; if (targets.Count() == 0) { MessageDialogManager.ShowDialogAsync(SystemLanguageManager.Instance.ResourceManager.GetString("Select_Vm", SystemLanguageManager.Instance.CultureInfo)); return; } List <int> checkMobiles = targets.ToList(); List <string> phoneStr = new List <string>(); TextRange textRange = new TextRange(rtbPhoneNums.Document.ContentStart, rtbPhoneNums.Document.ContentEnd); if (!string.IsNullOrEmpty(textRange.Text)) { phoneStr = textRange.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.None).ToList(); phoneStr = phoneStr.Where(s => !string.IsNullOrEmpty(s)).ToList(); } int flag = 0; if (tbContactPath.Text != "") { StreamReader sr = new StreamReader(tbContactPath.Text, Encoding.Default); string line; while ((line = sr.ReadLine()) != null) { phoneStr.Add(line.ToString()); if (phoneStr.Count > 100000) { flag = -1; break; } } } if (flag == -1) { MessageDialogManager.ShowDialogAsync(string.Format(SystemLanguageManager.Instance.ResourceManager.GetString("Exceed_Max_Import_Num", SystemLanguageManager.Instance.CultureInfo))); return; } //插入到任务表中 int sr1 = 21 / 1; int onenums = phoneStr.Count / checkMobiles.Count; PhonenumBLL phonebll = new PhonenumBLL(); //TasksBLL taskbll = new TasksBLL(); for (int m = 0; m < checkMobiles.Count; m++) { int res = 0; List <string> strIds = new List <string>(); if (checkMobiles.Count > 1 && m == checkMobiles.Count - 1) { onenums = phoneStr.Count; } for (int i = 0; i < onenums; i++) { Phonenum phone = new Phonenum(); phone.PhoneNum = phoneStr[i]; phone.SimulatorId = checkMobiles[m]; phone.Status = 0; //待导入 int nflag = phonebll.InsertPhoneNum(phone); if (nflag > 0) { res++; } strIds.Add(phone.PhoneNum); } if (strIds != null && strIds.Count > 0) { for (int j = 0; j < strIds.Count; j++) { phoneStr.Remove(strIds[j]); } } //号码写入文件 string filepath = CopyPhoneNumsFile(strIds, checkMobiles[m]); var lists = new JArray { }; if (filepath != "") { lists.Add(filepath); var obj = new JObject() { { "tasktype", 1 }, { "txtmsg", "" } }; obj.Add("list", lists); //插入任务 TaskSch tasks = new TaskSch(); tasks.TypeId = 1; tasks.Remotes = checkMobiles[m].ToString(); tasks.MobileIndex = checkMobiles[m]; tasks.Bodys = obj.ToString(Formatting.None); //tasks.Bodys = JsonConvert.SerializeObject(new string[] { "tasktype:1", "txtmsg:", "filepath:"+ filepath, "nums:"+res}); tasks.Status = "waiting"; tasks.ResultVal = ""; tasks.RepeatNums = 1; tasks.RandomMins = 5; tasks.RandomMaxs = 12; tasks.IsStep = 0; TasksBLL.CreateTask(tasks); } } //启动任务列表 if (ConfigVals.IsRunning != 1) { Task.Run(async() => { await ProessTask(); }); } MessageDialogManager.ShowDialogAsync(string.Format(SystemLanguageManager.Instance.ResourceManager.GetString("Submitted_Task", SystemLanguageManager.Instance.CultureInfo), checkMobiles.Count)); }
private void update_Click(object sender, RoutedEventArgs e) { HostingUnit hu2 = new HostingUnit(); hu2 = hu1; bool flag = true; bool email_flag = true; try { email_flag = myBL.IsValidEmail(Email.Text); } catch// (Exception a) { Email.Clear(); Email.Text = "Enter Your Email Address"; Email.BorderBrush = Brushes.Red; flag = false; email_flag = false; } if (!myBL.AllowedToChangeCommission(hu2)) { if (!(bool)CollectionClearance.IsChecked && hu2.Owner.CollectionClearance) { flag = false; MessageBox.Show("cannot change collection clearance when property has booked orders"); } } if (flag) { hu2.Owner.PhoneNumber = Convert.ToInt32(Phonenum.Text); hu2.Owner.MailAddress = Email.Text; hu2.Owner.BankAccountNumber = Convert.ToInt32(BankAcctNum.Text); hu2.Owner.CollectionClearance = (bool)CollectionClearance.IsChecked; hu2.Owner.BankBranchDetails = (BankBranch)cbBank.SelectedItem; hu2.HostingUnitName = HUname.Text; hu2.Beds = Convert.ToInt32(Beds.Text); hu2.Pet = (bool)Pets.IsChecked; hu2.WiFi = (bool)Wifi.IsChecked; hu2.Parking = (bool)Parking.IsChecked; hu2.Pool = (bool)Pool.IsChecked; hu2.Jacuzzi = (bool)Jacuzzi.IsChecked; hu2.Garden = (bool)Garden.IsChecked; hu2.ChildrensAttractions = (bool)chiAttract.IsChecked; hu2.FitnessCenter = (bool)FitnessCenter.IsChecked; try { // explicit update of each property of the hosting unit BindingExpression be = HUname.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); be = Phonenum.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); be = BankAcctNum.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); be = Email.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); be = Beds.GetBindingExpression(TextBox.TextProperty); be.UpdateSource(); be = cbBank.GetBindingExpression(ComboBox.TextProperty); if (be != null) { be.UpdateSource(); } be = Pool.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = Jacuzzi.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = Pets.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = Garden.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = Parking.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = Wifi.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = chiAttract.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = FitnessCenter.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); be = CollectionClearance.GetBindingExpression(CheckBox.IsCheckedProperty); be.UpdateSource(); myBL.UpdateHostingUnit(hu2); updated = true; Close(); } catch (Exception a) { MessageBox.Show(a.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } } }