private int GetIndexByAlertType(提醒方式 alertType, ComboBox comboBox3) { if (comboBox3 != null) { for (int i = 0; i < comboBox3.Items.Count; i++) { 提醒方式 at = (提醒方式)comboBox3.Items[i]; if (alertType == at) { return(i); } } } return(-1); }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox3.SelectedIndex > -1) { 提醒方式 type = (提醒方式)comboBox3.SelectedItem; if (type == 提醒方式.系统提示 || type == 提醒方式.员工短信) { selectMemberControl1.SendToBack(); selectStaffControl1.BringToFront(); } else if (type == 提醒方式.会员短信) { selectStaffControl1.SendToBack(); selectMemberControl1.BringToFront(); } } }
private DataTable Search(string name, object alertType, string subject) { string nm = ""; if (!string.IsNullOrEmpty(name) && name.Trim() != "") { nm = " and 提醒项目 like '%" + name.Trim() + "%'"; } string at = ""; string sb = ""; if (alertType is 提醒方式) { 提醒方式 type = (提醒方式)alertType; at = " and 提醒方式='" + type.ToString(); if (!string.IsNullOrEmpty(subject) && subject.Trim() != "") { int id = 0; if (type == 提醒方式.系统提示 || type == 提醒方式.员工短信) { Staff staff = StaffLogic.GetInstance().GetStaffByName(subject.Trim()); if (staff != null) { id = staff.ID; } } else if (type == 提醒方式.会员短信) { Member member = MemberLogic.GetInstance().GetMemberByName(subject.Trim()); if (member != null) { id = member.ID; } } sb = " and ','+提醒对象+',' like '%," + id + ",%'"; } } string where = "(1=1)" + nm + sb + at; return(AlertLogic.GetInstance().GetAlerts(where)); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { Alert alert = comboBox1.SelectedItem as Alert; if (alert != null) { textBox1.Text = alert.提醒项目; dateTimePicker1.Value = alert.提醒时间; comboBox3.SelectedIndex = GetIndexByAlertType(alert.提醒方式, comboBox3); 提醒方式 type = (提醒方式)comboBox3.SelectedItem; if (type == 提醒方式.系统提示 || type == 提醒方式.员工短信) { selectStaffControl1.SelectedStaffs = Commons.GetStaffByIdStr(alert.提醒对象); } else if (type == 提醒方式.会员短信) { selectMemberControl1.SelectedMembers = Commons.GetMemberByIdStr(alert.提醒对象); } checkBox1.Checked = alert.Flag == 1; textBox3.Text = alert.备注; } } }