/// <summary> /// 得到一个对象实体 /// </summary> public XBase.Model.Personal.MessageBox.MobileMsgMonitor GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,CompanyCD,MsgType,SendUserID,SendUserName,ReceiveUserID,ReceiveUserName,ReceiveMobile,Content,Status,CreateDate,SendDate from officedba.MobileMsgMonitor "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; XBase.Model.Personal.MessageBox.MobileMsgMonitor model = new XBase.Model.Personal.MessageBox.MobileMsgMonitor(); DataTable dt = SqlHelper.ExecuteSql(strSql.ToString(), parameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } model.CompanyCD = ds.Tables[0].Rows[0]["CompanyCD"].ToString(); model.MsgType = ds.Tables[0].Rows[0]["MsgType"].ToString(); if (ds.Tables[0].Rows[0]["SendUserID"].ToString() != "") { model.SendUserID = int.Parse(ds.Tables[0].Rows[0]["SendUserID"].ToString()); } model.SendUserName = ds.Tables[0].Rows[0]["SendUserName"].ToString(); if (ds.Tables[0].Rows[0]["ReceiveUserID"].ToString() != "") { model.ReceiveUserID = int.Parse(ds.Tables[0].Rows[0]["ReceiveUserID"].ToString()); } model.ReceiveUserName = ds.Tables[0].Rows[0]["ReceiveUserName"].ToString(); model.ReceiveMobile = ds.Tables[0].Rows[0]["ReceiveMobile"].ToString(); model.Content = ds.Tables[0].Rows[0]["Content"].ToString(); model.Status = ds.Tables[0].Rows[0]["Status"].ToString(); if (ds.Tables[0].Rows[0]["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString()); } if (ds.Tables[0].Rows[0]["SendDate"].ToString() != "") { model.SendDate = DateTime.Parse(ds.Tables[0].Rows[0]["SendDate"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(XBase.Model.Personal.MessageBox.MobileMsgMonitor model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update officedba.MobileMsgMonitor set "); strSql.Append("CompanyCD=@CompanyCD,"); strSql.Append("MsgType=@MsgType,"); strSql.Append("SendUserID=@SendUserID,"); strSql.Append("SendUserName=@SendUserName,"); strSql.Append("ReceiveUserID=@ReceiveUserID,"); strSql.Append("ReceiveUserName=@ReceiveUserName,"); strSql.Append("ReceiveMobile=@ReceiveMobile,"); strSql.Append("Content=@Content,"); strSql.Append("Status=@Status,"); strSql.Append("CreateDate=@CreateDate,"); strSql.Append("SendDate=@SendDate"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@CompanyCD", SqlDbType.VarChar, 8), new SqlParameter("@MsgType", SqlDbType.Char, 1), new SqlParameter("@SendUserID", SqlDbType.Int, 4), new SqlParameter("@SendUserName", SqlDbType.VarChar, 100), new SqlParameter("@ReceiveUserID", SqlDbType.Int, 4), new SqlParameter("@ReceiveUserName", SqlDbType.VarChar, 100), new SqlParameter("@ReceiveMobile", SqlDbType.VarChar, 20), new SqlParameter("@Content", SqlDbType.VarChar, 1024), new SqlParameter("@Status", SqlDbType.Char, 1), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@SendDate", SqlDbType.DateTime) }; parameters[0].Value = model.ID; parameters[1].Value = model.CompanyCD; parameters[2].Value = model.MsgType; parameters[3].Value = model.SendUserID; parameters[4].Value = model.SendUserName; parameters[5].Value = model.ReceiveUserID; parameters[6].Value = model.ReceiveUserName; parameters[7].Value = model.ReceiveMobile; parameters[8].Value = model.Content; parameters[9].Value = model.Status; parameters[10].Value = model.CreateDate; parameters[11].Value = model.SendDate; SqlHelper.ExecuteTransSql(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(XBase.Model.Personal.MessageBox.MobileMsgMonitor model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into officedba.MobileMsgMonitor("); strSql.Append("CompanyCD,MsgType,SendUserID,SendUserName,ReceiveUserID,ReceiveUserName,ReceiveMobile,Content,Status,CreateDate,SendDate)"); strSql.Append(" values ("); strSql.Append("@CompanyCD,@MsgType,@SendUserID,@SendUserName,@ReceiveUserID,@ReceiveUserName,@ReceiveMobile,@Content,@Status,@CreateDate,@SendDate)"); strSql.Append(";select @ID=@@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@CompanyCD", SqlDbType.VarChar, 8), new SqlParameter("@MsgType", SqlDbType.Char, 1), new SqlParameter("@SendUserID", SqlDbType.Int, 4), new SqlParameter("@SendUserName", SqlDbType.VarChar, 100), new SqlParameter("@ReceiveUserID", SqlDbType.Int, 4), new SqlParameter("@ReceiveUserName", SqlDbType.VarChar, 100), new SqlParameter("@ReceiveMobile", SqlDbType.VarChar, 20), new SqlParameter("@Content", SqlDbType.VarChar, 1024), new SqlParameter("@Status", SqlDbType.Char, 1), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@SendDate", SqlDbType.DateTime), new SqlParameter("@ID", SqlDbType.Int, 0) }; parameters[0].Value = model.CompanyCD; parameters[1].Value = model.MsgType; parameters[2].Value = model.SendUserID; parameters[3].Value = model.SendUserName; parameters[4].Value = model.ReceiveUserID; parameters[5].Value = model.ReceiveUserName; parameters[6].Value = model.ReceiveMobile; parameters[7].Value = model.Content; parameters[8].Value = model.Status; parameters[9].Value = model.CreateDate; parameters[10].Value = model.SendDate; parameters[11].Direction = ParameterDirection.Output; SqlHelper.ExecuteTransSql(strSql.ToString(), parameters); return(int.Parse(parameters[11].Value.ToString())); }
public static void SendMobileMsg(string CompanyCD, string FlowNo, int BillTypeFlag, int BillTypeCode, int BillID, string BillNo, int State, int OperateType) { try { DataTable dt = XBase.Business.Common.FlowBus.GetMsgRemindList(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, BillID, State, OperateType); XBase.Business.Personal.MessageBox.MobileMsgMonitor bll = new XBase.Business.Personal.MessageBox.MobileMsgMonitor(); if (dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(dt.Rows[0]["EmployeeID"].ToString()) && !string.IsNullOrEmpty(dt.Rows[0]["Mobile"].ToString())) { if (int.Parse(dt.Rows[0]["MsgCount"].ToString()) > 0) { XBase.Model.Personal.MessageBox.MobileMsgMonitor entity; entity = new XBase.Model.Personal.MessageBox.MobileMsgMonitor(); entity.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; entity.Content = dt.Rows[0]["MsgContents"].ToString(); entity.CreateDate = DateTime.Now; entity.ReceiveMobile = dt.Rows[0]["Mobile"].ToString(); entity.ReceiveUserID = int.Parse(dt.Rows[0]["EmployeeID"].ToString()); entity.ReceiveUserName = dt.Rows[0]["EmployeeName"].ToString(); entity.SendDate = DateTime.Now; entity.SendUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; entity.SendUserName = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName; entity.Status = "1"; entity.MsgType = "0"; bll.Add(entity); XBase.Common.SMSender.SendBatch(entity.ReceiveMobile, entity.Content); } } } } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 得到一个对象实体 /// </summary> public XBase.Model.Personal.MessageBox.MobileMsgMonitor GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,CompanyCD,MsgType,SendUserID,SendUserName,ReceiveUserID,ReceiveUserName,ReceiveMobile,Content,Status,CreateDate,SendDate from officedba.MobileMsgMonitor "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4)}; parameters[0].Value = ID; XBase.Model.Personal.MessageBox.MobileMsgMonitor model = new XBase.Model.Personal.MessageBox.MobileMsgMonitor(); DataTable dt = SqlHelper.ExecuteSql(strSql.ToString(), parameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } model.CompanyCD = ds.Tables[0].Rows[0]["CompanyCD"].ToString(); model.MsgType = ds.Tables[0].Rows[0]["MsgType"].ToString(); if (ds.Tables[0].Rows[0]["SendUserID"].ToString() != "") { model.SendUserID = int.Parse(ds.Tables[0].Rows[0]["SendUserID"].ToString()); } model.SendUserName = ds.Tables[0].Rows[0]["SendUserName"].ToString(); if (ds.Tables[0].Rows[0]["ReceiveUserID"].ToString() != "") { model.ReceiveUserID = int.Parse(ds.Tables[0].Rows[0]["ReceiveUserID"].ToString()); } model.ReceiveUserName = ds.Tables[0].Rows[0]["ReceiveUserName"].ToString(); model.ReceiveMobile = ds.Tables[0].Rows[0]["ReceiveMobile"].ToString(); model.Content = ds.Tables[0].Rows[0]["Content"].ToString(); model.Status = ds.Tables[0].Rows[0]["Status"].ToString(); if (ds.Tables[0].Rows[0]["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString()); } if (ds.Tables[0].Rows[0]["SendDate"].ToString() != "") { model.SendDate = DateTime.Parse(ds.Tables[0].Rows[0]["SendDate"].ToString()); } return model; } else { return null; } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(XBase.Model.Personal.MessageBox.MobileMsgMonitor model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(XBase.Model.Personal.MessageBox.MobileMsgMonitor model) { return(dal.Add(model)); }
public static void SendMobileMsg(string CompanyCD, string FlowNo, int BillTypeFlag, int BillTypeCode, int BillID, string BillNo, int State, int OperateType) { try { DataTable dt = XBase.Business.Common.FlowBus.GetMsgRemindList(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, BillID, State, OperateType); XBase.Business.Personal.MessageBox.MobileMsgMonitor bll = new XBase.Business.Personal.MessageBox.MobileMsgMonitor(); if (dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(dt.Rows[0]["EmployeeID"].ToString()) && !string.IsNullOrEmpty(dt.Rows[0]["Mobile"].ToString())) { if (int.Parse(dt.Rows[0]["MsgCount"].ToString())>0) { XBase.Model.Personal.MessageBox.MobileMsgMonitor entity; entity = new XBase.Model.Personal.MessageBox.MobileMsgMonitor(); entity.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; entity.Content = dt.Rows[0]["MsgContents"].ToString(); entity.CreateDate = DateTime.Now; entity.ReceiveMobile = dt.Rows[0]["Mobile"].ToString(); entity.ReceiveUserID = int.Parse(dt.Rows[0]["EmployeeID"].ToString()); entity.ReceiveUserName = dt.Rows[0]["EmployeeName"].ToString(); entity.SendDate = DateTime.Now; entity.SendUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; entity.SendUserName = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName; entity.Status = "1"; entity.MsgType = "0"; bll.Add(entity); XBase.Common.SMSender.SendBatch(entity.ReceiveMobile, entity.Content); } } } } catch (System.Exception ex) { throw ex; } }