protected void btnMessages_Click(object sender, EventArgs e) { RegistrationBusiness Registration = new RegistrationBusiness(); for (int i = 0; i < this.ReportRepeater.Items.Count; i++) { CheckBox cb = (CheckBox)ReportRepeater.Items[i].FindControl("checkbox1"); Literal ltPersonID = (Literal)ReportRepeater.Items[i].FindControl("lblPersonID"); Literal ltlblDeptName = (Literal)ReportRepeater.Items[i].FindControl("lblDeptName"); Literal ltRegisterNo = (Literal)ReportRepeater.Items[i].FindControl("lblRegisterNo"); if (cb.Checked) { Maticsoft.Model.messages.checkperson en = new Maticsoft.Model.messages.checkperson(); en = new Maticsoft.BLL.messages.checkperson().GetModel(Convert.ToInt32(ltPersonID.Text)); if (en != null) { //string smsResult = SMS.Send("",en.telephone); Maticsoft.BLL.messages.messages_type bllType = new Maticsoft.BLL.messages.messages_type(); Maticsoft.Model.messages.messages_type msgType = new Maticsoft.Model.messages.messages_type(); Maticsoft.Model.messages.messages model = new Maticsoft.Model.messages.messages(); model.type = messagesType.体检过通知.ToString(); model.rcvMan = en.Name; model.rcvTel = en.Mobile; model.unit = ltlblDeptName.Text; model.sendTime = DateTime.Now; msgType = bllType.GetModelbyCode(messagesType.体检过通知.GetHashCode().ToString()); if (msgType != null) { model.content = msgType.templet; } //model.content = string.Format("[{0}]您好!您在[YYMC]的体检完成,网上www.tophim.com查询体检结果的帐号[ZH]密码[MM]", en.Name); model.status = "成功"; Maticsoft.BLL.messages.messages bll = new Maticsoft.BLL.messages.messages(); if (bll.Add(model)) { Maticsoft.Model.messages.messagesjoin modeljoin = new Maticsoft.Model.messages.messagesjoin(); Maticsoft.BLL.messages.messagesjoin blljoin = new Maticsoft.BLL.messages.messagesjoin(); if (blljoin.Exists("registration", ltRegisterNo.Text)) { string sqlW = string.Format(" jointable='registration' And tableCode='{0}'", en.DeptID.ToString()); modeljoin = blljoin.GetModelList(sqlW)[0]; modeljoin.messagesid = bll.GetMaxId() - 1; blljoin.Update(modeljoin); } else { modeljoin.jointable = "registration"; modeljoin.tableCode = ltRegisterNo.Text; modeljoin.messagesid = bll.GetMaxId() - 1; blljoin.Add(modeljoin); } } } } } DataBind(); }
protected void btnMessages_Click(object sender, EventArgs e) { for (int i = 0; i < this.CompanyRepeater.Items.Count; i++) { CheckBox cb = (CheckBox)CompanyRepeater.Items[i].FindControl("checkbox1"); Literal ltid = (Literal)CompanyRepeater.Items[i].FindControl("lblCompanyID"); if (cb.Checked) { //Maticsoft.Model.messages.messagesjoin en = new Maticsoft.Model.messages.messagesjoin(); //en = m_Company.GetCompany(Convert.ToInt32(ltid.Text)); PhysicalDepartmentEntity en = new PhysicalDepartmentEntity(); en = new PhysicalDepartmentBusiness().GetPhysicalDepartment(Convert.ToInt32(ltid.Text)); if (en != null) { //string smsResult = SMS.Send("",en.telephone); Maticsoft.BLL.messages.messages_type bllType = new Maticsoft.BLL.messages.messages_type(); Maticsoft.Model.messages.messages_type msgType = new Maticsoft.Model.messages.messages_type(); Maticsoft.Model.messages.messages model = new Maticsoft.Model.messages.messages(); model.type = messagesType.单位体检通知.ToString(); model.rcvMan = en.Leader; model.rcvTel = en.LinkTel; model.unit = en.DeptName; model.sendTime = DateTime.Now; msgType = bllType.GetModelbyCode(messagesType.单位体检通知.GetHashCode().ToString()); if (msgType != null) { model.content = msgType.templet; } model.status = "成功"; Maticsoft.BLL.messages.messages bll = new Maticsoft.BLL.messages.messages(); if (bll.Add(model)) { Maticsoft.Model.messages.messagesjoin modeljoin = new Maticsoft.Model.messages.messagesjoin(); Maticsoft.BLL.messages.messagesjoin blljoin = new Maticsoft.BLL.messages.messagesjoin(); if (blljoin.Exists("PhysicalDepartment", en.DeptID.ToString())) { string sqlW = string.Format(" jointable='PhysicalDepartment' And tableCode='{0}'", en.DeptID.ToString()); modeljoin = blljoin.GetModelList(sqlW)[0]; modeljoin.messagesid = bll.GetMaxId() - 1; blljoin.Update(modeljoin); } else { modeljoin.jointable = "PhysicalDepartment"; modeljoin.tableCode = en.DeptID.ToString(); modeljoin.messagesid = bll.GetMaxId() - 1; blljoin.Add(modeljoin); } } } } } DataBind(); }