Ejemplo n.º 1
0
        public ActionResult AgentAuditing()
        {
            int userid = string.IsNullOrEmpty(Request["userid"]) ? 0 : int.Parse(Request["userid"]);

            JMP.BLL.CoAgent bll   = new JMP.BLL.CoAgent();
            JMP.MDL.CoAgent model = bll.GetModel(userid);
            //审核状态
            ViewBag.start  = model.AuditState;
            ViewBag.userid = userid;
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult AgentUpdate()
        {
            int id = string.IsNullOrEmpty(Request["id"]) ? 0 : int.Parse(Request["id"]);

            //查询一条数据
            modelAgent = bllAgent.GetModel(id);

            ViewBag.UploadUrl = ConfigurationManager.AppSettings["imgurl"];

            ViewBag.modelAgent = modelAgent;

            return(View());
        }
Ejemplo n.º 3
0
        public JsonResult InsertAgent(JMP.MDL.CoAgent jmpagent)
        {
            object obj = new { success = 0, msg = "添加失败!" };

            JMP.BLL.CoAgent userBll = new JMP.BLL.CoAgent();
            jmpagent.Password = DESEncrypt.Encrypt(jmpagent.Password);
            jmpagent.RoleId   = int.Parse(ConfigurationManager.AppSettings["AgentRoleID"]);
            try
            {
                if (jmpagent.Classify == 0)
                {
                    jmpagent.PersonalPhotoPath = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? "" :  jmpagent.PersonalPhotoPath;
                }
                else
                {
                    jmpagent.BusinessLicensePhotoPath = string.IsNullOrEmpty(jmpagent.BusinessLicensePhotoPath) ? "" :  jmpagent.BusinessLicensePhotoPath;
                    jmpagent.PersonalPhotoPath        = string.IsNullOrEmpty(jmpagent.PersonalPhotoPath) ? " " :  jmpagent.PersonalPhotoPath;
                }

                jmpagent.QQ             = string.IsNullOrEmpty(jmpagent.QQ) ? "" : jmpagent.QQ;
                jmpagent.ContactAddress = string.IsNullOrEmpty(jmpagent.ContactAddress) ? " " : jmpagent.ContactAddress;
                jmpagent.CreatedOn      = DateTime.Now;
                jmpagent.CreatedById    = UserInfo.UserId;
                jmpagent.CreatedByName  = UserInfo.UserName;

                bool flag = false;
                flag = userBll.Add(jmpagent) > 0;
                obj  = new { success = flag ? 1 : 0, msg = flag ? "添加成功!" : "添加失败!" };
                //写日志
                if (flag)
                {
                    Logger.CreateLog("添加代理商", jmpagent);
                }
            }
            catch (Exception ex)
            {
                obj = new { success = 0, msg = "添加异常!" };

                Logger.OperateLog("添加代理商报错", ex.ToString());
            }
            return(Json(obj));
        }
Ejemplo n.º 4
0
        public ActionResult AppUserEdit()
        {
            int userId = !string.IsNullOrEmpty(Request["uid"]) ? int.Parse(Request["uid"]) : 0;

            JMP.BLL.jmp_user bll   = new JMP.BLL.jmp_user();
            JMP.MDL.jmp_user model = bll.GetModel(userId);
            ViewBag.UserData  = model;
            ViewBag.UploadUrl = ConfigurationManager.AppSettings["imgurl"];
            string DisplayName = "";

            //
            switch (model.relation_type)
            {
            case 1:

                co_model = bll_co.GetModel(model.relation_person_id);
                if (co_model != null)
                {
                    DisplayName = co_model.DisplayName;
                }

                break;

            case 2:

                modelAgent = bllAgent.GetModel(model.relation_person_id);

                if (modelAgent != null)
                {
                    DisplayName = modelAgent.DisplayName;
                }
                break;
            }

            ViewBag.DisplayName = DisplayName;

            return(View());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.CoAgent GetModel(string username)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id, CreatedById, CreatedByName, OwnerId, OwnerName, LoginCount, State, BankFullName, BankAccountName, BankAccount, Classify, LoginName, IDCardNumber, PersonalPhotoPath, BusinessLicensePhotoPath, BusinessLicenseNumber, ContactAddress, AuditState, RoleId, ServiceFeeRatioGradeId, Password, DisplayName, EmailAddress, MobilePhone, QQ, Website, CreatedOn  ");
            strSql.Append("  from CoAgent ");
            strSql.Append(" where LoginName=@LoginName");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoginName", SqlDbType.NVarChar, -1)
            };
            parameters[0].Value = username;


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

            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());
                }
                if (ds.Tables[0].Rows[0]["CreatedById"].ToString() != "")
                {
                    model.CreatedById = int.Parse(ds.Tables[0].Rows[0]["CreatedById"].ToString());
                }
                model.CreatedByName = ds.Tables[0].Rows[0]["CreatedByName"].ToString();
                if (ds.Tables[0].Rows[0]["OwnerId"].ToString() != "")
                {
                    model.OwnerId = int.Parse(ds.Tables[0].Rows[0]["OwnerId"].ToString());
                }
                model.OwnerName = ds.Tables[0].Rows[0]["OwnerName"].ToString();
                if (ds.Tables[0].Rows[0]["LoginCount"].ToString() != "")
                {
                    model.LoginCount = int.Parse(ds.Tables[0].Rows[0]["LoginCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["State"].ToString() != "")
                {
                    model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
                }
                model.BankFullName    = ds.Tables[0].Rows[0]["BankFullName"].ToString();
                model.BankAccountName = ds.Tables[0].Rows[0]["BankAccountName"].ToString();
                model.BankAccount     = ds.Tables[0].Rows[0]["BankAccount"].ToString();
                if (ds.Tables[0].Rows[0]["Classify"].ToString() != "")
                {
                    model.Classify = int.Parse(ds.Tables[0].Rows[0]["Classify"].ToString());
                }
                model.LoginName                = ds.Tables[0].Rows[0]["LoginName"].ToString();
                model.IDCardNumber             = ds.Tables[0].Rows[0]["IDCardNumber"].ToString();
                model.PersonalPhotoPath        = ds.Tables[0].Rows[0]["PersonalPhotoPath"].ToString();
                model.BusinessLicensePhotoPath = ds.Tables[0].Rows[0]["BusinessLicensePhotoPath"].ToString();
                model.BusinessLicenseNumber    = ds.Tables[0].Rows[0]["BusinessLicenseNumber"].ToString();
                model.ContactAddress           = ds.Tables[0].Rows[0]["ContactAddress"].ToString();
                if (ds.Tables[0].Rows[0]["AuditState"].ToString() != "")
                {
                    model.AuditState = int.Parse(ds.Tables[0].Rows[0]["AuditState"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RoleId"].ToString() != "")
                {
                    model.RoleId = int.Parse(ds.Tables[0].Rows[0]["RoleId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ServiceFeeRatioGradeId"].ToString() != "")
                {
                    model.ServiceFeeRatioGradeId = int.Parse(ds.Tables[0].Rows[0]["ServiceFeeRatioGradeId"].ToString());
                }
                model.Password     = ds.Tables[0].Rows[0]["Password"].ToString();
                model.DisplayName  = ds.Tables[0].Rows[0]["DisplayName"].ToString();
                model.EmailAddress = ds.Tables[0].Rows[0]["EmailAddress"].ToString();
                model.MobilePhone  = ds.Tables[0].Rows[0]["MobilePhone"].ToString();
                model.QQ           = ds.Tables[0].Rows[0]["QQ"].ToString();
                model.Website      = ds.Tables[0].Rows[0]["Website"].ToString();
                if (ds.Tables[0].Rows[0]["CreatedOn"].ToString() != "")
                {
                    model.CreatedOn = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedOn"].ToString());
                }

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

            strSql.Append("insert into CoAgent(");
            strSql.Append("CreatedById,CreatedByName,OwnerId,OwnerName,LoginCount,State,BankFullName,BankAccountName,BankAccount,Classify,LoginName,IDCardNumber,PersonalPhotoPath,BusinessLicensePhotoPath,BusinessLicenseNumber,ContactAddress,AuditState,RoleId,ServiceFeeRatioGradeId,Password,DisplayName,EmailAddress,MobilePhone,QQ,Website,CreatedOn");
            strSql.Append(") values (");
            strSql.Append("@CreatedById,@CreatedByName,@OwnerId,@OwnerName,@LoginCount,@State,@BankFullName,@BankAccountName,@BankAccount,@Classify,@LoginName,@IDCardNumber,@PersonalPhotoPath,@BusinessLicensePhotoPath,@BusinessLicenseNumber,@ContactAddress,@AuditState,@RoleId,@ServiceFeeRatioGradeId,@Password,@DisplayName,@EmailAddress,@MobilePhone,@QQ,@Website,@CreatedOn");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreatedById",              SqlDbType.Int,        4),
                new SqlParameter("@CreatedByName",            SqlDbType.NVarChar,  50),
                new SqlParameter("@OwnerId",                  SqlDbType.Int,        4),
                new SqlParameter("@OwnerName",                SqlDbType.NVarChar,  50),
                new SqlParameter("@LoginCount",               SqlDbType.Int,        4),
                new SqlParameter("@State",                    SqlDbType.Int,        4),
                new SqlParameter("@BankFullName",             SqlDbType.NVarChar, 255),
                new SqlParameter("@BankAccountName",          SqlDbType.NVarChar, 255),
                new SqlParameter("@BankAccount",              SqlDbType.NVarChar, 255),
                new SqlParameter("@Classify",                 SqlDbType.Int,        4),
                new SqlParameter("@LoginName",                SqlDbType.NVarChar,  50),
                new SqlParameter("@IDCardNumber",             SqlDbType.NVarChar,  30),
                new SqlParameter("@PersonalPhotoPath",        SqlDbType.NVarChar, 255),
                new SqlParameter("@BusinessLicensePhotoPath", SqlDbType.NVarChar, 255),
                new SqlParameter("@BusinessLicenseNumber",    SqlDbType.NVarChar, 255),
                new SqlParameter("@ContactAddress",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@AuditState",               SqlDbType.Int,        4),
                new SqlParameter("@RoleId",                   SqlDbType.Int,        4),
                new SqlParameter("@ServiceFeeRatioGradeId",   SqlDbType.Int,        4),
                new SqlParameter("@Password",                 SqlDbType.NVarChar, 255),
                new SqlParameter("@DisplayName",              SqlDbType.NVarChar,  50),
                new SqlParameter("@EmailAddress",             SqlDbType.NVarChar, 255),
                new SqlParameter("@MobilePhone",              SqlDbType.NVarChar,  20),
                new SqlParameter("@QQ",                       SqlDbType.NVarChar,  15),
                new SqlParameter("@Website",                  SqlDbType.NVarChar, 255),
                new SqlParameter("@CreatedOn",                SqlDbType.DateTime)
            };

            parameters[0].Value  = model.CreatedById;
            parameters[1].Value  = model.CreatedByName;
            parameters[2].Value  = model.OwnerId;
            parameters[3].Value  = model.OwnerName;
            parameters[4].Value  = model.LoginCount;
            parameters[5].Value  = model.State;
            parameters[6].Value  = model.BankFullName;
            parameters[7].Value  = model.BankAccountName;
            parameters[8].Value  = model.BankAccount;
            parameters[9].Value  = model.Classify;
            parameters[10].Value = model.LoginName;
            parameters[11].Value = model.IDCardNumber;
            parameters[12].Value = model.PersonalPhotoPath;
            parameters[13].Value = model.BusinessLicensePhotoPath;
            parameters[14].Value = model.BusinessLicenseNumber;
            parameters[15].Value = model.ContactAddress;
            parameters[16].Value = model.AuditState;
            parameters[17].Value = model.RoleId;
            parameters[18].Value = model.ServiceFeeRatioGradeId;
            parameters[19].Value = model.Password;
            parameters[20].Value = model.DisplayName;
            parameters[21].Value = model.EmailAddress;
            parameters[22].Value = model.MobilePhone;
            parameters[23].Value = model.QQ;
            parameters[24].Value = model.Website;
            parameters[25].Value = model.CreatedOn;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.CoAgent model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CoAgent set ");

            strSql.Append(" CreatedById = @CreatedById , ");
            strSql.Append(" CreatedByName = @CreatedByName , ");
            strSql.Append(" OwnerId = @OwnerId , ");
            strSql.Append(" OwnerName = @OwnerName , ");
            strSql.Append(" LoginCount = @LoginCount , ");
            strSql.Append(" State = @State , ");
            strSql.Append(" BankFullName = @BankFullName , ");
            strSql.Append(" BankAccountName = @BankAccountName , ");
            strSql.Append(" BankAccount = @BankAccount , ");
            strSql.Append(" Classify = @Classify , ");
            strSql.Append(" LoginName = @LoginName , ");
            strSql.Append(" IDCardNumber = @IDCardNumber , ");
            strSql.Append(" PersonalPhotoPath = @PersonalPhotoPath , ");
            strSql.Append(" BusinessLicensePhotoPath = @BusinessLicensePhotoPath , ");
            strSql.Append(" BusinessLicenseNumber = @BusinessLicenseNumber , ");
            strSql.Append(" ContactAddress = @ContactAddress , ");
            strSql.Append(" AuditState = @AuditState , ");
            strSql.Append(" RoleId = @RoleId , ");
            strSql.Append(" ServiceFeeRatioGradeId = @ServiceFeeRatioGradeId , ");
            strSql.Append(" Password = @Password , ");
            strSql.Append(" DisplayName = @DisplayName , ");
            strSql.Append(" EmailAddress = @EmailAddress , ");
            strSql.Append(" MobilePhone = @MobilePhone , ");
            strSql.Append(" QQ = @QQ , ");
            strSql.Append(" Website = @Website , ");
            strSql.Append(" CreatedOn = @CreatedOn  ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",                       SqlDbType.Int,        4),
                new SqlParameter("@CreatedById",              SqlDbType.Int,        4),
                new SqlParameter("@CreatedByName",            SqlDbType.NVarChar,  50),
                new SqlParameter("@OwnerId",                  SqlDbType.Int,        4),
                new SqlParameter("@OwnerName",                SqlDbType.NVarChar,  50),
                new SqlParameter("@LoginCount",               SqlDbType.Int,        4),
                new SqlParameter("@State",                    SqlDbType.Int,        4),
                new SqlParameter("@BankFullName",             SqlDbType.NVarChar, 255),
                new SqlParameter("@BankAccountName",          SqlDbType.NVarChar, 255),
                new SqlParameter("@BankAccount",              SqlDbType.NVarChar, 255),
                new SqlParameter("@Classify",                 SqlDbType.Int,        4),
                new SqlParameter("@LoginName",                SqlDbType.NVarChar,  50),
                new SqlParameter("@IDCardNumber",             SqlDbType.NVarChar,  30),
                new SqlParameter("@PersonalPhotoPath",        SqlDbType.NVarChar, 255),
                new SqlParameter("@BusinessLicensePhotoPath", SqlDbType.NVarChar, 255),
                new SqlParameter("@BusinessLicenseNumber",    SqlDbType.NVarChar, 255),
                new SqlParameter("@ContactAddress",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@AuditState",               SqlDbType.Int,        4),
                new SqlParameter("@RoleId",                   SqlDbType.Int,        4),
                new SqlParameter("@ServiceFeeRatioGradeId",   SqlDbType.Int,        4),
                new SqlParameter("@Password",                 SqlDbType.NVarChar, 255),
                new SqlParameter("@DisplayName",              SqlDbType.NVarChar,  50),
                new SqlParameter("@EmailAddress",             SqlDbType.NVarChar, 255),
                new SqlParameter("@MobilePhone",              SqlDbType.NVarChar,  20),
                new SqlParameter("@QQ",                       SqlDbType.NVarChar,  15),
                new SqlParameter("@Website",                  SqlDbType.NVarChar, 255),
                new SqlParameter("@CreatedOn",                SqlDbType.DateTime)
            };

            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.CreatedById;
            parameters[2].Value  = model.CreatedByName;
            parameters[3].Value  = model.OwnerId;
            parameters[4].Value  = model.OwnerName;
            parameters[5].Value  = model.LoginCount;
            parameters[6].Value  = model.State;
            parameters[7].Value  = model.BankFullName;
            parameters[8].Value  = model.BankAccountName;
            parameters[9].Value  = model.BankAccount;
            parameters[10].Value = model.Classify;
            parameters[11].Value = model.LoginName;
            parameters[12].Value = model.IDCardNumber;
            parameters[13].Value = model.PersonalPhotoPath;
            parameters[14].Value = model.BusinessLicensePhotoPath;
            parameters[15].Value = model.BusinessLicenseNumber;
            parameters[16].Value = model.ContactAddress;
            parameters[17].Value = model.AuditState;
            parameters[18].Value = model.RoleId;
            parameters[19].Value = model.ServiceFeeRatioGradeId;
            parameters[20].Value = model.Password;
            parameters[21].Value = model.DisplayName;
            parameters[22].Value = model.EmailAddress;
            parameters[23].Value = model.MobilePhone;
            parameters[24].Value = model.QQ;
            parameters[25].Value = model.Website;
            parameters[26].Value = model.CreatedOn;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.CoAgent model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.CoAgent model)
 {
     return(dal.Add(model));
 }
Ejemplo n.º 10
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));
        }