Exemple #1
0
        private void tmnuEditTask_Click(object sender, EventArgs e)
        {
            if (tlTasks.FocusedNode != null && tlTasks.FocusedNode.Tag != null)
            {
                using (frmTaskEditor frmEditTask = new frmTaskEditor())
                {
                    TTask editTask = (TTask)tlTasks.FocusedNode.Tag;

                    frmEditTask.Task = editTask;
                    frmEditTask.Text = "修改监控任务";

                    if (frmEditTask.ShowDialog() == DialogResult.OK)
                    {
                        editTask.Save();

                        tlTasks.FocusedNode[tclmnTaskName.AbsoluteIndex]       = editTask.TaskName;
                        tlTasks.FocusedNode[tclmnWatchType.AbsoluteIndex]      = EnumHelper.GetDescription(editTask.WatchType);
                        tlTasks.FocusedNode[tclmnMonitorFolder.AbsoluteIndex]  = editTask.WatchFolder;
                        tlTasks.FocusedNode[tclmnDocProcessType.AbsoluteIndex] = EnumHelper.GetDescription(editTask.FileDealType);

                        tcTaskLogs.SelectedTabPage.Text = GetTaskLogPanelText(editTask);
                    }
                }
            }
        }
Exemple #2
0
        public bool TaskHandle(string loginKey, ref ErrorInfo err, TTask inEnt)
        {
            GlobalUser gu = Global.GetUser(loginKey);

            if (gu == null)
            {
                err.IsError = true;
                err.Message = "登录超时";
                return(false);
            }
            using (DBEntities db = new DBEntities())
            {
                var allFIleId = "";
                if (!string.IsNullOrEmpty(inEnt.AllFilesStr))
                {
                    var allFile = JSON.EncodeToEntity <IList <FILES> >(inEnt.AllFilesStr);
                    allFIleId = string.Join(",", allFile.Select(x => x.ID));
                }
                if (inEnt.FLOW_ID != null)
                {
                    var reBool = FunTask.FlowSubmit(db, ref err, gu, inEnt.NowFlowId, inEnt.TaskContent, allFIleId, inEnt.UserIdArrStr, inEnt.ROLE_ID_STR, inEnt.IsStage, inEnt.NowSubmitType);
                }
                else
                {
                    var reBool = FunTask.NoFlowSubmit(db, ref err, gu, inEnt.NowFlowId, inEnt.TaskContent, allFIleId, inEnt.UserIdArrStr, inEnt.ROLE_ID_STR, inEnt.IsStage, inEnt.NowSubmitType);
                }
                if (err.IsError)
                {
                    return(false);
                }
                db.SaveChanges();
                return(true);
            }
        }
Exemple #3
0
        private void tmnuNewTask_Click(object sender, EventArgs e)
        {
            using (frmTaskEditor frmNewTask = new frmTaskEditor())
            {
                TTask newTask = new TTask(RegTaskKey, TObjectCreateType.octNew);

                frmNewTask.Task = newTask;
                frmNewTask.Text = "新增监控任务";

                if (frmNewTask.ShowDialog() == DialogResult.OK)
                {
                    newTask.Save();
                    tasks.Tasks.Add(newTask);
                    tlTasks.AppendNode(
                        new object[]
                    {
                        newTask.TaskStatusMessage,
                        newTask.TaskName,
                        EnumHelper.GetDescription(newTask.WatchType),
                        newTask.WatchFolder,
                        EnumHelper.GetDescription(newTask.FileDealType)
                    },
                        null,
                        newTask);
                    CreateTaskLogPanel(newTask);
                }
            }
        }
Exemple #4
0
        public void UpdateTask(TTask task)
        {
            if (task.Id == 0)
            {
                throw new ArgumentNullException(nameof(task.Id));
            }

            if (task != null)
            {
                _Db.SaveChanges();
            }

            //var dbtask = _Db.TTask.Where(x => x.Id == task.Id).FirstOrDefault();

            //if (dbtask != null)
            //{
            //    dbtask.Description = task.Description;
            //    dbtask.RemindDate = task.RemindDate;
            //    dbtask.DueDate = task.DueDate;
            //    dbtask.MyDayDate = task.MyDayDate;
            //    dbtask.Notes = task.Notes;
            //    dbtask.IsCompleted = task.IsCompleted;
            //    dbtask.IsImportant = task.IsImportant;
            //    _Db.SaveChanges();
            //}
        }
Exemple #5
0
 ///// <summary>
 ///// 只好使用 workerId 得到对应的第一个工号
 ///// </summary>
 //public static B_WORKER_ROLE LoadWorkerRole(int workerId)
 //{
 //    using (MainDataContext dbContext = new MainDataContext())
 //    {
 //        return dbContext.B_WORKER_ROLE.Where(t => t.WorkerID == workerId).FirstOrDefault();
 //    }
 //}
 #region 所有保存前对象处理函数
 /// <summary>
 /// 暂不进行数据库操作(只修改对象) 分块修改对象 更灵活 提高效率
 /// 修改 TTask和 List<TTaskPersonLink> 对象 修改人员
 /// </summary>
 public static void UpdateTaskPerson(TTask entity, TTask newEntity, string operatorCode, List <TModifyRecord> mriList, List <TTaskPersonLink> LtPersonLink
                                     , List <string> LtDriver, List <string> LtDovtor, List <string> LtNures, List <string> LtLitter, List <string> LtSalver)
 {
     //任务编码 是不可修改的所以entity.任务编码==newEntity.任务编码
     foreach (string item in LtDriver)
     {
         LtPersonLink.Add(TaskPersonLink.InsertTaskPerson(entity.任务编码, item));
     }
     foreach (string item in LtDovtor)
     {
         LtPersonLink.Add(TaskPersonLink.InsertTaskPerson(entity.任务编码, item));
     }
     foreach (string item in LtNures)
     {
         LtPersonLink.Add(TaskPersonLink.InsertTaskPerson(entity.任务编码, item));
     }
     foreach (string item in LtLitter)
     {
         LtPersonLink.Add(TaskPersonLink.InsertTaskPerson(entity.任务编码, item));
     }
     foreach (string item in LtSalver)
     {
         LtPersonLink.Add(TaskPersonLink.InsertTaskPerson(entity.任务编码, item));
     }
     ModifyTask2(entity, newEntity, operatorCode, mriList);
     //entity.司机 = Driver;
     //entity.医生 = Doctor;
     //entity.护士 = Nures;
     //entity.担架工 = Litter;
 }
Exemple #6
0
        public void Add(int type, int value, bool isMerge = true)
        {
            if (!this.tasks.ContainsKey(type.ToString()))
            {
                return;
            }
            LocalData localData = this.tasks[type.ToString()];

            if (isMerge)
            {
                localData.value += value;
            }
            else
            {
                localData.value = value;
            }
            this.tasks[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
            GlobalEventHandle.EmitRefreshTaskHandle(type);
            if (localData.status != -1)
            {
                return;
            }
            TTask tTask = Configs.Configs.TTasks[localData.key.ToString()];

            if (localData.value >= tTask.Value)
            {
                localData.status = -2;
            }
            this.tasks[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
            DotManager.GetInstance().CheckTask();
            GlobalEventHandle.EmitRefreshTaskHandle(type);
        }
Exemple #7
0
        private void SetValue(TTask task)
        {
            task.TaskName    = edtTaskName.Text.Trim();
            task.WatchType   = (TWatchType)Convert.ToInt32(cboWatchType.EditValue.ToString());
            task.WatchFolder = edtWatchFolder.Text.Trim();

            task.NormalWatchFileExts        = ucWatchTypeNormal.edtNormalWatchFileExts.Text.Trim();
            task.NormalKeepUndealFile       = ucWatchTypeNormal.chkNormalKeepUndealFile.Checked;
            task.NormalKeepUndealFileFolder = ucWatchTypeNormal.edtNormalKeepUndealFileFolder.Text.Trim();

            task.FlagFileName            = ucWatchTypeFlagFile.edtFlagFileName.Text.Trim();
            task.FlagFileGetDataFileType = ucWatchTypeFlagFile.rbFlagFileGetDataFileType_0.Checked ? 0 : 1;
            task.FlagFileDataFileExt     = ucWatchTypeFlagFile.edtFlagFileDataFileExt.Text.Trim();
            task.FlagFileDataFileFolder  = ucWatchTypeFlagFile.edtFlagFileDataFileFolder.Text.Trim();

            task.BackupFileFlag   = chkBackupFileFlag.Checked;
            task.BackupFileFolder = edtBackupFileFolder.Text.Trim();
            task.FileDealType     = (TDocumentProcessType)Convert.ToInt32(cboFileDealType.EditValue.ToString());

            task.Ftp_Address = ucDealTypeFTP.edtFTPAdress.Text.Trim();
            task.Ftp_Port    = Convert.ToInt32(ucDealTypeFTP.edtFTPPort.Text.Trim());
            task.Ftp_UserID  = ucDealTypeFTP.edtFTPUserID.Text.Trim();
            task.Ftp_UserPWD = ucDealTypeFTP.edtFTPUserPWD.Text.Trim();

            task.Copy_DestFolder = ucDealTypeMoveToFolder.edtCopyDestinationFolder.Text.Trim();

            if (task.FileDealType == TDocumentProcessType.CallStoreProcedure)
            {
                task.DbServer  = ucDealTypeCallStoreProcedure.edtDBAddress.Text.Trim();
                task.DbUserID  = ucDealTypeCallStoreProcedure.edtDBUserID.Text.Trim();
                task.DbUserPWD = ucDealTypeCallStoreProcedure.edtDBUserPWD.Text.Trim();
                task.DbName    = ucDealTypeCallStoreProcedure.edtDBName.Text.Trim();
            }
            task.Db_ImportTypeID    = Convert.ToInt32(ucDealTypeCallStoreProcedure.edtImportTypeID.Text.Trim());
            task.Db_NumFields       = Convert.ToInt32(ucDealTypeCallStoreProcedure.edtNumFields.Text.Trim());
            task.Db_FirstRow        = Convert.ToInt32(ucDealTypeCallStoreProcedure.edtFirstRow.Text.Trim());
            task.Db_FieldTerminator = ucDealTypeCallStoreProcedure.edtFieldTerminator.Text.Trim();
            task.Db_RowTerminator   = ucDealTypeCallStoreProcedure.edtRowTerminator.Text.Trim();
            task.Db_FormatFile      = ucDealTypeCallStoreProcedure.edtFormatFileName.Text.Trim();

            if (task.FileDealType == TDocumentProcessType.InsertIntoTableThread ||
                task.FileDealType == TDocumentProcessType.InsertIntoTableWithSingle)
            {
                task.DbServer  = ucDealTypeInsertIntoTable.edtDBAddress.Text.Trim();
                task.DbUserID  = ucDealTypeInsertIntoTable.edtDBUserID.Text.Trim();
                task.DbUserPWD = ucDealTypeInsertIntoTable.edtDBUserPWD.Text.Trim();
                task.DbName    = ucDealTypeInsertIntoTable.edtDBName.Text.Trim();
            }
            task.TbTableName          = ucDealTypeInsertIntoTable.edtTableName.Text.Trim();
            task.TbTxtFileSplitter    = ucDealTypeInsertIntoTable.edtSplitter.Text.Trim();
            task.TbNumOfTxtFields     = Convert.ToInt32(ucDealTypeInsertIntoTable.edtNumOfTextFields.Text.Trim());
            task.TbDataFirstRow       = Convert.ToInt32(ucDealTypeInsertIntoTable.edtDataStartLineNo.Text.Trim());
            task.TbIncludeTxtFileName = ucDealTypeInsertIntoTable.chkSaveIncludeFileName.Checked;

            task.ThreadStartMark = (TThreadStartMark)Convert.ToInt32(ucDealTypeInsertIntoTable.cboThreadStartMark.EditValue.ToString());
        }
Exemple #8
0
        private void tmnuStopTask_Click(object sender, EventArgs e)
        {
            if (tlTasks.FocusedNode != null && tlTasks.FocusedNode.Tag != null)
            {
                TTask task = (TTask)tlTasks.FocusedNode.Tag;

                task.TaskStatus = TTaskStatus.taskStopped;
                tlTasks.FocusedNode[tclmnStatus.AbsoluteIndex] = EnumHelper.GetDescription(task.TaskStatus);
            }
        }
 public TTaskDto UpdateTask(TContextDto context, TTaskDto task)
 {
     try
     {
         if (task.TTaskID > 0)
         {
             var existingTask = _db.TTasks.SingleOrDefault(e => e.TTaskID == task.TTaskID);
             if (existingTask != null)
             {
                 if (existingTask.TProject.TUserID == context.TUserID)
                 {
                     // if there are no entries, remove it instead
                     if (task.IsObsolete && !_db.TEntries.Any(e => e.TTaskID == task.TTaskID))
                     {
                         _db.TTasks.Remove(existingTask);
                     }
                     else
                     {
                         if (!string.IsNullOrWhiteSpace(task.Name))
                         {
                             existingTask.Name = task.Name;
                         }
                         existingTask.IsObsolete   = task.IsObsolete;
                         existingTask.DisplayOrder = task.DisplayOrder;
                     }
                     _db.SaveChanges();
                 }
                 return(Mapper.Map <TTaskDto>(existingTask));
             }
         }
         else if (task.TProjectID > 0 && !task.IsObsolete && !string.IsNullOrWhiteSpace(task.Name))
         {
             var existingProject = _db.TProjects.SingleOrDefault(p => p.TProjectID == task.TProjectID && p.TUserID == context.TUserID);
             if (existingProject != null)
             {
                 var newTask = new TTask
                 {
                     DisplayOrder = task.DisplayOrder,
                     IsObsolete   = task.IsObsolete,
                     Name         = task.Name,
                     TProjectID   = task.TProjectID
                 };
                 _db.TTasks.Add(newTask);
                 _db.SaveChanges();
                 return(Mapper.Map <TTaskDto>(newTask));
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <string>(ex.Message, HttpStatusCode.BadRequest);
     }
 }
Exemple #10
0
 /// <summary>
 /// 获取任务对象
 /// </summary>
 public static TTask GetTaskInfo(string Code)
 {
     //查询任务信息
     using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
     {
         TTask tt = (from t in dbContext.TTask
                     where t.任务编码 == Code
                     select t).First();
         return(tt);
     }
 }
        public IHttpActionResult GetTaskByID(int id)
        {
            TTask t = _db.TTasks.Find(id);

            if (t == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(t));
            }
        }
Exemple #12
0
 /// <summary>
 /// 暂不进行数据库操作(只修改对象) 分块修改对象 更灵活 提高效率
 /// 修改 TTask 对象 是否正常结束
 /// </summary>
 public static void UpdateTaskAbdReason(TTask OldEntity, TTask entity, string PersonCode, List <TModifyRecord> mriList)
 {
     //entity.是否正常结束 = Convert.ToBoolean(Convert.ToInt32(taskResult));//是否正常结束
     if (entity.是否正常结束)
     {
         entity.异常结束原因编码 = -1;
         entity.备注       = "";
     }
     //else
     //{
     //    entity.异常结束原因编码 = Convert.ToInt32(taskAbdReasonId);
     //    entity.备注 = remark;
     //}
     ModifyTask1(OldEntity, entity, PersonCode, mriList);
 }
Exemple #13
0
 private void tlTasks_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
 {
     if (e.Node != null && e.Node.Tag != null)
     {
         TTask task = (TTask)e.Node.Tag;
         foreach (DevExpress.XtraTab.XtraTabPage tPage in tcTaskLogs.TabPages)
         {
             if (tPage.Name == GetTaskLogPanelName(task))
             {
                 tcTaskLogs.SelectedTabPage = tPage;
                 break;
             }
         }
     }
 }
Exemple #14
0
 private void tmnuStopAllTasks_Click(object sender, EventArgs e)
 {
     foreach (TreeListNode node in tlTasks.Nodes)
     {
         if (node.Tag != null)
         {
             TTask task = (TTask)node.Tag;
             if (task.TaskStatus == TTaskStatus.taskRunning)
             {
                 task.TaskStatus = TTaskStatus.taskStopped;
                 node[tclmnStatus.AbsoluteIndex] = EnumHelper.GetDescription(task.TaskStatus);
             }
         }
     }
 }
Exemple #15
0
        private static void ModifyTask1(TTask originInfo, TTask newInfo, string operatorCode,
                                        List <TModifyRecord> mriList)
        {
            if (m_ModifyTaskTypeDic1 == null)
            {
                m_ModifyTaskTypeDic1 = new Dictionary <string, int>();

                m_ModifyTaskTypeDic1.Add("是否正常结束", 113);   //任务是否正常结束
                m_ModifyTaskTypeDic1.Add("异常结束原因编码", 114); //异常结束原因
                m_ModifyTaskTypeDic1.Add("备注", 115);       //任务备注
                m_ModifyTaskTypeDic1.Add("行驶公里数", 116);    //行驶公里数
                m_ModifyTaskTypeDic1.Add("急救公里数", 117);    //急救公里数
                m_ModifyTaskTypeDic1.Add("实际救治人数", 118);   //实际救治人数

                //m_ModifyTaskTypeDic1.Add("IsNormalFinish", 113);//任务是否正常结束
                //m_ModifyTaskTypeDic1.Add("AbnormalReasonId", 114);//异常结束原因
                //m_ModifyTaskTypeDic1.Add("Remark", 115);//任务备注
                //m_ModifyTaskTypeDic1.Add("TravelDistance", 116);//行驶公里数
                //m_ModifyTaskTypeDic1.Add("HelpDistance", 117);//急救公里数
                //m_ModifyTaskTypeDic1.Add("CureAmount", 118);//实际救治人数
            }
            //获得所有property的信息
            PropertyInfo[] properties = originInfo.GetType().GetProperties();
            foreach (PropertyInfo p in properties)
            {
                int typeId = -1;
                if (m_ModifyTaskTypeDic1.TryGetValue(p.Name, out typeId)) //如果需要修改
                {
                    object oldObj = p.GetValue(originInfo, null);
                    object newObj = p.GetValue(newInfo, null);
                    if (!object.Equals(oldObj, newObj))
                    {
                        p.SetValue(originInfo, newObj, null);
                        TModifyRecord mri = new TModifyRecord();
                        mri.编码     = Guid.NewGuid();
                        mri.修改后内容  = newObj == null ? "" : newObj.ToString(); //2011-02-14 如果是null就费了。
                        mri.修改前内容  = oldObj == null ? "" : oldObj.ToString(); //2011-02-14 如果是null就费了。
                        mri.产生时刻   = DateTime.Now;
                        mri.操作员编码  = operatorCode;
                        mri.修改类型编码 = typeId;
                        mri.事件编码   = originInfo.事件编码;
                        mri.受理序号   = originInfo.受理序号;
                        mri.任务编码   = originInfo.任务编码;//任务编码
                        mriList.Add(mri);
                    }
                }
            }
        }
Exemple #16
0
        public void getTaskByID()
        {
            TTask task = new TTask();

            task.ID = 999;

            DBHandler.Instance.db.TTasks.Add(task);

            DBHandler.Instance.db.SaveChanges();

            Assert.AreEqual(task, DBHandler.Instance.getTaskByID(999));

            DBHandler.Instance.db.TTasks.Remove(task);

            DBHandler.Instance.db.SaveChanges();
        }
Exemple #17
0
        public void AddTask(int idList, TTask task)
        {
            if (idList == 0)
            {
                throw new ArgumentNullException(nameof(idList));
            }

            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            task.IdList = idList;
            _Db.TTask.Add(task);
            _Db.SaveChanges();
        }
        public int CreateUser(string userName)
        {
            try
            {
                // use database seeded projects for guest
                var guestEmail = ConfigurationManager.AppSettings["GuestEmail"];
                if (!string.IsNullOrWhiteSpace(guestEmail) && userName.Equals(guestEmail, StringComparison.InvariantCultureIgnoreCase))
                {
                    var firstUser = _db.TUsers.OrderBy(u => u.TUserID).FirstOrDefault();
                    if (firstUser != null)
                    {
                        return(firstUser.TUserID);
                    }
                }
                var newUser = new TUser {
                    Name = userName, LastTaskID = 0, CurrentState = TState.Idle
                };
                _db.TUsers.Add(newUser);
                _db.SaveChanges();

                var newProject = new TProject
                {
                    DisplayOrder = 1,
                    IsObsolete   = false,
                    Name         = "Sample Project",
                    TUserID      = newUser.TUserID
                };
                _db.TProjects.Add(newProject);
                _db.SaveChanges();

                var newTask = new TTask
                {
                    DisplayOrder = 1,
                    IsObsolete   = false,
                    Name         = "Sample Task",
                    TProjectID   = newProject.TProjectID
                };
                _db.TTasks.Add(newTask);
                _db.SaveChanges();

                return(newUser.TUserID);
            }
            catch (Exception ex)
            {
                throw new WebFaultException <string>(ex.Message, HttpStatusCode.BadRequest);
            }
        }
Exemple #19
0
        public void DeleteTask()
        {
            TTask task = new TTask()
            {
                ID = 999
            };

            DBHandler.Instance.db.TTasks.Add(task);

            DBHandler.Instance.db.SaveChanges();

            DBHandler.Instance.DeleteTask(task.ID);

            DBHandler.Instance.db.SaveChanges();

            Assert.IsNull(DBHandler.Instance.getTaskByID(999));
        }
Exemple #20
0
        /// <summary>
        /// 根据监控任务,生成一个该任务的监控日志面板
        /// </summary>
        /// <param name="task">监控任务对象</param>
        private void CreateTaskLogPanel(TTask task)
        {
            taskLogPanel        = new DevExpress.XtraTab.XtraTabPage();
            taskLogPanel.Parent = tcTaskLogs;
            taskLogPanel.Name   = GetTaskLogPanelName(task);
            taskLogPanel.Text   = GetTaskLogPanelText(task);

            IRAP.UFMPS.Library.UserControls.UCMonitorLog ucLog = new IRAP.UFMPS.Library.UserControls.UCMonitorLog();
            ucLog.Parent = taskLogPanel;
            ucLog.Dock   = DockStyle.Fill;
            ucLog.Task   = task;

            taskLogPanel.Tag = ucLog;

            tcTaskLogs.TabPages.Add(taskLogPanel);

            task.LogControl    = ucLog;
            task.MonitorEvent += ucLog.OnTaskLogEvent;
        }
Exemple #21
0
        private void tmnuDeleteTask_Click(object sender, EventArgs e)
        {
            if (tlTasks.FocusedNode != null && tlTasks.FocusedNode.Tag != null)
            {
                TreeListNode deleteNode = tlTasks.FocusedNode;
                TTask        task       = (TTask)deleteNode.Tag;

                if (MessageBox.Show(
                        string.Format("请确认是否要删除当前选定的[{0}]监控任务?",
                                      task.TaskName),
                        "系统信息",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    tasks.Delete(task.TaskID);
                    tcTaskLogs.TabPages.Remove(tcTaskLogs.SelectedTabPage);
                    tlTasks.Nodes.Remove(deleteNode);
                }
            }
        }
Exemple #22
0
        public void getUserTasks()
        {
            clearDatabase();
            User user = new User();

            TTask task1 = new TTask()
            {
                ID = 1
            };
            TTask task2 = new TTask()
            {
                ID = 2
            };
            TTask task3 = new TTask()
            {
                ID = 3
            };
            TTask task4 = new TTask()
            {
                ID = 4
            };

            user.Tasks = "1,2,3,4";

            DBHandler.Instance.db.TTasks.Add(task1);
            DBHandler.Instance.db.TTasks.Add(task2);
            DBHandler.Instance.db.TTasks.Add(task3);
            DBHandler.Instance.db.TTasks.Add(task4);
            DBHandler.Instance.db.Users.Add(user);

            DBHandler.Instance.db.SaveChanges();

            Assert.AreEqual(true, Enumerable.SequenceEqual(new TTask[] { task1, task2, task3, task4 }, DBHandler.Instance.getUserTasks(user)));

            DBHandler.Instance.db.Users.Remove(user);
            DBHandler.Instance.db.TTasks.Remove(task1);
            DBHandler.Instance.db.TTasks.Remove(task2);
            DBHandler.Instance.db.TTasks.Remove(task3);
            DBHandler.Instance.db.TTasks.Remove(task4);
            DBHandler.Instance.db.SaveChanges();
        }
    public void set_Task(int id)
    {
        item_sp = FindObjectOfType <MainScene>().itme_sp;

        this.reward_Type = Reward_popop_type.Task;

        this.item_Type = Item_Type.coin;

        this.type = id;

        LocalData data = TaskData.GetInstance().Get(this.type);

        TTask tTask = Configs.TTasks[data.key.ToString()];

        img_main.sprite = item_sp[(int)item_Type];
        img_ads.sprite  = item_sp[(int)item_Type];

        this.val = tTask.Item;

        txt_val.text     = "x" + val;
        txt_ads_val.text = "x" + val * 2;
    }
Exemple #24
0
        public bool Finish(int type)
        {
            if (!this.tasks.ContainsKey(type.ToString()))
            {
                return(false);
            }
            LocalData localData = this.tasks[type.ToString()];

            if (localData.status != -2)
            {
                return(false);
            }
            TTask tTask = Configs.Configs.TTasks[localData.key.ToString()];

            if (localData.value < tTask.Value)
            {
                return(false);
            }
            localData.status            = -3;
            this.tasks[type.ToString()] = localData;
            this.SetLocalData(localData.type, localData.value, localData.key, localData.status);
            DotManager.GetInstance().CheckTask();
            return(true);
        }
Exemple #25
0
 public TaskInfo(TTask task, int priority)
 {
     Task     = task;
     Priority = priority;
 }
Exemple #26
0
 public DllExportNotifierWithTask(TTask actualTask)
 {
     this.ActualTask = actualTask;
 }
Exemple #27
0
 public void UpdateTask(TTask task)
 {
     _taskRepository.UpdateTask(task);
 }
Exemple #28
0
 public void DeleteTask(TTask task)
 {
     _taskRepository.DeleteTask(task);
 }
Exemple #29
0
 public void AddTask(int idList, TTask task)
 {
     _taskRepository.AddTask(idList, task);
 }
Exemple #30
0
    public void BindDataToUI()
    {
        if (this.id == 0)
        {
            return;
        }
        if (!Configs.TTasks.ContainsKey(this.id.ToString()))
        {
            return;
        }

        base_width = base_width != 0 ? base_width : button.GetComponent <RectTransform>().sizeDelta.x;
        base_hight = base_hight != 0 ? base_hight : button.GetComponent <RectTransform>().sizeDelta.y;

        width = base_width != 0 ? base_width : button.GetComponent <RectTransform>().sizeDelta.x;
        hight = base_hight != 0 ? base_hight : button.GetComponent <RectTransform>().sizeDelta.y;

        DOTween.Kill(button.gameObject);

        button.transform.localScale = Vector3.one;

        EventTrigger eventTrigger = button.gameObject.AddComponent <EventTrigger>();


        LocalData localData = TaskData.GetInstance().Get(this.id);
        TTask     tTask     = Configs.TTasks[this.id.ToString()];

        this.txt_awards.text = string.Format("{0}", tTask.Item);
        this.txt_desc.GetComponent <LanguageComponent>().SetText(tTask.Desc);

        float num = (float)localData.value / (float)tTask.Value;

        num = ((num >= 1f) ? 1f : num);
        this.img_pregress.fillAmount = num;

        int num2 = (localData.value > tTask.Value) ? tTask.Value : localData.value;

        this.txt_src.text = string.Format("{0}/{1}", num2, tTask.Value);

        Debug.Log(width * 0.9f);

        DOTween.To(() => width, x => width = x, width * 0.9f, 1)
        .SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo);

        DOTween.To(() => hight, x => hight = x, hight * 0.9f, 1)
        .SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo);

        if (localData.status == -1)
        {
            //바로가기
            button.GetComponent <Image>().sprite = btn[1];

            foreach (var item in btn_txt.GetComponents <Outline>())
            {
                item.effectColor = color[1];
            }

            this.btn_txt.GetComponent <LanguageComponent>().SetText("TXT_NO_20002");


            EventTrigger.Entry entry_PointerDown = new EventTrigger.Entry();
            entry_PointerDown.eventID = EventTriggerType.PointerDown;
            entry_PointerDown.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Down(button.transform); });
            eventTrigger.triggers.Add(entry_PointerDown);

            EventTrigger.Entry entry_PointerUp = new EventTrigger.Entry();
            entry_PointerUp.eventID = EventTriggerType.PointerUp;
            entry_PointerUp.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Up(button.transform); });
            eventTrigger.triggers.Add(entry_PointerUp);

            return;
        }
        if (localData.status == -2)
        {
            //받기
            button.GetComponent <Image>().sprite = btn[0];

            foreach (var item in btn_txt.GetComponents <Outline>())
            {
                item.effectColor = color[0];
            }
            this.btn_txt.GetComponent <LanguageComponent>().SetText("TXT_NO_20001");


            EventTrigger.Entry entry_PointerDown = new EventTrigger.Entry();
            entry_PointerDown.eventID = EventTriggerType.PointerDown;
            entry_PointerDown.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Down(button.transform); });
            eventTrigger.triggers.Add(entry_PointerDown);

            EventTrigger.Entry entry_PointerUp = new EventTrigger.Entry();
            entry_PointerUp.eventID = EventTriggerType.PointerUp;
            entry_PointerUp.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Up(button.transform); });
            eventTrigger.triggers.Add(entry_PointerUp);

            return;
        }
        if (localData.status == -3)
        {
            //완료
            button.GetComponent <Image>().sprite = btn[0];
            button.interactable = false;

            foreach (var item in btn_txt.GetComponents <Outline>())
            {
                item.effectColor = color[0];
            }
            this.btn_txt.GetComponent <LanguageComponent>().SetText("TXT_NO_20004");
        }
    }