public DbHelperSql GetDbHelperSql(EnumDbName dbName)
 {
     var val = _ht[dbName];
     if (val == null)
     {
         lock (LockObject)
         {
             val = _ht[dbName];
             if (val == null)
             {
                 var name = dbName.ToString("G");
                 var readerConn = ConncetionReader(name);
                 var writerConn = GetConncetionWriter(name);
                 val = new DbHelperSql(readerConn,writerConn);
                 _ht[dbName] = val;
             }
         }
     }
     return (DbHelperSql)val;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.ID desc");
            }
            strSql.Append(")AS Row, T.*  from SystemRole T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return(DbHelperSql.Query(strSql.ToString()));
        }
Exemplo n.º 3
0
        public IEnumerable <Movie> ToList()
        {
            using (var conn = new SqlConnection(_ConnectionString))
            {
                conn.Open();
                var helper = new DbHelperSql(conn);

                string sql  = @"
select  ID, Genre, Price, ReleaseDate, Title
from    Movie
";
                var    dt   = helper.ExecDataTableSql(sql);
                var    list = dt.AsEnumerable().Select(dr => new Movie()
                {
                    Id          = (int)dr["ID"],
                    Genre       = (string)dr["Genre"],
                    Price       = (decimal)dr["Price"],
                    ReleaseDate = (DateTime)dr["ReleaseDate"],
                    Title       = (string)dr["Title"],
                });
                return(list);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(Guid LeavemessageUUID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Leavemessage ");
            strSql.Append(" where LeavemessageUUID=@LeavemessageUUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LeavemessageUUID", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = LeavemessageUUID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from SystemRole ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Teacher ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(Guid BuildingUuid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from xf_Building ");
            strSql.Append(" where BuildingUuid=@BuildingUuid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuildingUuid", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = BuildingUuid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HeqiaoDaoshiCore.Model.ActiveQuantity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ActiveQuantity set ");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("Num=@Num,");
            strSql.Append("Type=@Type");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime",         SqlDbType.DateTime),
                new SqlParameter("@AddTime",            SqlDbType.NVarChar,        50),
                new SqlParameter("@Num",                SqlDbType.Int,              4),
                new SqlParameter("@Type",               SqlDbType.Int,              4),
                new SqlParameter("@ID",                 SqlDbType.Int,              4),
                new SqlParameter("@ActiveQuantityUUID", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.CreateTime;
            parameters[1].Value = model.AddTime;
            parameters[2].Value = model.Num;
            parameters[3].Value = model.Type;
            parameters[4].Value = model.ID;
            parameters[5].Value = model.ActiveQuantityUUID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        //

        public bool UpdateById(Person model, Int32 id)
        {
            model.Id = id;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [Person] set ");
            if (model.@Username != null)
            {
                strSql.Append("username=@Username,");
            }
            if (model.@Password != null)
            {
                strSql.Append("password=@Password,");
            }
            if (model.@Age != null)
            {
                strSql.Append("age=@Age,");
            }
            if (model.@RegisterDate != null)
            {
                strSql.Append("registerDate=@RegisterDate,");
            }
            if (model.@Address != null)
            {
                strSql.Append("address=@Address,");
            }
            int n = strSql.ToString().LastIndexOf(",", StringComparison.Ordinal);

            if (n > 0)
            {
                strSql.Remove(n, 1);
            }
            strSql.Append(" where  id=@id  ");
            var flag = DbHelperSql.Update(strSql.ToString(), model);

            return(flag);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HeqiaoDaoshiCore.Model.Leavemessage model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Leavemessage set ");
            strSql.Append("UserUUID=@UserUUID,");
            strSql.Append("Content=@Content,");
            strSql.Append("Createtime=@Createtime,");
            strSql.Append("Isdelete=@Isdelete");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserUUID",         SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@Content",          SqlDbType.NVarChar,         255),
                new SqlParameter("@Createtime",       SqlDbType.NVarChar,         255),
                new SqlParameter("@Isdelete",         SqlDbType.VarChar,          255),
                new SqlParameter("@LeavemessageUUID", SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@ID",               SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UserUUID;
            parameters[1].Value = model.Content;
            parameters[2].Value = model.Createtime;
            parameters[3].Value = model.Isdelete;
            parameters[4].Value = model.LeavemessageUUID;
            parameters[5].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HeqiaoDaoshiCore.Model.Mark model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Mark set ");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("MarkName=@MarkName,");
            strSql.Append("MarkPicture=@MarkPicture,");
            strSql.Append("IsDelete=@IsDelete");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime",  SqlDbType.DateTime),
                new SqlParameter("@MarkName",    SqlDbType.NVarChar,          50),
                new SqlParameter("@MarkPicture", SqlDbType.NVarChar,         100),
                new SqlParameter("@IsDelete",    SqlDbType.Int,                4),
                new SqlParameter("@ID",          SqlDbType.Int,                4),
                new SqlParameter("@MarkUUID",    SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = model.CreateTime;
            parameters[1].Value = model.MarkName;
            parameters[2].Value = model.MarkPicture;
            parameters[3].Value = model.IsDelete;
            parameters[4].Value = model.ID;
            parameters[5].Value = model.MarkUUID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ClassLibrary1.Model.TcqType GetModel(Guid Tcqguid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Tcqguid,Tcqid,TcqName from TcqType ");
            strSql.Append(" where Tcqguid=@Tcqguid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tcqguid", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = Tcqguid;

            ClassLibrary1.Model.TcqType model = new ClassLibrary1.Model.TcqType();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.Information GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,InformationUUID,Title,InformationTypeUUID,Introduce,Address,StartTime,Picture,State,IsDeleted,Photo from Information ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.Information model = new HeqiaoDaoshiCore.Model.Information();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(HeqiaoDaoshiCore.Model.News model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into News(");
            strSql.Append("CreateTime,NewsUUID,Title,NewsContent,IsDelete,ReleaseState)");
            strSql.Append(" values (");
            strSql.Append("@CreateTime,@NewsUUID,@Title,@NewsContent,@IsDelete,@ReleaseState)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@NewsUUID",     SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@Title",        SqlDbType.NVarChar,         50),
                new SqlParameter("@NewsContent",  SqlDbType.NVarChar,         -1),
                new SqlParameter("@IsDelete",     SqlDbType.Int,               4),
                new SqlParameter("@ReleaseState", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.CreateTime;
            parameters[1].Value = Guid.NewGuid();
            parameters[2].Value = model.Title;
            parameters[3].Value = model.NewsContent;
            parameters[4].Value = model.IsDelete;
            parameters[5].Value = model.ReleaseState;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public big_data.Model.Userinfoty GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UserInfoUUID,ID,IsDeleted,AddTime,AddPeople,RealName,UserIdCard,Wechat,Phone,Email,Sex,Address,DepartmentUUID,Birth,IdentityCard,Residence,Domicile,Nation,Education,QianYiSTime,QianYiETime,Settled,Occupation,DyStaues,Politics,position,Evaluate,OrganizationUuid,JoinArmy,ArmyTime,SettledTime,TownUuid,Defense,Category,Partybranch,JoinDate,Work,Age,Household,Relation,HouseholderName from Userinfoty ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            big_data.Model.Userinfoty model = new big_data.Model.Userinfoty();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ClassLibrary1.Model.Teacher GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,TeacherUuid,Name,Sex,Gh,DepartmentUuid,YiCard,DormitoryUuid,Picture,DormitoryNumUuid,Phone,IdCard,Email,Nation,Political,Religion,IsDeleted,AddTime,AddPeople,SchoolDistrictUuid,ProfessionalTitle from Teacher ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            ClassLibrary1.Model.Teacher model = new ClassLibrary1.Model.Teacher();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ClassLibrary1.Model.YiCardLSXX GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,YicardUuid,YicardName,Possessor,ConsumType,ExpenseCal,Balance,IsDeleted,AddTime,AddPeople,ConsumTime,Address,SiteName,DepName from YiCardLSXX ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            ClassLibrary1.Model.YiCardLSXX model = new ClassLibrary1.Model.YiCardLSXX();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.Mapmark GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,MapmarkUUID,MarkUUID,Position,IsDelete,Introduce from Mapmark ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.Mapmark model = new HeqiaoDaoshiCore.Model.Mapmark();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ClassLibrary1.Model.Department GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,DepartmentUuid,DepartmentName,ResPeople,Phone,IsDeleted,AddTime,AddPeople from Department ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            ClassLibrary1.Model.Department model = new ClassLibrary1.Model.Department();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Haikan.SchoolProjectsCore.MDB.Model.HFile model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into HFile(");
            strSql.Append("EnterpriseName,EnterpriseFile,ContractFile,InvoiceFile,ProjectFile,IsDele)");
            strSql.Append(" values (");
            strSql.Append("@EnterpriseName,@EnterpriseFile,@ContractFile,@InvoiceFile,@ProjectFile,@IsDele)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EnterpriseName", SqlDbType.VarChar, 255),
                new SqlParameter("@EnterpriseFile", SqlDbType.VarChar, 255),
                new SqlParameter("@ContractFile",   SqlDbType.VarChar, 255),
                new SqlParameter("@InvoiceFile",    SqlDbType.VarChar, 255),
                new SqlParameter("@ProjectFile",    SqlDbType.VarChar, 255),
                new SqlParameter("@IsDele",         SqlDbType.VarChar, 255)
            };
            parameters[0].Value = model.EnterpriseName;
            parameters[1].Value = model.EnterpriseFile;
            parameters[2].Value = model.ContractFile;
            parameters[3].Value = model.InvoiceFile;
            parameters[4].Value = model.ProjectFile;
            parameters[5].Value = model.IsDele;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public big_data.Model.UnifiedAddressLibrary GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UnifiedAddressLibraryUUID,ID,oid,SOURCEADDRESS,CITY,COUNTY,TOWN,COMMUNITY,SQUAD,VILLAGE,SZONE,STREET,DOOR,RESREGION,BUILDING,BUILDING_NUM,UNIT,FLOOR,ROOM,GRID_CODE,BUILDING_CODE,HOUSE_CODE,CODE,CREATETIME,UPDATETIME,ISVALID,FROM_STATUS,TO_STATUS,BUILDING_PATH,DATASOURCE,REVERSE1,REVERSE2,LON,LAT,Z,ROOM_FLOOR,ADDRTYPE,GUID,INSERTTIME,SYSTEMID,ISDELETE,BELONG_BUILDING,ADDRESS_TYPE,REMARK,AddTime from UnifiedAddressLibrary ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            big_data.Model.UnifiedAddressLibrary model = new big_data.Model.UnifiedAddressLibrary();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Haikan.SchoolProjectsCore.MDB.Model.HFile GetModel(int FileID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 FileID,EnterpriseName,EnterpriseFile,ContractFile,InvoiceFile,ProjectFile,IsDele from HFile ");
            strSql.Append(" where FileID=@FileID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileID", SqlDbType.Int, 4)
            };
            parameters[0].Value = FileID;

            Haikan.SchoolProjectsCore.MDB.Model.HFile model = new Haikan.SchoolProjectsCore.MDB.Model.HFile();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.Food GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,FoodUUID,FoodName,Title,Introduction,Address,Price,Picture,State,IsDelete,FoodorTechan,Cover,Lon,Lat,ytype,PlayType,ShopId from Food ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.Food model = new HeqiaoDaoshiCore.Model.Food();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public big_data.Model.UnifiedAddressLibraryUserInfo GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,UnifiedAddressLibraryID,UserIDList,AddTime from UnifiedAddressLibraryUserInfo ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            big_data.Model.UnifiedAddressLibraryUserInfo model = new big_data.Model.UnifiedAddressLibraryUserInfo();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.CulturalIntroduc GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CulturalIntroducUUID,Title,ReleaseTime,IsRelease,Cover,Content,AddTime,AddPeople,ID,IsDeleted,Photo from CulturalIntroduc ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.CulturalIntroduc model = new HeqiaoDaoshiCore.Model.CulturalIntroduc();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(HeqiaoDaoshiCore.Model.Mapmark model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Mapmark(");
            strSql.Append("CreateTime,MapmarkUUID,MarkUUID,Position,IsDelete,Introduce)");
            strSql.Append(" values (");
            strSql.Append("@CreateTime,@MapmarkUUID,@MarkUUID,@Position,@IsDelete,@Introduce)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateTime",  SqlDbType.DateTime),
                new SqlParameter("@MapmarkUUID", SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@MarkUUID",    SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@Position",    SqlDbType.NVarChar,         50),
                new SqlParameter("@IsDelete",    SqlDbType.Int,               4),
                new SqlParameter("@Introduce",   SqlDbType.NVarChar, 255)
            };
            parameters[0].Value = model.CreateTime;
            parameters[1].Value = Guid.NewGuid();
            parameters[2].Value = Guid.NewGuid();
            parameters[3].Value = model.Position;
            parameters[4].Value = model.IsDelete;
            parameters[5].Value = model.Introduce;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.Hotel GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,CreateTime,HotelUUID,Name,Phone,Introduction,Address,Price,Picture,State,IsDelete,AddTime,AddPeople,Cover,HotelUrl,Lon,Lat,ShopId from Hotel ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.Hotel model = new HeqiaoDaoshiCore.Model.Hotel();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.Gtoilet GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 GtoiletUuid,ID,IsDeleted,GtoiletName,GtoiletAddress,Lon,Lat,GtoiletStaues,KongqiZhil,WaterYujin,AddTime,AddPeople,Picture from Gtoilet ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.Gtoilet model = new HeqiaoDaoshiCore.Model.Gtoilet();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.SystemIcon GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 SystemIconUUID,Code,Size,Color,Custom,Description,Status,IsDeleted,CreatedOn,CreatedByUserGuid,CreatedByUserName,ModifiedOn,ModifiedByUserGuid,ModifiedByUserName,ID from SystemIcon ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.SystemIcon model = new HeqiaoDaoshiCore.Model.SystemIcon();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HeqiaoDaoshiCore.Model.HotelRoom GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,HotelRoomUuid,HotelRoomName,Price,Introduction,Address,Picture,State,IsDelete,HotelUuid from HotelRoom ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            HeqiaoDaoshiCore.Model.HotelRoom model = new HeqiaoDaoshiCore.Model.HotelRoom();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ClassLibrary1.Model.SystemUser GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 SystemUserUUID,LoginName,RealName,UserIdCard,PassWord,UserType,SchoolUUID,AddTime,AddPeople,IsDeleted,ManageDepartment,ID,ZaiGang,Phone,Email,Sex,InTime,Types,Address,SystemRoleUUid,Remarks,StaffNum,Wechat,Topic,Content,Train,Main,Job,HealthCertificate,IsStaff,IsCreEdu,PersonnelType,ReviewStatus,CardNumber,IsBlacklist from SystemUser ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            ClassLibrary1.Model.SystemUser model = new ClassLibrary1.Model.SystemUser();
            DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 32
0
 public PersonDao()
 {
     _dbHelper = SqlMapper.Instance.GetDbHelperSql(EnumDbName.Test1);
 }
 public UrlInfoDao()
 {
     _dbHelper = SqlMapper.Instance.GetDbHelperSql(EnumDbName.Test1);
 }