// After serarch data , keep the data protected void LookupReFlash(string SYSTEM_ID, string USER_NOTES, string MAIL_ADS) { _msg = null; dtTemp = DBProcess_mail.Lookup_(SYSTEM_ID, USER_NOTES, MAIL_ADS, ref _msg); this.Storemail.DataSource = dtTemp; this.Storemail.DataBind(); }
protected void ReFlash() { String SYSTEM_ID = "WB"; _msg = ""; dtTemp = DBProcess_mail.Query_Data(SYSTEM_ID, ref _msg); this.Storemail.DataSource = dtTemp; this.Storemail.DataBind(); }
//查詢資料 //查詢資料 protected void btnLookup_DirectClick(object sender, Ext.Net.DirectEventArgs e) { string Find_SYSTEM_ID = "WB"; string Find_USER_NOTES = this.Find_USER_NOTES.Text; string Find_MAIL_ADS = this.Find_MAIL_ADS.Text; _msg = ""; LookupReFlash(Find_SYSTEM_ID, Find_USER_NOTES, Find_MAIL_ADS); String counts = DBProcess_mail.Count(Find_SYSTEM_ID, Find_USER_NOTES, Find_MAIL_ADS, ref _msg); X.MessageBox.Alert("提示", " After search , all have " + counts + " counts ").Show(); }
//update data //更新資料 protected void btnDel_DirectClick(object sender, Ext.Net.DirectEventArgs e) { string Text_SYSTEM_ID = this.Text_SYSTEM_ID.Text; string Text_USER_NOTES = this.Text_USER_NOTES.Text; string Text_MAIL_ADS = this.Text_MAIL_ADS.Text; string Text_IS_SEND = this.Text_IS_SEND.Text; string Text_IS_MODIFY = this.Text_IS_MODIFY.Text; string Text_IS_CC = this.Text_IS_CC.Text; string Text_Name = this.Text_Name.Text; _msg = ""; DBProcess_mail.Del_Data(Text_SYSTEM_ID, Text_MAIL_ADS, Text_USER_NOTES, ref _msg); X.MessageBox.Alert("提示", "DATA:" + Text_USER_NOTES + Text_MAIL_ADS + " successful updated").Show(); ReFlash(); }
//新增資料 protected void btnNew_DirectClick(object sender, Ext.Net.DirectEventArgs e) { string New_SYSTEM_ID = "WB"; string New_USER_NOTES = this.New_USER_NOTES.Text; string New_MAIL_ADS = this.New_MAIL_ADS.Text; string New_IS_SEND = this.New_IS_SEND.Text.ToUpper(); string New_IS_MODIFY = this.New_IS_MODIFY.Text.ToUpper(); string New_IS_CC = this.New_IS_CC.Text.ToUpper(); string New_Name = this.New_Name.Text; _msg = ""; string[] check = { New_USER_NOTES, New_MAIL_ADS, New_IS_SEND, New_IS_MODIFY, New_IS_CC, New_Name }; List <string> finishcheck = new List <string>(); //判斷格式是否正確 bool result1 = Groceries.IsNumeric(New_USER_NOTES); if (result1) { finishcheck.Add("true"); } else { finishcheck.Add("false"); } bool result2 = Groceries.IsmailValid(New_MAIL_ADS); if (result2) { finishcheck.Add("true"); } else { finishcheck.Add("false"); } bool result3 = Groceries.checkFormat(New_IS_SEND); if (result3) { finishcheck.Add("true"); } else { finishcheck.Add("false"); } bool result4 = Groceries.checkFormat(New_IS_MODIFY); if (result4) { finishcheck.Add("true"); } else { finishcheck.Add("false"); } bool result5 = Groceries.checkFormat(New_IS_CC); if (result5) { finishcheck.Add("true"); } else { finishcheck.Add("false"); } //格式正確後,才把資料匯入資料庫 bool FalseExists = finishcheck.Exists(element => element == "false"); if (FalseExists != true) { DBProcess_mail.Insert_Data(New_SYSTEM_ID, New_USER_NOTES, New_MAIL_ADS, New_IS_SEND, New_IS_MODIFY, New_IS_CC, New_Name, ref _msg); ReFlash(); X.MessageBox.Alert("提示", "已新增以下資料 USER_NOTES:" + New_USER_NOTES + " MAIL_ADS:" + New_MAIL_ADS).Show(); } else { X.MessageBox.Alert("提示", "格式有誤,請檢查格式").Show(); } }