Example #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CZB.Model.FX_Agent model)
 {
     return(dal.Update(model));
 }
Example #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(CZB.Model.FX_Agent model)
 {
     return(dal.Add(model));
 }
Example #3
0
 /// <summary>
 /// 注册代理商
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool RegisterAgent(CZB.Model.FX_Agent model)
 {
     return(dal.RegisterAgent(model));
 }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CZB.Model.FX_Agent model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into FX_Agent(");
            strSql.Append("TrueName,IDNO,Mobile,UserAccountNumer,Password,OpenId,WXName,FacePic,ProvId,CityId,Address,ParentId,ParentList,AgentLevel,TotalAmout,AvailableAmount,CityCode,CreateTime,IsDelete,IsUse,RoleTypeID,ShareRate,ShareUrl,ComeFrom)");
            strSql.Append(" values (");
            strSql.Append("@TrueName,@IDNO,@Mobile,@UserAccountNumer,@Password,@OpenId,@WXName,@FacePic,@ProvId,@CityId,@Address,@ParentId,@ParentList,@AgentLevel,@TotalAmout,@AvailableAmount,@CityCode,@CreateTime,@IsDelete,@IsUse,@RoleTypeID,@ShareRate,@ShareUrl,@ComeFrom)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TrueName",         SqlDbType.NVarChar,   50),
                new SqlParameter("@IDNO",             SqlDbType.NVarChar,   50),
                new SqlParameter("@Mobile",           SqlDbType.NVarChar,   50),
                new SqlParameter("@UserAccountNumer", SqlDbType.NVarChar,   50),
                new SqlParameter("@Password",         SqlDbType.NVarChar,   50),
                new SqlParameter("@OpenId",           SqlDbType.NVarChar,   50),
                new SqlParameter("@WXName",           SqlDbType.NVarChar,   50),
                new SqlParameter("@FacePic",          SqlDbType.NVarChar,  200),
                new SqlParameter("@ProvId",           SqlDbType.Int,         4),
                new SqlParameter("@CityId",           SqlDbType.Int,         4),
                new SqlParameter("@Address",          SqlDbType.NVarChar,  200),
                new SqlParameter("@ParentId",         SqlDbType.Int,         4),
                new SqlParameter("@ParentList",       SqlDbType.NVarChar,   50),
                new SqlParameter("@AgentLevel",       SqlDbType.Int,         4),
                new SqlParameter("@TotalAmout",       SqlDbType.Decimal,     9),
                new SqlParameter("@AvailableAmount",  SqlDbType.Decimal,     9),
                new SqlParameter("@CityCode",         SqlDbType.NVarChar,   50),
                new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                new SqlParameter("@IsDelete",         SqlDbType.Bit,         1),
                new SqlParameter("@IsUse",            SqlDbType.Bit,         1),
                new SqlParameter("@RoleTypeID",       SqlDbType.Int,         4),
                new SqlParameter("@ShareRate",        SqlDbType.Int,         4),
                new SqlParameter("@ShareUrl",         SqlDbType.NVarChar,  255),
                new SqlParameter("@ComeFrom",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.TrueName;
            parameters[1].Value  = model.IDNO;
            parameters[2].Value  = model.Mobile;
            parameters[3].Value  = model.UserAccountNumer;
            parameters[4].Value  = model.Password;
            parameters[5].Value  = model.OpenId;
            parameters[6].Value  = model.WXName;
            parameters[7].Value  = model.FacePic;
            parameters[8].Value  = model.ProvId;
            parameters[9].Value  = model.CityId;
            parameters[10].Value = model.Address;
            parameters[11].Value = model.ParentId;
            parameters[12].Value = model.ParentList;
            parameters[13].Value = model.AgentLevel;
            parameters[14].Value = model.TotalAmout;
            parameters[15].Value = model.AvailableAmount;
            parameters[16].Value = model.CityCode;
            parameters[17].Value = model.CreateTime;
            parameters[18].Value = model.IsDelete;
            parameters[19].Value = model.IsUse;
            parameters[20].Value = model.RoleTypeID;
            parameters[21].Value = model.ShareRate;
            parameters[22].Value = model.ShareUrl;
            parameters[23].Value = model.ComeFrom;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #5
0
        /// <summary>
        /// 注册代理商
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool RegisterAgent(CZB.Model.FX_Agent model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into FX_Agent(");
                        strSql.Append("TrueName,IDNO,Mobile,UserAccountNumer,Password,OpenId,WXName,FacePic,ProvId,CityId,Address,ParentId,ParentList,AgentLevel,TotalAmout,AvailableAmount,CityCode,CreateTime,IsDelete,IsUse,RoleTypeID,ShareRate)");
                        strSql.Append(" values (");
                        strSql.Append("@TrueName,@IDNO,@Mobile,@UserAccountNumer,@Password,@OpenId,@WXName,@FacePic,@ProvId,@CityId,@Address,@ParentId,@ParentList,@AgentLevel,@TotalAmout,@AvailableAmount,@CityCode,@CreateTime,@IsDelete,@IsUse,@RoleTypeID,@ShareRate)");
                        strSql.Append(";select @@IDENTITY");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@TrueName",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@IDNO",             SqlDbType.NVarChar,   50),
                            new SqlParameter("@Mobile",           SqlDbType.NVarChar,   50),
                            new SqlParameter("@UserAccountNumer", SqlDbType.NVarChar,   50),
                            new SqlParameter("@Password",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@OpenId",           SqlDbType.NVarChar,   50),
                            new SqlParameter("@WXName",           SqlDbType.NVarChar,   50),
                            new SqlParameter("@FacePic",          SqlDbType.NVarChar,  200),
                            new SqlParameter("@ProvId",           SqlDbType.Int,         4),
                            new SqlParameter("@CityId",           SqlDbType.Int,         4),
                            new SqlParameter("@Address",          SqlDbType.NVarChar,  200),
                            new SqlParameter("@ParentId",         SqlDbType.Int,         4),
                            new SqlParameter("@ParentList",       SqlDbType.NVarChar,   50),
                            new SqlParameter("@AgentLevel",       SqlDbType.Int,         4),
                            new SqlParameter("@TotalAmout",       SqlDbType.Decimal,     9),
                            new SqlParameter("@AvailableAmount",  SqlDbType.Decimal,     9),
                            new SqlParameter("@CityCode",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                            new SqlParameter("@IsDelete",         SqlDbType.Bit,         1),
                            new SqlParameter("@IsUse",            SqlDbType.Bit,         1),
                            new SqlParameter("@RoleTypeID",       SqlDbType.Int,         4),
                            new SqlParameter("@ShareRate",        SqlDbType.Int, 4)
                        };
                        parameters[0].Value  = model.TrueName;
                        parameters[1].Value  = model.IDNO;
                        parameters[2].Value  = model.Mobile;
                        parameters[3].Value  = model.UserAccountNumer;
                        parameters[4].Value  = model.Password;
                        parameters[5].Value  = model.OpenId;
                        parameters[6].Value  = model.WXName;
                        parameters[7].Value  = model.FacePic;
                        parameters[8].Value  = model.ProvId;
                        parameters[9].Value  = model.CityId;
                        parameters[10].Value = model.Address;
                        parameters[11].Value = model.ParentId;
                        parameters[12].Value = model.ParentList;
                        parameters[13].Value = model.AgentLevel;
                        parameters[14].Value = model.TotalAmout;
                        parameters[15].Value = model.AvailableAmount;
                        parameters[16].Value = model.CityCode;
                        parameters[17].Value = model.CreateTime;
                        parameters[18].Value = model.IsDelete;
                        parameters[19].Value = model.IsUse;
                        parameters[20].Value = model.RoleTypeID;
                        parameters[21].Value = model.ShareRate;

                        object obj   = DbHelperSQL.GetSingle(conn, trans, strSql.ToString(), parameters);
                        int    addId = 0;
                        if (obj != null)
                        {
                            addId = Convert.ToInt32(obj);
                        }
                        if (addId > 0)
                        {
                            string        parentList   = model.ParentList + addId + ",";
                            StringBuilder strUpdateSql = new StringBuilder();
                            strUpdateSql.Append(" update FX_Agent ");
                            strUpdateSql.Append(" set ParentList = @ParentList ");
                            strUpdateSql.Append(" where AgentId = @AgentId ");

                            SqlParameter[] updateParameters =
                            {
                                new SqlParameter("@ParentList", SqlDbType.VarChar, 50),
                                new SqlParameter("@AgentId",    SqlDbType.Int, 4)
                            };

                            updateParameters[0].Value = parentList;
                            updateParameters[1].Value = addId;
                            DbHelperSQL.ExecuteSql(conn, trans, strUpdateSql.ToString(), updateParameters);
                        }
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CZB.Model.FX_Agent model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update FX_Agent set ");
            strSql.Append("TrueName=@TrueName,");
            strSql.Append("IDNO=@IDNO,");
            strSql.Append("Mobile=@Mobile,");
            strSql.Append("UserAccountNumer=@UserAccountNumer,");
            strSql.Append("Password=@Password,");
            strSql.Append("OpenId=@OpenId,");
            strSql.Append("WXName=@WXName,");
            strSql.Append("FacePic=@FacePic,");
            strSql.Append("ProvId=@ProvId,");
            strSql.Append("CityId=@CityId,");
            strSql.Append("Address=@Address,");
            strSql.Append("ParentId=@ParentId,");
            strSql.Append("ParentList=@ParentList,");
            strSql.Append("AgentLevel=@AgentLevel,");
            strSql.Append("TotalAmout=@TotalAmout,");
            strSql.Append("AvailableAmount=@AvailableAmount,");
            strSql.Append("CityCode=@CityCode,");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("IsDelete=@IsDelete,");
            strSql.Append("IsUse=@IsUse,");
            strSql.Append("RoleTypeID=@RoleTypeID,");
            strSql.Append("ShareRate=@ShareRate,");
            strSql.Append("ShareUrl=@ShareUrl,");
            strSql.Append("ComeFrom=@ComeFrom");
            strSql.Append(" where AgentId=@AgentId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TrueName",         SqlDbType.NVarChar,   50),
                new SqlParameter("@IDNO",             SqlDbType.NVarChar,   50),
                new SqlParameter("@Mobile",           SqlDbType.NVarChar,   50),
                new SqlParameter("@UserAccountNumer", SqlDbType.NVarChar,   50),
                new SqlParameter("@Password",         SqlDbType.NVarChar,   50),
                new SqlParameter("@OpenId",           SqlDbType.NVarChar,   50),
                new SqlParameter("@WXName",           SqlDbType.NVarChar,   50),
                new SqlParameter("@FacePic",          SqlDbType.NVarChar,  200),
                new SqlParameter("@ProvId",           SqlDbType.Int,         4),
                new SqlParameter("@CityId",           SqlDbType.Int,         4),
                new SqlParameter("@Address",          SqlDbType.NVarChar,  200),
                new SqlParameter("@ParentId",         SqlDbType.Int,         4),
                new SqlParameter("@ParentList",       SqlDbType.NVarChar,   50),
                new SqlParameter("@AgentLevel",       SqlDbType.Int,         4),
                new SqlParameter("@TotalAmout",       SqlDbType.Decimal,     9),
                new SqlParameter("@AvailableAmount",  SqlDbType.Decimal,     9),
                new SqlParameter("@CityCode",         SqlDbType.NVarChar,   50),
                new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                new SqlParameter("@IsDelete",         SqlDbType.Bit,         1),
                new SqlParameter("@IsUse",            SqlDbType.Bit,         1),
                new SqlParameter("@RoleTypeID",       SqlDbType.Int,         4),
                new SqlParameter("@ShareRate",        SqlDbType.Int,         4),
                new SqlParameter("@ShareUrl",         SqlDbType.NVarChar,  255),
                new SqlParameter("@ComeFrom",         SqlDbType.Int,         4),
                new SqlParameter("@AgentId",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.TrueName;
            parameters[1].Value  = model.IDNO;
            parameters[2].Value  = model.Mobile;
            parameters[3].Value  = model.UserAccountNumer;
            parameters[4].Value  = model.Password;
            parameters[5].Value  = model.OpenId;
            parameters[6].Value  = model.WXName;
            parameters[7].Value  = model.FacePic;
            parameters[8].Value  = model.ProvId;
            parameters[9].Value  = model.CityId;
            parameters[10].Value = model.Address;
            parameters[11].Value = model.ParentId;
            parameters[12].Value = model.ParentList;
            parameters[13].Value = model.AgentLevel;
            parameters[14].Value = model.TotalAmout;
            parameters[15].Value = model.AvailableAmount;
            parameters[16].Value = model.CityCode;
            parameters[17].Value = model.CreateTime;
            parameters[18].Value = model.IsDelete;
            parameters[19].Value = model.IsUse;
            parameters[20].Value = model.RoleTypeID;
            parameters[21].Value = model.ShareRate;
            parameters[22].Value = model.ShareUrl;
            parameters[23].Value = model.ComeFrom;
            parameters[24].Value = model.AgentId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }