コード例 #1
0
ファイル: CompanyRelationDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(BWJS.Model.CompanyRelation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[CompanyRelation](");
            strSql.Append("CreateDate,EditId,EditDate,CompanyId,UserId,DepartmentId,RecommendationCode,QRCode,Remark,IsDeleted,CreateId,API");
            strSql.Append(") values (");
            strSql.Append("@CreateDate,@EditId,@EditDate,@CompanyId,@UserId,@DepartmentId,@RecommendationCode,@QRCode,@Remark,@IsDeleted,@CreateId,@API");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@CreateDate",         model.CreateDate),
                new SqlParameter("@EditId",             model.EditId),
                new SqlParameter("@EditDate",           model.EditDate),
                new SqlParameter("@CompanyId",          model.CompanyId),
                new SqlParameter("@UserId",             model.UserId),
                new SqlParameter("@DepartmentId",       model.DepartmentId),
                new SqlParameter("@RecommendationCode", model.RecommendationCode),
                new SqlParameter("@QRCode",             model.QRCode),
                new SqlParameter("@Remark",             model.Remark),
                new SqlParameter("@IsDeleted",          model.IsDeleted),
                new SqlParameter("@CreateId",           model.CreateId),
                new SqlParameter("@API",                model.API)
            };
            BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
コード例 #2
0
ファイル: CompanyRelationDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.CompanyRelation GetModel(int CompanyId, int UserId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CompanyRelationId, CreateDate, EditId, EditDate, CompanyId, UserId, DepartmentId, RecommendationCode, QRCode, Remark, IsDeleted, CreateId ,API ");
            strSql.Append("  from dbo.[CompanyRelation] ");
            strSql.Append(" where CompanyId=@CompanyId and UserId=@UserId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyId", SqlDbType.Int, 4),
                new SqlParameter("@UserId",    SqlDbType.Int, 4)
            };
            parameters[0].Value = CompanyId;
            parameters[1].Value = UserId;


            BWJS.Model.CompanyRelation model = new BWJS.Model.CompanyRelation();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
ファイル: CompanyRelationDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.CompanyRelation DataRowToModel(DataRow row)
        {
            BWJS.Model.CompanyRelation model = new BWJS.Model.CompanyRelation();

            if (row != null)
            {
                if (row["CompanyRelationId"].ToString() != "")
                {
                    model.CompanyRelationId = int.Parse(row["CompanyRelationId"].ToString());
                }
                if (row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }
                if (row["EditId"].ToString() != "")
                {
                    model.EditId = int.Parse(row["EditId"].ToString());
                }
                if (row["EditDate"].ToString() != "")
                {
                    model.EditDate = DateTime.Parse(row["EditDate"].ToString());
                }
                if (row["CompanyId"].ToString() != "")
                {
                    model.CompanyId = int.Parse(row["CompanyId"].ToString());
                }
                if (row["UserId"].ToString() != "")
                {
                    model.UserId = int.Parse(row["UserId"].ToString());
                }
                if (row["DepartmentId"].ToString() != "")
                {
                    model.DepartmentId = int.Parse(row["DepartmentId"].ToString());
                }
                model.RecommendationCode = row["RecommendationCode"].ToString();
                model.QRCode             = row["QRCode"].ToString();
                model.Remark             = row["Remark"].ToString();
                if (row["IsDeleted"].ToString() != "")
                {
                    model.IsDeleted = int.Parse(row["IsDeleted"].ToString());
                }
                if (row["CreateId"].ToString() != "")
                {
                    model.CreateId = int.Parse(row["CreateId"].ToString());
                }
                if (row["API"].ToString() != "")
                {
                    model.API = row["API"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
ファイル: CompanyRelationDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.CompanyRelation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[CompanyRelation] set ");

            strSql.Append(" CreateDate = @CreateDate , ");
            strSql.Append(" EditId = @EditId , ");
            strSql.Append(" EditDate = @EditDate , ");
            strSql.Append(" CompanyId = @CompanyId , ");
            strSql.Append(" UserId = @UserId , ");
            strSql.Append(" DepartmentId = @DepartmentId , ");
            strSql.Append(" RecommendationCode = @RecommendationCode , ");
            strSql.Append(" QRCode = @QRCode , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" IsDeleted = @IsDeleted , ");
            strSql.Append(" API = @API ");
            strSql.Append(" where CompanyRelationId=@CompanyRelationId ");
            //strSql.Append(" where CompanyId=@CompanyId and UserId=@UserId  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyRelationId",  model.CompanyRelationId),
                new SqlParameter("@CreateDate",         model.CreateDate),
                new SqlParameter("@EditId",             model.EditId),
                new SqlParameter("@EditDate",           model.EditDate),
                new SqlParameter("@CompanyId",          model.CompanyId),
                new SqlParameter("@UserId",             model.UserId),
                new SqlParameter("@DepartmentId",       model.DepartmentId),
                new SqlParameter("@RecommendationCode", model.RecommendationCode),
                new SqlParameter("@QRCode",             model.QRCode),
                new SqlParameter("@Remark",             model.Remark),
                new SqlParameter("@IsDeleted",          model.IsDeleted),
                new SqlParameter("@API",                model.API)
            };
            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
ファイル: CompanyRelationDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 得到一个对象实体重载
        /// </summary>
        /// <param name="CompanyRelationId"></param>
        /// <returns></returns>
        public BWJS.Model.CompanyRelation GetModel(int CompanyRelationId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from CompanyRelation ");
            strSql.Append(" where CompanyRelationId=@CompanyRelationId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyRelationId", SqlDbType.Int, 4)
            };
            parameters[0].Value = CompanyRelationId;
            BWJS.Model.CompanyRelation model = new BWJS.Model.CompanyRelation();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BWJS.Model.CompanyRelation model)
 {
     return(dal.Update(model));
 }
コード例 #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(BWJS.Model.CompanyRelation model)
 {
     dal.Add(model);
 }