Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCstmr_AppConAddress DataRowToModel(DataRow row)
 {
     IPSP.Model.TCstmr_AppConAddress model = new IPSP.Model.TCstmr_AppConAddress();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_ContactID"] != null && row["n_ContactID"].ToString() != "")
         {
             model.n_ContactID = int.Parse(row["n_ContactID"].ToString());
         }
         if (row["n_Country"] != null && row["n_Country"].ToString() != "")
         {
             model.n_Country = int.Parse(row["n_Country"].ToString());
         }
         if (row["s_State"] != null)
         {
             model.s_State = row["s_State"].ToString();
         }
         if (row["s_City"] != null)
         {
             model.s_City = row["s_City"].ToString();
         }
         if (row["s_Street"] != null)
         {
             model.s_Street = row["s_Street"].ToString();
         }
         if (row["s_ZipCode"] != null)
         {
             model.s_ZipCode = row["s_ZipCode"].ToString();
         }
         if (row["s_Type"] != null)
         {
             model.s_Type = row["s_Type"].ToString();
         }
         if (row["s_Country"] != null)
         {
             model.s_Country = row["s_Country"].ToString();
         }
         if (row["n_Sequence"] != null && row["n_Sequence"].ToString() != "")
         {
             model.n_Sequence = int.Parse(row["n_Sequence"].ToString());
         }
         if (row["s_IsMailingAddress"] != null)
         {
             model.s_IsMailingAddress = row["s_IsMailingAddress"].ToString();
         }
         if (row["s_TitleAddress"] != null)
         {
             model.s_TitleAddress = row["s_TitleAddress"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCstmr_AppConAddress model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCstmr_AppConAddress set ");
            strSql.Append("n_Country=@n_Country,");
            strSql.Append("s_State=@s_State,");
            strSql.Append("s_City=@s_City,");
            strSql.Append("s_Street=@s_Street,");
            strSql.Append("s_ZipCode=@s_ZipCode,");
            strSql.Append("s_Type=@s_Type,");
            strSql.Append("s_Country=@s_Country,");
            strSql.Append("n_Sequence=@n_Sequence,");
            strSql.Append("s_IsMailingAddress=@s_IsMailingAddress,");
            strSql.Append("s_TitleAddress=@s_TitleAddress");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_Country",          SqlDbType.Int,         4),
                new SqlParameter("@s_State",            SqlDbType.NVarChar,  100),
                new SqlParameter("@s_City",             SqlDbType.NVarChar,  100),
                new SqlParameter("@s_Street",           SqlDbType.NVarChar,  300),
                new SqlParameter("@s_ZipCode",          SqlDbType.NVarChar,   50),
                new SqlParameter("@s_Type",             SqlDbType.NVarChar,   10),
                new SqlParameter("@s_Country",          SqlDbType.NVarChar,    5),
                new SqlParameter("@n_Sequence",         SqlDbType.Int,         4),
                new SqlParameter("@s_IsMailingAddress", SqlDbType.NVarChar,    1),
                new SqlParameter("@s_TitleAddress",     SqlDbType.NVarChar, 1000),
                new SqlParameter("@n_ID",               SqlDbType.Int,         4),
                new SqlParameter("@n_ContactID",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.n_Country;
            parameters[1].Value  = model.s_State;
            parameters[2].Value  = model.s_City;
            parameters[3].Value  = model.s_Street;
            parameters[4].Value  = model.s_ZipCode;
            parameters[5].Value  = model.s_Type;
            parameters[6].Value  = model.s_Country;
            parameters[7].Value  = model.n_Sequence;
            parameters[8].Value  = model.s_IsMailingAddress;
            parameters[9].Value  = model.s_TitleAddress;
            parameters[10].Value = model.n_ID;
            parameters[11].Value = model.n_ContactID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCstmr_AppConAddress model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCstmr_AppConAddress(");
            strSql.Append("n_ContactID,n_Country,s_State,s_City,s_Street,s_ZipCode,s_Type,s_Country,n_Sequence,s_IsMailingAddress,s_TitleAddress)");
            strSql.Append(" values (");
            strSql.Append("@n_ContactID,@n_Country,@s_State,@s_City,@s_Street,@s_ZipCode,@s_Type,@s_Country,@n_Sequence,@s_IsMailingAddress,@s_TitleAddress)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ContactID",        SqlDbType.Int,        4),
                new SqlParameter("@n_Country",          SqlDbType.Int,        4),
                new SqlParameter("@s_State",            SqlDbType.NVarChar, 100),
                new SqlParameter("@s_City",             SqlDbType.NVarChar, 100),
                new SqlParameter("@s_Street",           SqlDbType.NVarChar, 300),
                new SqlParameter("@s_ZipCode",          SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Type",             SqlDbType.NVarChar,  10),
                new SqlParameter("@s_Country",          SqlDbType.NVarChar,   5),
                new SqlParameter("@n_Sequence",         SqlDbType.Int,        4),
                new SqlParameter("@s_IsMailingAddress", SqlDbType.NVarChar,   1),
                new SqlParameter("@s_TitleAddress",     SqlDbType.NVarChar, 1000)
            };
            parameters[0].Value  = model.n_ContactID;
            parameters[1].Value  = model.n_Country;
            parameters[2].Value  = model.s_State;
            parameters[3].Value  = model.s_City;
            parameters[4].Value  = model.s_Street;
            parameters[5].Value  = model.s_ZipCode;
            parameters[6].Value  = model.s_Type;
            parameters[7].Value  = model.s_Country;
            parameters[8].Value  = model.n_Sequence;
            parameters[9].Value  = model.s_IsMailingAddress;
            parameters[10].Value = model.s_TitleAddress;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCstmr_AppConAddress GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_ContactID,n_Country,s_State,s_City,s_Street,s_ZipCode,s_Type,s_Country,n_Sequence,s_IsMailingAddress,s_TitleAddress from TCstmr_AppConAddress ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

            IPSP.Model.TCstmr_AppConAddress model = new IPSP.Model.TCstmr_AppConAddress();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TCstmr_AppConAddress model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TCstmr_AppConAddress model)
 {
     return(dal.Add(model));
 }