public static bool Update(Model.ConsumerInfo entity)
        {
            string sql        = @"UPDATE ConsumerInfo SET NickName=@NickName,Phone=@Phone,[Address]=@Address,PostCode=@PostCode WHERE ID=@ID";
            var    parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter()
            {
                ParameterName = "@ID", Value = entity.ID
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@NickName", Value = entity.NickName
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@Phone", Value = entity.Phone
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@Address", Value = entity.Address
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@PostCode", Value = entity.PostCode
            });
            int i = SqlHelper.ExecuteNonQuery(sql, parameters.ToArray());

            return(i > 0 ? true : false);
        }
        public static string Add(Model.ConsumerInfo entity)
        {
            string sql        = @"INSERT INTO [ConsumerInfo]
                                    (
                                    WeiXinAccount 
                                    ,NickName
                                    ,HeadIcon
                                    ,Address
                                    ,Phone
                                    )
                                VALUES
                                    (
                                    @WeiXinAccount 
                                    ,@NickName
                                    ,@HeadIcon
                                    ,@Address
                                    ,@Phone
                                    );SELECT SCOPE_IDENTITY()";
            var    parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter()
            {
                ParameterName = "@WeiXinAccount", Value = entity.WeiXinAccount
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@NickName", Value = entity.NickName
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@HeadIcon", Value = entity.HeadIcon
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@Address", Value = entity.Address
            });
            parameters.Add(new SqlParameter()
            {
                ParameterName = "@Phone", Value = ""
            });
            try
            {
                return(SqlHelper.ExecuteScalar(sql, parameters.ToArray()).ToString());
            }
            catch
            {
                return("");
            }
        }
 public static bool Update(Model.ConsumerInfo entity)
 {
     return(DAL.ConsumerInfoDal.Update(entity));
 }
 public static string Add(Model.ConsumerInfo entity)
 {
     return(DAL.ConsumerInfoDal.Add(entity));
 }
 private Model.Relationship SelectConvert(Model.Relationship r, Model.ConsumerInfo consumerInfo, Model.ProviderInfo providerIdInfo)
 {
     propertyHelper.SetValue(m => m.ConsumerInfo, r, consumerInfo);
     propertyHelper.SetValue(m => m.Provider, r, providerIdInfo);
     return(r);
 }