예제 #1
0
        /// <summary>
        /// 增加客户信息
        /// </summary>
        /// <param name="info">客户信息</param>
        /// <returns>客户编号</returns>
        public string AddGuestInfo(GuestInfo info)
        {
            string sql     = string.Format(@"INSERT [dbo].[GuestInfo]([Name], [CardNo], [Phone], [Sex])
                VALUES ('{0}','{1}','{2}','{3}')
                SELECT @@IDENTITY", info.Name, info.CardNo, info.Phone, info.Sex);
            string guestId = DBHerper.Scalar(sql).ToString();

            return(guestId);
        }
예제 #2
0
        /// <summary>
        /// 修改客户信息
        /// </summary>
        /// <param name="info">客户信息</param>
        /// <returns>客户编号</returns>
        public string UpdateGuestInfo(GuestInfo info)
        {
            string sql     = string.Format(@"UPDATE [dbo].[GuestInfo]
                SET [Name]='{0}',[Phone]='{1}',[Sex]='{2}'
                WHERE [CardNo]='{3}'
                SELECT [ID]
                FROM [dbo].[GuestInfo]
                WHERE [CardNo]='{3}'", info.Name, info.Phone, info.Sex, info.CardNo);
            string guestId = DBHerper.Scalar(sql).ToString();

            return(guestId);
        }