Exemplo n.º 1
0
        /// <summary>
        /// 添加经纪人
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="mobile">手机号</param>
        /// <param name="realname">真实姓名</param>
        /// <param name="erpgh">erp工号</param>
        /// <param name="shopid">门店ID</param>
        /// <returns></returns>
        public string Addjjr(string username = null, string password = null, string mobile = null, string realname = null, string erpgh = null, int?shopid = null)
        {
            List <SqlParameter> parms = new List <SqlParameter>()
            {
                new SqlParameter("@username", SqlDbType.VarChar)
                {
                    Value = username
                },
                new SqlParameter("@password", SqlDbType.VarChar)
                {
                    Value = Utils.MD5(password), Size = 50
                },
                new SqlParameter("@mobile", SqlDbType.VarChar)
                {
                    Value = mobile
                },
                new SqlParameter("@realname", SqlDbType.VarChar)
                {
                    Value = realname
                },
                new SqlParameter("@city", SqlDbType.Int)
                {
                    Value = 3
                },
                new SqlParameter("@area", SqlDbType.Int)
                {
                    Value = 0
                },
                new SqlParameter("@addip", SqlDbType.VarChar)
                {
                    Value = ""
                },
                new SqlParameter("@erpgh", SqlDbType.VarChar)
                {
                    Value = erpgh
                },
                new SqlParameter("@deptid", SqlDbType.Int)
                {
                    Value = shopid
                },
                new SqlParameter("@reftotalnum", SqlDbType.Int)
                {
                    Value = 0
                },
                new SqlParameter("@ebtotalnum", SqlDbType.Int)
                {
                    Value = 0
                },
                new SqlParameter("@housetotalnum", SqlDbType.Int)
                {
                    Value = 5
                },
                new SqlParameter("@ismobilelock", SqlDbType.Int)
                {
                    Value = 0
                },

                new SqlParameter("@userid", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                },
                new SqlParameter("@state", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                },
                new SqlParameter("@msg", SqlDbType.VarChar, 200)
                {
                    Direction = ParameterDirection.Output
                }
            };

            try
            {
                DBHelperSQL.ExecuteFunc("user_addbroker_jjr2018", parms);
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new repmsg {
                    state = 2, msg = "提交失败"
                }));
            }

            int    _state = (int)parms.First(p => p.ParameterName == "@state").Value;
            string _msg   = (string)parms.First(p => p.ParameterName == "@msg").Value;

            if (_state == 1)
            {
                int _useid = (int)parms.First(p => p.ParameterName == "@userid").Value;
                //经纪人添加成功后添加年度套餐
                List <SqlParameter> parms1 = new List <SqlParameter>()
                {
                    new SqlParameter("@userid", SqlDbType.Int)
                    {
                        Value = _useid
                    },
                    new SqlParameter("@setid", SqlDbType.Int)
                    {
                        Value = 4
                    },
                    new SqlParameter("@setsnum", SqlDbType.Int)
                    {
                        Value = 1
                    },
                    new SqlParameter("@state", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    },
                    new SqlParameter("@msg", SqlDbType.VarChar, 200)
                    {
                        Direction = ParameterDirection.Output
                    }
                };
                try
                {
                    DBHelperSQL.ExecuteFunc("order_free_jjr2018", parms1);
                    int    state = Convert.ToInt32(parms1.First(p => p.ParameterName == "@state").Value);
                    string msg   = Convert.ToString(parms1.First(p => p.ParameterName == "@msg").Value);
                    SMS.SendSMS_New(mobile, "恭喜您已开通e房网经纪人账号,账号(" + username + "),密码(" + password + ")。登陆地址:http://dwz.cn/rPTLC45W【e房网】");
                    return(JsonConvert.SerializeObject(new repmsg {
                        state = 1, msg = "添加成功"
                    }));
                }
                catch (Exception ex)
                {
                    return(JsonConvert.SerializeObject(new repmsg {
                        state = 2, msg = "添加失败"
                    }));
                }
            }
            else
            {
                return(JsonConvert.SerializeObject(new repmsg {
                    state = 2, msg = _msg
                }));
            }
        }
Exemplo n.º 2
0
 public MSSQLDataAccessHelper(string connectionString)
 {
     dbHelperSQL = new DBHelperSQL(connectionString);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获取行数
        /// </summary>
        /// <param name="tablename"></param>
        /// <param name="strwhere"></param>
        /// <returns></returns>
        private int GetRows(string tablename, string strwhere)
        {
            string strSql = "select count(1) from " + tablename + " where " + strwhere + "";

            return(int.Parse(DBHelperSQL.GetSingle(strSql).ToString()));
        }