private void buttonOK_Click(object sender, EventArgs e) { DateTime nowTime = DateTime.Now; string name = textBox1.Text; string description = textBox2.Text; if (name == "") { MessageBox.Show("姓名不能为空!"); textBox1.SelectAll(); textBox1.Focus(); return; } BaseInfoMemberTester bimt = BaseInfoMemberTester.New; bimt.Name = name; if (description == "") { bimt.Description = "无"; } else { bimt.Description = description; } bimt.PinYin = AutoPinYin.GetPinYin(name); bimt.Mobile = Mobile; bimt.TestDate = nowTime; bimt.FinishedDate = nowTime.AddHours(1); bimt.Status = "0"; bimt.OptrType = UserStatics.OptrType; bimt.Save(); MessageBox.Show("录入完成,请您入园体验!"); this.Close(); }
private void FrmBaseInfoMemberTesterInput_Load(object sender, EventArgs e) { //sp.Volume = 40; //sp.Rate = -4; //sp.Speak("彩虹乐园欢迎您!黄腾达,手机:1 3 5 5 6 4 2 6 4 9 6 体验时间已到!", spFlags); DbObjectList <BaseInfoMemberTester> bimt = BaseInfoMemberTester.Find(CK.K["FinishedDate"] < DateTime.Now.AddDays(-1) && CK.K["Status"] == 0); int count = bimt.Count; if (count > 0) { for (int i = 0; i < count; i++) { bimt[i].Status = "1"; bimt[i].Save(); } } dgvTester.DataSource = BllBaseInfoMemberTester.ReturnFinishedTester(UserStatics.OptrType); timerWarning.Enabled = true; }
protected override void SetImportOptration() { try { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { DataSet ds = new DataSet(); string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + ofd.FileName + ";" + "Extended Properties='Excel 8.0;HDR=yes;IMEX=1'"; OleDbConnection conn = new OleDbConnection(strConn); conn.Open(); string strExcel = ""; OleDbDataAdapter myCommand = null; strExcel = string.Format("select * from [{0}$]", "Sheet1"); //Sheet1为excel中工作薄 myCommand = new OleDbDataAdapter(strExcel, strConn); myCommand.Fill(ds, "Sheet1"); DataTable dt = ds.Tables["Sheet1"]; Encoding gb2312 = Encoding.GetEncoding("GB2312"); for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { BaseInfoMemberTester bifmt = BaseInfoMemberTester.New; bifmt.Mobile = dt.Rows[iRow][0].ToString(); bifmt.Name = dt.Rows[iRow][1].ToString(); bifmt.Description = dt.Rows[iRow][2].ToString(); bifmt.PinYin = PinYinTransfer.GetInitials(bifmt.Name, gb2312); bifmt.TestDate = (DateTime)dt.Rows[iRow][3]; bifmt.FinishedDate = (DateTime)dt.Rows[iRow][4]; bifmt.Status = "0"; bifmt.OptrType = UserStatics.OptrType; bifmt.Save(); } } MessageBox.Show("导入成功!"); } catch (Exception ex) { MessageBox.Show("导入有问题,日期精确到秒,日期列要设为日期格式,并且数值类型如没有必须用0代替!\n" + ex); } }
private void timerWarning_Tick(object sender, EventArgs e) { DbObjectList <BaseInfoMemberTester> bimt = BaseInfoMemberTester.Find(CK.K["FinishedDate"] < DateTime.Now && CK.K["Status"] == 0); int count = bimt.Count; string text = ""; if (count > 0) { for (int i = 0; i < count; i++) { text = bimt[i].Name + "\n 体验时间已到!"; bimt[i].Status = "1"; bimt[i].Save(); MessageBox.Show(text); sp.Volume = 40; sp.Speak(text, spFlags); } } dgvTester.DataSource = null; dgvTester.DataSource = BllBaseInfoMemberTester.ReturnFinishedTester(UserStatics.OptrType); }
private void buttonOK_Click(object sender, EventArgs e) { string mobile = textBox1.Text.Trim(); if (mobile.Length != 11) { MessageBox.Show("手机号长度必须是11位"); textBox1.SelectAll(); textBox1.Focus(); return; } if (!System.Text.RegularExpressions.Regex.IsMatch(mobile, @"^((0?1[358]\d{9})|((0(10|2[1-3]|[3-9]\d{2}))?[1-9]\d{6,7}))$")) { MessageBox.Show("手机号格式不正确,并且不能为除数字外的字符!"); textBox1.SelectAll(); textBox1.Focus(); return; } long count = BaseInfoMemberTester.GetCount(CK.K["Mobile"] == mobile); if (count == 0) { FrmBaseInfoMemberTesterInput2 fbimti2 = new FrmBaseInfoMemberTesterInput2(); fbimti2.Mobile = mobile; fbimti2.StartPosition = FormStartPosition.CenterParent; fbimti2.ShowDialog(); fbimti2.Dispose(); textBox1.Text = ""; } else { MessageBox.Show("该手机号客户已于" + BaseInfoMemberTester.FindOne(CK.K["Mobile"] == mobile).TestDate + "进行过体验!"); } }
internal static void DelCell(long id) { BaseInfoMemberTester.DeleteAll(CK.K["Id"] == id); }