Пример #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(HM.Model.Qm.Tb_Qm_TaskDone model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",       SqlDbType.VarChar,     36),
                new SqlParameter("@TaskId",   SqlDbType.VarChar,     36),
                new SqlParameter("@PointIds", SqlDbType.NVarChar,   500),
                new SqlParameter("@Pictures", SqlDbType.NVarChar,  1000),
                new SqlParameter("@AddPId",   SqlDbType.VarChar,     36),
                new SqlParameter("@AddTime",  SqlDbType.DateTime),
                new SqlParameter("@Remark",   SqlDbType.NVarChar,  1000),
                new SqlParameter("@IsDelete", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.TaskId;
            parameters[2].Value = model.PointIds;
            parameters[3].Value = model.Pictures;
            parameters[4].Value = model.AddPId;
            parameters[5].Value = model.AddTime;
            parameters[6].Value = model.Remark;
            parameters[7].Value = model.IsDelete;

            DbHelperSQL.RunProcedure("Proc_Tb_Qm_TaskDone_Update", parameters, out rowsAffected);
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HM.Model.Qm.Tb_Qm_TaskDone GetModel(string Id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = Id;

            HM.Model.Qm.Tb_Qm_TaskDone model = new HM.Model.Qm.Tb_Qm_TaskDone();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Qm_TaskDone_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.Id       = ds.Tables[0].Rows[0]["Id"].ToString();
                model.TaskId   = ds.Tables[0].Rows[0]["TaskId"].ToString();
                model.PointIds = ds.Tables[0].Rows[0]["PointIds"].ToString();
                model.Pictures = ds.Tables[0].Rows[0]["Pictures"].ToString();
                model.AddPId   = ds.Tables[0].Rows[0]["AddPId"].ToString();
                if (ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                if (ds.Tables[0].Rows[0]["IsDelete"].ToString() != "")
                {
                    model.IsDelete = int.Parse(ds.Tables[0].Rows[0]["IsDelete"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }