예제 #1
0
        //[email protected]
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Fields"></param>
        /// <param name="fc_New"></param>
        /// <returns> 0: Successed, 1:SetValue Fail;2:LoadDataField Fail;3:UpdataToDB Fail;4:Rollback Fail</returns>
        public Int32 UpdateData(IFields Fields, FieldCollection fc_New)
        {
            bool result = false;

            FieldCollection fc_Current = Fields.ToFieldCollection();
            FieldCollection fc_Mark = fc_Current.Clone();
            result = fc_Current.UpdateFieldsValue(fc_New);
            if (!result)
                return 2;
            DataProcessTask task = new DataProcessTask();
            task.AddTaskItem(new DataProcessTaskItem(eDataOPType.OP_Update, fc_Current, null));
            result = Fields.LoadFieldCollection(fc_Current);
            if (!result)
                return 3;
            result = ExeOneTask(task);
            if (!result)
            {
                result = Fields.LoadFieldCollection(fc_Mark);
                if (!result)
                    return 4;
            }
            return 0;
        }
예제 #2
0
 public bool SaveData(IFields Fields)
 {
     FieldCollection fc = Fields.ToFieldCollection();
     DataProcessTask task = new DataProcessTask();
     task.AddTaskItem(new DataProcessTaskItem(eDataOPType.OP_Update, fc, null));
     return ExeOneTask(task);
 }
예제 #3
0
 public DataProcessTaskItem SaveDataToTask(DataProcessTask task, IFields Fields)
 {
     FieldCollection fc = Fields.ToFieldCollection();
     DataProcessTaskItem item = new DataProcessTaskItem(eDataOPType.OP_Update, fc, null);
     task.AddTaskItem(item);
     return item;
 }
예제 #4
0
 public DataProcessTaskItem LoadDataToTask(DataProcessTask task, IFields Fields)
 {
     //FieldCollection fc = Fields.ToFieldCollection();
     //DataProcessTaskItem item = new DataProcessTaskItem(eDataOPType.OP_Delete, fc, null);
     //task.AddTaskItem(item);
     //return item;
     throw new ApplicationException("Not Exists");
 }
예제 #5
0
 public bool LoadData(IFields Fields)
 {
     bool result;
     FieldCollection fc = Fields.ToFieldCollection();
     DataProcessTask task = new DataProcessTask();
     DataProcessTaskItem DPTI = new DataProcessTaskItem(eDataOPType.Select, fc, null);
     task.AddTaskItem(DPTI);
     result = ExeOneTask(task);
     return result && Fields.LoadFieldCollection(DPTI.Fields);
 }
예제 #6
0
        public bool ExeOneTask(DataProcessTask task)
        {
            bool result = false;
            if (task.TaskStatus != eTastStatus.Added)
            {
                return result;
            }
            task.TaskStatus = eTastStatus.Processing;
            for (int j = 0; j < task.Items.Count; j++)
            {
                DataProcessTaskItem taskitem = task.Items[j];
                DataOperation_Complex DtOpC = new DataOperation_Complex(taskitem.Fields);
                DtOpC.IsForceUpdate = _isIgnoreUpdate;
                //WXG20131122@ModifyProcessEngine
                foreach (KeyValuePair<string, DBService> kv in task.DbConn_Dict)
                {
                    DtOpC.AddDbService(kv.Key,kv.Value);
                }

                switch (taskitem.OPType)
                {
                    case eDataOPType.Select:
                        result = DtOpC.LoadFieldsBySource();
                        taskitem.Fields = DtOpC.Fields;
                        break;
                    case eDataOPType.OP_Insert:
                        result = DtOpC.Insert();
                        break;
                    case eDataOPType.OP_Delete:
                        result = DtOpC.Delete();
                        break;
                    case eDataOPType.OP_Update:
                        result = DtOpC.Update();
                        break;
                    case eDataOPType.EXEC_SQL:

                        break;
                    case eDataOPType.Call:
                        break;
                    default:
                        break;
                }
                taskitem.Result = result;
            }
            if (result)
            {
                task.TaskStatus = eTastStatus.Complete;
            }
            else
            {
                task.TaskStatus = eTastStatus.Error;
            }
            return result;
        }
예제 #7
0
 public bool CreateData(IFields Fields)
 {
     if (Fields != null)
     {
         FieldCollection fc = Fields.ToFieldCollection();
         DataProcessTask task = new DataProcessTask();
         task.AddTaskItem(new DataProcessTaskItem(eDataOPType.OP_Insert, fc, null));
         return ExeOneTask(task);
     }
     else
         return false;
 }
예제 #8
0
 public void AddTask(DataProcessTask task)
 {
     lock (ObjectLock_Task)
     {
         Tasks.Add(task);
     }
 }