Beispiel #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(LPWeb.Model.LoanWflTempl model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into LoanWflTempl(");
            strSql.Append("FileId,WflTemplId,ApplyDate,ApplyBy)");
            strSql.Append(" values (");
            strSql.Append("@FileId,@WflTemplId,@ApplyDate,@ApplyBy)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId",     SqlDbType.Int,       4),
                new SqlParameter("@WflTemplId", SqlDbType.Int,       4),
                new SqlParameter("@ApplyDate",  SqlDbType.DateTime),
                new SqlParameter("@ApplyBy",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.FileId;
            parameters[1].Value = model.WflTemplId;
            parameters[2].Value = model.ApplyDate;
            parameters[3].Value = model.ApplyBy;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #2
0
        public void Apply(LPWeb.Model.LoanWflTempl model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId",    SqlDbType.Int),
                new SqlParameter("@WfTemplId", SqlDbType.Int),
                new SqlParameter("@UserId",    SqlDbType.Int)
            };
            parameters[0].Value = model.FileId;
            parameters[1].Value = model.WflTemplId;
            parameters[2].Value = model.ApplyBy;

            DbHelperSQL.RunProcedure("lpsp_ApplyLoanWflTempl", parameters);
        }
Beispiel #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.LoanWflTempl GetModel(int WflTemplId, int FileId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 FileId,WflTemplId,ApplyDate,ApplyBy from LoanWflTempl ");
            strSql.Append(" where WflTemplId=@WflTemplId and FileId=@FileId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WflTemplId", SqlDbType.Int, 4),
                new SqlParameter("@FileId",     SqlDbType.Int, 4)
            };
            parameters[0].Value = WflTemplId;
            parameters[1].Value = FileId;

            LPWeb.Model.LoanWflTempl model = new LPWeb.Model.LoanWflTempl();
            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]["WflTemplId"].ToString() != "")
                {
                    model.WflTemplId = int.Parse(ds.Tables[0].Rows[0]["WflTemplId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ApplyDate"].ToString() != "")
                {
                    model.ApplyDate = DateTime.Parse(ds.Tables[0].Rows[0]["ApplyDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ApplyBy"].ToString() != "")
                {
                    model.ApplyBy = int.Parse(ds.Tables[0].Rows[0]["ApplyBy"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(LPWeb.Model.LoanWflTempl model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update LoanWflTempl set ");
            strSql.Append("FileId=@FileId,");
            strSql.Append("WflTemplId=@WflTemplId,");
            strSql.Append("ApplyDate=@ApplyDate,");
            strSql.Append("ApplyBy=@ApplyBy");
            strSql.Append(" where WflTemplId=@WflTemplId and FileId=@FileId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileId",     SqlDbType.Int,       4),
                new SqlParameter("@WflTemplId", SqlDbType.Int,       4),
                new SqlParameter("@ApplyDate",  SqlDbType.DateTime),
                new SqlParameter("@ApplyBy",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.FileId;
            parameters[1].Value = model.WflTemplId;
            parameters[2].Value = model.ApplyDate;
            parameters[3].Value = model.ApplyBy;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }