Example #1
0
        public void Reassign(LPWeb.Model.LoanTeam oldModel, LPWeb.Model.LoanTeam model, int UserId)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId",    SqlDbType.Int),
                new SqlParameter("@NewUserId", SqlDbType.Int),
                new SqlParameter("@OldUserId", SqlDbType.Int),
                new SqlParameter("@RoleId",    SqlDbType.Int),
                new SqlParameter("@Requester", SqlDbType.Int)
            };


            parameters[0].Value = oldModel.FileId;
            parameters[1].Value = model.UserId;
            parameters[2].Value = oldModel.UserId;
            parameters[3].Value = model.RoleId;
            parameters[4].Value = UserId;

            DbHelperSQL.RunProcedure("lpsp_ReassignLoan", parameters);
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(LPWeb.Model.LoanTeam model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into LoanTeam(");
            strSql.Append("FileId,RoleId,UserId)");
            strSql.Append(" values (");
            strSql.Append("@FileId,@RoleId,@UserId)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId", SqlDbType.Int, 4),
                new SqlParameter("@RoleId", SqlDbType.Int, 4),
                new SqlParameter("@UserId", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.FileId;
            parameters[1].Value = model.RoleId;
            parameters[2].Value = model.UserId;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(LPWeb.Model.LoanTeam model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update LoanTeam set ");
            strSql.Append("FileId=@FileId,");
            strSql.Append("RoleId=@RoleId,");
            strSql.Append("UserId=@UserId");
            strSql.Append(" where FileId=@FileId and RoleId=@RoleId and UserId=@UserId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId", SqlDbType.Int, 4),
                new SqlParameter("@RoleId", SqlDbType.Int, 4),
                new SqlParameter("@UserId", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.FileId;
            parameters[1].Value = model.RoleId;
            parameters[2].Value = model.UserId;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.LoanTeam GetModel(int FileId, int RoleId, int UserId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 FileId,RoleId,UserId from LoanTeam ");
            strSql.Append(" where FileId=@FileId and RoleId=@RoleId and UserId=@UserId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId", SqlDbType.Int, 4),
                new SqlParameter("@RoleId", SqlDbType.Int, 4),
                new SqlParameter("@UserId", SqlDbType.Int, 4)
            };
            parameters[0].Value = FileId;
            parameters[1].Value = RoleId;
            parameters[2].Value = UserId;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["FileId"].ToString() != "")
                {
                    model.FileId = int.Parse(ds.Tables[0].Rows[0]["FileId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RoleId"].ToString() != "")
                {
                    model.RoleId = int.Parse(ds.Tables[0].Rows[0]["RoleId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UserId"].ToString() != "")
                {
                    model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }