示例#1
0
        public bool Add(THumInfo objHumInfo, THumDataInfo objHumDataInfo)
        {
            string   sGuid       = HUtil32.GetGuid();
            string   sAccount    = objHumInfo.sAccount;
            string   sChrName    = objHumInfo.sChrName;
            int      boIsHero    = objHumInfo.boIsHero ? 1 : 0;
            int      boSelected  = objHumInfo.boSelected ? 1 : 0;
            int      nSelectID   = objHumInfo.Header.nSelectID;
            int      boDeleted   = objHumInfo.boDeleted?1:0;
            DateTime dCreateDate = DateTime.FromOADate(objHumInfo.dCreateDate);
            DateTime dModDate    = objHumInfo.dModDate;
            int      btCount     = objHumInfo.btCount;
            DataSet  dsCustom    = new DataSet();

            IDataParameter[] SqlParams = new IDataParameter[] { new System.Data.SqlClient.SqlParameter("@sGuid", sGuid),
                                                                new System.Data.SqlClient.SqlParameter("@sAccount", sAccount),
                                                                new System.Data.SqlClient.SqlParameter("@sChrName", sChrName),
                                                                new System.Data.SqlClient.SqlParameter("@boIsHero", boIsHero),
                                                                new System.Data.SqlClient.SqlParameter("@boSelected", boSelected),
                                                                new System.Data.SqlClient.SqlParameter("@nSelectID", nSelectID),
                                                                new System.Data.SqlClient.SqlParameter("@boDeleted", boDeleted),
                                                                new System.Data.SqlClient.SqlParameter("@dCreateDate", dCreateDate),
                                                                new System.Data.SqlClient.SqlParameter("@dModDate", dModDate),
                                                                new System.Data.SqlClient.SqlParameter("@btCount", btCount), };
            if (!(dbClient.ExecuteProcedure("CreateHumInfo", SqlParams, ref dsCustom) > 0))
            {
                return(false);
            }
            if (!(dbClient.ExecuteSql(string.Format("INSERT INTO HumDataInfo(Guid,btSex,btJob,btHair) VALUES('{0}',{1},{2},{3})", sGuid,
                                                    objHumDataInfo.Data.btSex,
                                                    objHumDataInfo.Data.btJob,
                                                    objHumDataInfo.Data.btHair
                                                    )) > 0))
            {
                return(false);
            }
            return(true);
        }