Exemplo n.º 1
0
        public static bool DeleteTask(ClsTask task)
        {
            bool             isTrue = false;
            StringBuilder    strBuilder;
            List <string>    listNames;
            List <SqlDbType> listDBTypes;
            List <object>    listValues;

            strBuilder = new StringBuilder("DELETE FROM [任务列表] WHERE [任务ID]=@intTaskID");

            listNames   = new List <string>();
            listDBTypes = new List <SqlDbType>();
            listValues  = new List <object>();

            listNames.Add("@intTaskID");
            listDBTypes.Add(SqlDbType.Int);
            listValues.Add(task.TaskID);

            try
            {
                object obj = EventUpdateTableUsePara(strBuilder.ToString(), listNames, listDBTypes, listValues);
                isTrue = true;
            }
            catch (Exception ex)
            {
                throw new Exception("失败", new Exception(ex.Message));
            }
            return(isTrue);
        }
Exemplo n.º 2
0
        public int ModifyTask(ClsTask task)
        {
            int           _intTaskID = 0;
            StringBuilder strBuilder;

            List <string>    listNames;
            List <SqlDbType> listDBTypes;
            List <object>    listValues;

            strBuilder = new StringBuilder("UPDATE [任务列表] SET [项目ID]=@projectID,[任务名称]=@TaskName,[物理硬盘]=@disk,[起始位置]=@startPosition,[备注]=@description WHERE [任务ID]=@intTaskID");

            listNames   = new List <string>();
            listDBTypes = new List <SqlDbType>();
            listValues  = new List <object>();

            listNames.Add("@projectID");
            listDBTypes.Add(SqlDbType.VarChar);
            listValues.Add(task.ProjectID);

            listNames.Add("@taskName");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.strTaskName);

            listNames.Add("@disk");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.Disk);

            listNames.Add("@startPosition");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.StartPosition);

            listNames.Add("@description");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.Description);

            listNames.Add("@intTaskID");
            listDBTypes.Add(SqlDbType.VarChar);
            listValues.Add(task.TaskID);

            if (0 == EventUpdateTableUsePara(strBuilder.ToString(), listNames, listDBTypes, listValues))
            {
                throw new Exception("用户信息修改失败");
            }
            try
            {
                object obj = EventUpdateTableUsePara(strBuilder.ToString(), listNames, listDBTypes, listValues);
                _intTaskID  = int.Parse(obj.ToString());
                task.TaskID = _intTaskID;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(_intTaskID);
        }
Exemplo n.º 3
0
        public int AddTask(ClsTask task)
        {
            int              taskID = 0;
            StringBuilder    strBuilder;
            List <string>    listNames;
            List <SqlDbType> listDBTypes;
            List <object>    listValues;

            strBuilder = new StringBuilder("INSERT INTO [任务列表]([项目ID],[任务名称],[物理硬盘],[起始位置],[备注])");
            strBuilder.Append(" VALUES(@projectID,@TaskName,@disk,@startPosition,@description);SELECT SCOPE_IDENTITY()");

            listNames   = new List <string>();
            listDBTypes = new List <SqlDbType>();
            listValues  = new List <object>();

            listNames.Add("@projectID");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.ProjectID);

            listNames.Add("@TaskName");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.strTaskName);

            listNames.Add("@disk");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.Disk);

            listNames.Add("@startPosition");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.StartPosition);

            listNames.Add("@description");
            listDBTypes.Add(@SqlDbType.VarChar);
            listValues.Add(task.Description);
            try
            {
                object obj = EventReturnObjectUserPara(strBuilder.ToString(), listNames, listDBTypes, listValues);
                taskID      = int.Parse(obj.ToString());
                task.TaskID = taskID;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(taskID);
        }