Exemplo n.º 1
0
        public void pageInit()
        {
            this.dataGridViewCtrlTasks.Rows.Clear();
            System.Collections.Generic.List <GroupControlTask> allTask = GroupControlTask.GetAllTask();
            int num = 0;

            foreach (GroupControlTask current in allTask)
            {
                string msg = EcoLanguage.getMsg(LangRes.Task_TPDaily, new string[0]);
                switch (current.TaskType)
                {
                case 0:
                    msg = EcoLanguage.getMsg(LangRes.Task_TPDaily, new string[0]);
                    break;

                case 1:
                    msg = EcoLanguage.getMsg(LangRes.Task_TPWeekly, new string[0]);
                    break;

                case 2:
                    msg = EcoLanguage.getMsg(LangRes.Task_TPYearly, new string[0]);
                    break;
                }
                object[] values = new object[]
                {
                    num + 1,
                    current.TaskName,
                    msg,
                    current.GroupName,
                    current.ID.ToString()
                };
                this.dataGridViewCtrlTasks.Rows.Add(values);
                num++;
            }
            if (this.dataGridViewCtrlTasks.Rows.Count == 0)
            {
                this.butModify.Enabled = false;
                this.butDelete.Enabled = false;
                return;
            }
            this.butModify.Enabled = true;
            this.butDelete.Enabled = true;
        }
Exemplo n.º 2
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            string       value        = this.dataGridViewCtrlTasks.CurrentRow.Cells[4].Value.ToString();
            long         i_taskid     = (long)System.Convert.ToInt32(value);
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Task_delCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            GroupControlTask taskByID = GroupControlTask.GetTaskByID(i_taskid);
            int num = GroupControlTask.DeleteTaskByID(i_taskid);

            if (num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0530001", new string[]
                {
                    taskByID.TaskName,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0530001", new string[]
                {
                    taskByID.TaskName
                });
            }
            this.pageInit();
        }