コード例 #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_Reimbursement model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@InfoId",                      SqlDbType.Int,          4),
                new SqlParameter("@Tb_WorkFlow_FlowSort_InfoId", SqlDbType.Int,          4),
                new SqlParameter("@UserCode",                    SqlDbType.NVarChar,    20),
                new SqlParameter("@Title",                       SqlDbType.VarChar,    100),
                new SqlParameter("@ReimbursementDate",           SqlDbType.DateTime),
                new SqlParameter("@InfoContent",                 SqlDbType.VarChar),
                new SqlParameter("@DocumentUrl",                 SqlDbType.VarChar,   2000),
                new SqlParameter("@RealUserCode",                SqlDbType.NVarChar,    20),
                new SqlParameter("@RealMoney",                   SqlDbType.Decimal,      9),
                new SqlParameter("@WorkStartDate",               SqlDbType.DateTime),
                new SqlParameter("@IsPay",                       SqlDbType.NVarChar,    50),
                new SqlParameter("@PrintCount",                  SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.InfoId;
            parameters[1].Value  = model.Tb_WorkFlow_FlowSort_InfoId;
            parameters[2].Value  = model.UserCode;
            parameters[3].Value  = model.Title;
            parameters[4].Value  = model.ReimbursementDate;
            parameters[5].Value  = model.InfoContent;
            parameters[6].Value  = model.DocumentUrl;
            parameters[7].Value  = model.RealUserCode;
            parameters[8].Value  = model.RealMoney;
            parameters[9].Value  = model.WorkStartDate;
            parameters[10].Value = model.IsPay;
            parameters[11].Value = model.PrintCount;

            DbHelperSQL.RunProcedure("Proc_Tb_OAPublicWork_Reimbursement_Update", parameters, out rowsAffected);
        }
コード例 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_Reimbursement GetModel(int InfoId)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@InfoId", SqlDbType.Int, 4)
            };
            parameters[0].Value = InfoId;

            MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_Reimbursement model = new MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_Reimbursement();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_OAPublicWork_Reimbursement_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["InfoId"].ToString() != "")
                {
                    model.InfoId = int.Parse(ds.Tables[0].Rows[0]["InfoId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Tb_WorkFlow_FlowSort_InfoId"].ToString() != "")
                {
                    model.Tb_WorkFlow_FlowSort_InfoId = int.Parse(ds.Tables[0].Rows[0]["Tb_WorkFlow_FlowSort_InfoId"].ToString());
                }
                model.UserCode = ds.Tables[0].Rows[0]["UserCode"].ToString();
                model.Title    = ds.Tables[0].Rows[0]["Title"].ToString();
                if (ds.Tables[0].Rows[0]["ReimbursementDate"].ToString() != "")
                {
                    model.ReimbursementDate = DateTime.Parse(ds.Tables[0].Rows[0]["ReimbursementDate"].ToString());
                }
                model.InfoContent  = ds.Tables[0].Rows[0]["InfoContent"].ToString();
                model.DocumentUrl  = ds.Tables[0].Rows[0]["DocumentUrl"].ToString();
                model.RealUserCode = ds.Tables[0].Rows[0]["RealUserCode"].ToString();
                if (ds.Tables[0].Rows[0]["RealMoney"].ToString() != "")
                {
                    model.RealMoney = decimal.Parse(ds.Tables[0].Rows[0]["RealMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WorkStartDate"].ToString() != "")
                {
                    model.WorkStartDate = DateTime.Parse(ds.Tables[0].Rows[0]["WorkStartDate"].ToString());
                }
                model.IsPay = ds.Tables[0].Rows[0]["IsPay"].ToString();
                if (ds.Tables[0].Rows[0]["PrintCount"].ToString() != "")
                {
                    model.PrintCount = int.Parse(ds.Tables[0].Rows[0]["PrintCount"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }