Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_message GetModel(int m_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select m_id, m_sender, m_receiver, m_type, m_time, m_state, m_content, m_topid  ");
            strSql.Append("  from jmp_message ");
            strSql.Append(" where m_id=@m_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = m_id;


            JMP.MDL.jmp_message model = new JMP.MDL.jmp_message();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["m_id"].ToString() != "")
                {
                    model.m_id = int.Parse(ds.Tables[0].Rows[0]["m_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_sender"].ToString() != "")
                {
                    model.m_sender = int.Parse(ds.Tables[0].Rows[0]["m_sender"].ToString());
                }
                model.m_receiver = ds.Tables[0].Rows[0]["m_receiver"].ToString();
                if (ds.Tables[0].Rows[0]["m_type"].ToString() != "")
                {
                    model.m_type = int.Parse(ds.Tables[0].Rows[0]["m_type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_time"].ToString() != "")
                {
                    model.m_time = DateTime.Parse(ds.Tables[0].Rows[0]["m_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_state"].ToString() != "")
                {
                    model.m_state = int.Parse(ds.Tables[0].Rows[0]["m_state"].ToString());
                }
                model.m_content = ds.Tables[0].Rows[0]["m_content"].ToString();
                if (ds.Tables[0].Rows[0]["m_topid"].ToString() != "")
                {
                    model.m_topid = int.Parse(ds.Tables[0].Rows[0]["m_topid"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加或修改消息
        /// </summary>
        /// <param name="mo"></param>
        /// <returns></returns>
        public JsonResult InserOrUpdatemessage(JMP.MDL.jmp_message mo)
        {
            object retJson = new { success = 0, msg = "操作失败" };

            mo.m_sender = UserInfo.UserId;
            JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message();
            string[]            sta   = Request["m_receiver"].Split(',');
            if (mo.m_id > 0)
            {
                JMP.MDL.jmp_message mod = mebll.GetModel(mo.m_id);
                var modClone            = mod.Clone();
                mod.m_receiver = mo.m_receiver;
                mod.m_content  = mo.m_content;
                //mo.m_state = mod.m_state;
                //mo.m_type = mod.m_type;
                //mo.m_time = mod.m_time;
                string sm = "";//日志说明
                if (mebll.Update(mod))
                {
                    Logger.ModifyLog("修改消息", modClone, mo);
                    retJson = new { success = 1, msg = "修改成功" };
                }
                else
                {
                    retJson = new { success = 0, msg = "修改失败" };
                }
            }
            else
            {
                mo.m_time  = DateTime.Now;
                mo.m_state = 0;
                mo.m_type  = 1;
                StringBuilder strSql = new StringBuilder();
                for (int i = 0; i < sta.Length; i++)
                {
                    strSql.Append("insert into jmp_message(m_sender,m_receiver,m_type,m_time,m_state,m_content,m_topid) values ('" + mo.m_sender + "','" + sta[i] + "','1','" + DateTime.Now + "','0','" + mo.m_content + "','0') ");
                }
                int cg = mebll.AdminAdd(strSql);
                if (cg > 0)
                {
                    Logger.CreateLog("发送消息", mo);
                    retJson = new { success = 1, msg = "发送成功" };
                }
                else
                {
                    retJson = new { success = 0, msg = "发送失败" };
                }
            }
            return(Json(retJson));
        }
Exemplo n.º 3
0
        public ActionResult message()
        {
            int m_id = string.IsNullOrEmpty(Request["m_id"]) ? 0 : Int32.Parse(Request["m_id"]);

            JMP.MDL.jmp_message mo    = new JMP.MDL.jmp_message();
            JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message();
            string type = string.IsNullOrEmpty(Request["type"]) ? "dd" : Request["type"];

            if (m_id > 0)
            {
                mo = mebll.GetModel(m_id);
            }
            ViewBag.type = type;
            ViewBag.mo   = mo;
            return(View());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.jmp_message model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_message set ");

            strSql.Append(" m_sender = @m_sender , ");
            strSql.Append(" m_receiver = @m_receiver , ");
            strSql.Append(" m_type = @m_type , ");
            strSql.Append(" m_time = @m_time , ");
            strSql.Append(" m_state = @m_state , ");
            strSql.Append(" m_content = @m_content , ");
            strSql.Append(" m_topid = @m_topid  ");
            strSql.Append(" where m_id=@m_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id",       SqlDbType.Int,        4),
                new SqlParameter("@m_sender",   SqlDbType.Int,        4),
                new SqlParameter("@m_receiver", SqlDbType.NVarChar,  -1),
                new SqlParameter("@m_type",     SqlDbType.Int,        4),
                new SqlParameter("@m_time",     SqlDbType.DateTime),
                new SqlParameter("@m_state",    SqlDbType.Int,        4),
                new SqlParameter("@m_content",  SqlDbType.NVarChar,  -1),
                new SqlParameter("@m_topid",    SqlDbType.Int, 4)
            };

            parameters[0].Value = model.m_id;
            parameters[1].Value = model.m_sender;
            parameters[2].Value = model.m_receiver;
            parameters[3].Value = model.m_type;
            parameters[4].Value = model.m_time;
            parameters[5].Value = model.m_state;
            parameters[6].Value = model.m_content;
            parameters[7].Value = model.m_topid;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JMP.MDL.jmp_message> DataTableToList(DataTable dt)
        {
            List <JMP.MDL.jmp_message> modelList = new List <JMP.MDL.jmp_message>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JMP.MDL.jmp_message model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JMP.MDL.jmp_message();
                    if (dt.Rows[n]["m_id"].ToString() != "")
                    {
                        model.m_id = int.Parse(dt.Rows[n]["m_id"].ToString());
                    }
                    if (dt.Rows[n]["m_sender"].ToString() != "")
                    {
                        model.m_sender = int.Parse(dt.Rows[n]["m_sender"].ToString());
                    }
                    model.m_receiver = dt.Rows[n]["m_receiver"].ToString();
                    if (dt.Rows[n]["m_type"].ToString() != "")
                    {
                        model.m_type = int.Parse(dt.Rows[n]["m_type"].ToString());
                    }
                    if (dt.Rows[n]["m_time"].ToString() != "")
                    {
                        model.m_time = DateTime.Parse(dt.Rows[n]["m_time"].ToString());
                    }
                    if (dt.Rows[n]["m_state"].ToString() != "")
                    {
                        model.m_state = int.Parse(dt.Rows[n]["m_state"].ToString());
                    }
                    model.m_content = dt.Rows[n]["m_content"].ToString();
                    if (dt.Rows[n]["m_topid"].ToString() != "")
                    {
                        model.m_topid = int.Parse(dt.Rows[n]["m_topid"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JMP.MDL.jmp_message model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_message(");
            strSql.Append("m_sender,m_receiver,m_type,m_time,m_state,m_content,m_topid");
            strSql.Append(") values (");
            strSql.Append("@m_sender,@m_receiver,@m_type,@m_time,@m_state,@m_content,@m_topid");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@m_sender",   SqlDbType.Int,        4),
                new SqlParameter("@m_receiver", SqlDbType.NVarChar,  -1),
                new SqlParameter("@m_type",     SqlDbType.Int,        4),
                new SqlParameter("@m_time",     SqlDbType.DateTime),
                new SqlParameter("@m_state",    SqlDbType.Int,        4),
                new SqlParameter("@m_content",  SqlDbType.NVarChar,  -1),
                new SqlParameter("@m_topid",    SqlDbType.Int, 4)
            };

            parameters[0].Value = model.m_sender;
            parameters[1].Value = model.m_receiver;
            parameters[2].Value = model.m_type;
            parameters[3].Value = model.m_time;
            parameters[4].Value = model.m_state;
            parameters[5].Value = model.m_content;
            parameters[6].Value = model.m_topid;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 消息回复
        /// </summary>
        /// <returns></returns>
        public JsonResult ReplyMessageUser(JMP.MDL.jmp_message mo)
        {
            object retJson = new { success = 0, msg = "操作失败" };

            mo.m_time   = DateTime.Now;
            mo.m_state  = 0;
            mo.m_type   = 3;
            mo.m_sender = UserInfo.UserId;
            JMP.BLL.jmp_message mebll = new JMP.BLL.jmp_message();
            int cg = mebll.Add(mo);

            if (cg > 0)
            {
                Logger.OperateLog("回复消息", mo.m_content);
                retJson = new { success = 1, msg = "发送成功" };
            }
            else
            {
                retJson = new { success = 0, msg = "发送失败" };
            }
            return(Json(retJson));
        }
Exemplo n.º 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.jmp_message model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.jmp_message model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 10
0
        public JsonResult UpdateUser(JMP.MDL.jmp_user jmpuser)
        {
            object obj = new { success = 0, msg = "更新失败!" };

            JMP.BLL.jmp_user userBll = new JMP.BLL.jmp_user();
            JMP.MDL.jmp_user oldUser = userBll.GetModel(jmpuser.u_id);
            var oldUserColne         = oldUser.Clone();

            oldUser.u_category         = jmpuser.u_category;//类别
            oldUser.u_email            = jmpuser.u_email;
            oldUser.u_realname         = jmpuser.u_realname;
            oldUser.u_password         = DESEncrypt.Encrypt(jmpuser.u_password);
            oldUser.u_phone            = jmpuser.u_phone;
            oldUser.u_qq               = jmpuser.u_qq;
            oldUser.u_address          = jmpuser.u_address;
            oldUser.u_account          = jmpuser.u_account;
            oldUser.u_name             = jmpuser.u_name;
            oldUser.u_bankname         = jmpuser.u_bankname;
            oldUser.u_idnumber         = jmpuser.u_idnumber;
            oldUser.FrozenMoney        = jmpuser.FrozenMoney;
            oldUser.BusinessEntity     = jmpuser.BusinessEntity;
            oldUser.RegisteredAddress  = jmpuser.RegisteredAddress;
            oldUser.relation_type      = jmpuser.relation_type;
            oldUser.relation_person_id = jmpuser.relation_person_id;
            oldUser.u_photof           = string.IsNullOrEmpty(jmpuser.u_photof) ? "" : jmpuser.u_photof;
            oldUser.u_licence          = string.IsNullOrEmpty(jmpuser.u_licence) ? "" : jmpuser.u_licence;
            try
            {
                if (oldUser.u_category == 0)
                {
                    oldUser.u_photo = string.IsNullOrEmpty(jmpuser.u_photo) ? "" : jmpuser.u_photo;
                }
                else
                {
                    oldUser.u_blicense       = string.IsNullOrEmpty(jmpuser.u_blicense) ? "" : jmpuser.u_blicense;
                    oldUser.u_photo          = string.IsNullOrEmpty(jmpuser.u_photo) ? " " : jmpuser.u_photo;
                    oldUser.u_blicensenumber = jmpuser.u_blicensenumber;
                }
                if (string.IsNullOrEmpty(oldUser.u_qq))
                {
                    oldUser.u_qq = " ";
                }
                if (string.IsNullOrEmpty(oldUser.u_address))
                {
                    oldUser.u_address = " ";
                }
                bool flag = userBll.Update(oldUser);
                obj = new { success = flag ? 1 : 0, msg = flag ? "更新成功!" : "更新失败!" };
                //写日志
                if (flag)
                {
                    Logger.ModifyLog("修改开发者", oldUserColne, jmpuser);
                    //审核状态改变是发送私信和邮件给用户
                    if (jmpuser.u_auditstate != oldUserColne.u_auditstate)
                    {
                        JMP.BLL.jmp_message messbll = new JMP.BLL.jmp_message();
                        JMP.MDL.jmp_message j_mess  = new JMP.MDL.jmp_message();
                        string tipmsg = string.Empty;
                        #region 组装私信实体
                        j_mess.m_sender   = UserInfo.UserId;
                        j_mess.m_receiver = oldUser.u_id.ToString();
                        j_mess.m_type     = 1;
                        j_mess.m_time     = DateTime.Now;
                        j_mess.m_state    = 0;
                        switch (jmpuser.u_auditstate)
                        {
                        case -1:
                            tipmsg = "你的账号审核未通过!";
                            break;

                        case 0:
                            tipmsg = "你的账号正在审核中,如有疑问请联系我们!";
                            break;

                        case 1:
                            tipmsg = "你的账号审核通过!";
                            break;
                        }
                        j_mess.m_content = tipmsg;
                        j_mess.m_topid   = oldUser.u_topid;
                        #endregion
                        //发送私信
                        if (jmpuser.u_auditstate == 1)
                        {
                            //更改审核状态为通过时,才发送私信
                            int record = messbll.Add(j_mess);
                            if (record > 0)
                            {
                                Logger.CreateLog("发送私信给用户", j_mess);
                            }
                        }
                        #region 发送邮件
                        //StringBuilder MailContent = new StringBuilder();
                        //MailContent.Append("亲爱的开发者:<br/>");
                        //MailContent.Append("&nbsp;&nbsp;&nbsp;&nbsp;您好!" + tipmsg);
                        //MailContent.Append("&nbsp;&nbsp;&nbsp;&nbsp;如果你没有用该邮件账号注册过聚米支付平台的账号,请忽视本邮件!");
                        //MailContent.Append("亲爱的开发者:<br/>");
                        //bool isSend = MailHelper.SendText("*****@*****.**", "聚米网络科技", jmpuser.u_email, "重置密码", MailContent.ToString(), "smtp.adjumi.com", "*****@*****.**", "");
                        //if (isSend)
                        //{
                        //    string tmsg = string.Format("用户{0}({1})发送邮件至用户邮箱{2},邮件内容为:{3}", UserInfo.UserName, UserInfo.UserId, jmpuser.u_email, tipmsg);
                        //    AddLocLog.AddLog(int.Parse(UserInfo.UserId), 3, RequestHelper.GetClientIp(), "发送邮件给用户" + jmpuser.u_id, tmsg);
                        //}
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.OperateLog("修改开发者报错" + jmpuser.u_id, ex.ToString());
                obj = new { success = 0, msg = "更新出错了!" };
            }
            return(Json(obj));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 修改代理商
        /// </summary>
        /// <returns></returns>
        public JsonResult UpdateAgents(JMP.MDL.CoAgent jmpagent)
        {
            object obj = new { success = 0, msg = "更新失败!" };

            JMP.BLL.CoAgent userBll      = new JMP.BLL.CoAgent();
            JMP.MDL.CoAgent oldUser      = userBll.GetModel(jmpagent.Id);
            var             oldUserClone = oldUser.Clone();

            oldUser.Classify              = jmpagent.Classify;
            oldUser.OwnerId               = jmpagent.OwnerId;
            oldUser.OwnerName             = jmpagent.OwnerName;
            oldUser.LoginName             = jmpagent.LoginName;
            oldUser.Password              = DESEncrypt.Encrypt(jmpagent.Password);
            oldUser.DisplayName           = jmpagent.DisplayName;
            oldUser.EmailAddress          = jmpagent.EmailAddress;
            oldUser.MobilePhone           = jmpagent.MobilePhone;
            oldUser.QQ                    = jmpagent.QQ;
            oldUser.Website               = jmpagent.Website;
            oldUser.ContactAddress        = jmpagent.ContactAddress;
            oldUser.IDCardNumber          = jmpagent.IDCardNumber;
            oldUser.BusinessLicenseNumber = jmpagent.BusinessLicenseNumber;
            oldUser.BankAccount           = jmpagent.BankAccount;
            oldUser.BankAccountName       = jmpagent.BankAccountName;
            oldUser.BankFullName          = jmpagent.BankFullName;

            try
            {
                if (oldUser.Classify == 0)
                {
                    oldUser.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? "" : jmpagent.PersonalPhotoPath;
                }
                else
                {
                    oldUser.BusinessLicensePhotoPath = string.IsNullOrEmpty(jmpagent.BusinessLicensePhotoPath) ? "" : jmpagent.BusinessLicensePhotoPath;
                    oldUser.PersonalPhotoPath        = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? " " : jmpagent.PersonalPhotoPath;
                }


                if (string.IsNullOrEmpty(jmpagent.QQ))
                {
                    oldUser.QQ = " ";
                }
                if (string.IsNullOrEmpty(jmpagent.ContactAddress))
                {
                    oldUser.ContactAddress = " ";
                }
                bool flag = userBll.Update(oldUser);
                obj = new { success = flag ? 1 : 0, msg = flag ? "更新成功!" : "更新失败!" };
                //写日志
                if (flag)
                {
                    Logger.ModifyLog("修改代理商", oldUserClone, jmpagent);

                    //审核状态改变是发送私信和邮件给用户
                    if (jmpagent.AuditState != oldUserClone.AuditState)
                    {
                        JMP.BLL.jmp_message messbll = new JMP.BLL.jmp_message();
                        JMP.MDL.jmp_message j_mess  = new JMP.MDL.jmp_message();
                        string tipmsg = string.Empty;
                        #region 组装私信实体
                        j_mess.m_sender   = UserInfo.UserId;
                        j_mess.m_receiver = oldUser.Id.ToString();
                        j_mess.m_type     = 1;
                        j_mess.m_time     = DateTime.Now;
                        j_mess.m_state    = 0;
                        switch (jmpagent.AuditState)
                        {
                        case -1:
                            tipmsg = "你的账号审核未通过!";
                            break;

                        case 0:
                            tipmsg = "你的账号正在审核中,如有疑问请联系我们!";
                            break;

                        case 1:
                            tipmsg = "你的账号审核通过!";
                            break;
                        }
                        j_mess.m_content = tipmsg;
                        #endregion
                        //发送私信
                        if (jmpagent.AuditState == 1)
                        {
                            //更改审核状态为通过时,才发送私信
                            int record = messbll.Add(j_mess);
                            if (record > 0)
                            {
                                Logger.CreateLog("发送私信给用户", j_mess);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.OperateLog("修改代理商报错" + jmpagent.Id, ex.ToString());
                obj = new { success = 0, msg = "更新出错了!" };
            }
            return(Json(obj));
        }