private void Init_theSchedule(Guid versionCode) { this._DtSchedule.Reset(); this._DtSchedule.Columns.Add(new DataColumn("TaskCode", typeof(string))); this._DtSchedule.Columns.Add(new DataColumn("TaskName", typeof(string))); this._DtSchedule.Columns.Add(new DataColumn("ParentTaskCode", typeof(string))); this._DtSchedule.Columns.Add(new DataColumn("Quantity", typeof(decimal))); this._DtSchedule.Columns.Add(new DataColumn("SumCompleteQuantity", typeof(decimal))); this._DtSchedule.Columns.Add(new DataColumn("total", typeof(decimal))); this._DtSchedule.Columns.Add(new DataColumn("cctotal", typeof(decimal))); this._DtSchedule.Columns.Add(new DataColumn("IsHaveChild", typeof(string))); ArrayList allTemp = TemplatesAction.getAllTemp(); for (int i = 0; i < allTemp.Count; i++) { DataRow dataRow = this._DtSchedule.NewRow(); Templates templates = (Templates)allTemp[i]; dataRow["TaskCode"] = templates.TemplatesCode; dataRow["TaskName"] = templates.TemplatesName; dataRow["ParentTaskCode"] = templates.ParentCode; dataRow["Quantity"] = BindBudgetAction.getTotalQuantity(this.hdnPrjGuid.Value, templates.TemplatesCode); dataRow["SumCompleteQuantity"] = BindBudgetAction.gettotalSumCompleteQuantity(this.hdnPrjGuid.Value, templates.TemplatesCode); dataRow["total"] = BindBudgetAction.getAlltotal(this.hdnPrjGuid.Value, templates.TemplatesCode); dataRow["cctotal"] = BindBudgetAction.getAllccTotal(this.hdnPrjGuid.Value, templates.TemplatesCode); this._DtSchedule.Rows.Add(dataRow); } }
protected void BtnSave_Click(object sender, EventArgs e) { Templates costApproveData = this.GetCostApproveData(); if (base.Request["t"].ToString().Equals("Add")) { bool flag = TemplatesAction.Add(costApproveData); if (flag) { JavaScriptControl expr_38 = this.JS; expr_38.Text += "location.href='CostFrameAnalyze.aspx?type=manage';"; } else { this.JS.Text = "alert('添加失败!');location.href='CostFrameAnalyze.aspx?type=manage';"; } } if (base.Request["t"].ToString().Equals("Upd")) { bool flag2 = TemplatesAction.Update(costApproveData); if (flag2) { this.JS.Text = "location.href='CostFrameAnalyze.aspx?type=manage';"; return; } this.JS.Text = "alert('编辑失败!');location.href='CostFrameAnalyze.aspx?type=manage';"; } }
private void Init_theWork() { this.dtWork.Columns.Add(new DataColumn("ParentCode", typeof(string))); this.dtWork.Columns.Add(new DataColumn("TempCode", typeof(string))); this.dtWork.Columns.Add(new DataColumn("TempName", typeof(string))); this.dtWork.Columns.Add(new DataColumn("IsHaveChild", typeof(string))); ArrayList allTemp = TemplatesAction.getAllTemp(); for (int i = 0; i < allTemp.Count; i++) { DataRow dataRow = this.dtWork.NewRow(); Templates templates = (Templates)allTemp[i]; dataRow["ParentCode"] = templates.ParentCode; dataRow["TempCode"] = templates.TemplatesCode; dataRow["TempName"] = templates.TemplatesName; this.dtWork.Rows.Add(dataRow); } }
protected void Page_Load(object sender, EventArgs e) { if (base.Request["nc"] == null) { this.RegisterStartupScript("", "<script>alert('参数错误!');</script>"); return; } this.NodeCode = base.Request["nc"].ToString(); if (!this.Page.IsPostBack) { if (base.Request["t"].ToString().Equals("Add")) { string text = TemplatesAction.initCode(this.NodeCode); this.TxtCBSCode.Text = text; } if (base.Request["t"].ToString().Equals("Upd")) { Templates model = TemplatesAction.GetModel(this.NodeCode); this.TxtCBSCode.Text = model.TemplatesCode; this.TxtCostName.Text = model.TemplatesName; } } }
protected void btnDel_Click(object sender, EventArgs e) { if (!TemplatesAction.getPare(this.hdnWorkCode.Value.Trim())) { if (TemplatesAction.Delete(this.hdnWorkCode.Value)) { if (!BindBudgetAction.Delete(this.hdnWorkCode.Value)) { this.RegisterStartupScript("", "<script>alert('绑定删除失败!');</script>"); } } else { this.RegisterStartupScript("", "<script>alert('删除失败!');</script>"); } } else { this.RegisterStartupScript("", "<script>alert('该级别下面有分级,请先删除分级!');</script>"); } this.Init_theWork(); this.tblWork_Create(true); }
public MainWindow() { InitializeComponent(); NotificationManager.Instance.Targets.Add(this); Closing += (sender, e) => NotificationManager.Instance.Targets.Remove(this); groupOpen = new TasksGroupControl("Open tasks"); groupPostponed = new TasksGroupControl("Postponed tasks"); groupClosed = new TasksGroupControl("Closed tasks"); groups.Add(groupOpen); groups.Add(groupPostponed); groups.Add(groupClosed); foreach (TasksGroupControl group in groups) { pnlGroups.Children.Add(group); group.OnTaskSelect += OnTaskSelect; group.OnTaskSelected += OnTaskSelected; } groupOpen.BackgroundSelector = new OpenTaskBackgroundSelector(); groupPostponed.BackgroundSelector = new OpenTaskBackgroundSelector(); groupClosed.BackgroundSelector = new TaskBackgroundSelector(); groupOpen.DateSelector = new DeadlineSelector(); groupPostponed.DateSelector = new DeadlineSelector(); groupClosed.DateSelector = new ClosedSelector(); groupOpen.ActivityVisibilitySelector = new SimpleBoolSelector(true); groupPostponed.ActivityVisibilitySelector = new SimpleBoolSelector(false); groupClosed.ActivityVisibilitySelector = new SimpleBoolSelector(false); groupOpen.GroupIconsSelector = new DeadlineIconsSelector(); groupPostponed.GroupIconsSelector = new DeadlineIconsSelector(); groupOpen.TaskDoubleClick += t => Command_EditTask(null, null); groupPostponed.TaskDoubleClick += t => Command_EditTask(null, null); groupClosed.TaskDoubleClick += t => Command_ShowTask(null, null); groupOpen.AddOrderSelector(x => x.Task.Deadline, false).AddOrderSelector(x => x.Task.Priority, true); groupPostponed.AddOrderSelector(x => x.Task.Deadline, false).AddOrderSelector(x => x.Task.Priority, true); groupClosed.AddOrderSelector(x => x.Task.Closed, true); groupOpen.OnTaskControlCreated += t => ActionsCollection.Instance.Add(new TaskControlAction(t)); groupPostponed.OnTaskControlCreated += t => ActionsCollection.Instance.Add(new TaskControlAction(t)); groupOpen.OnTaskControlRemove += t => ActionsCollection.Instance.Remove(ActionsCollection.Instance.Actions.OfType <TaskControlAction>().FirstOrDefault(x => x.TaskControl == t)); groupPostponed.OnTaskControlRemove += t => ActionsCollection.Instance.Remove(ActionsCollection.Instance.Actions.OfType <TaskControlAction>().FirstOrDefault(x => x.TaskControl == t)); groupOpen.Collapse(false); ActionsCollection.Instance.Add(new DeadlineIconsAction(groupOpen)); ActionsCollection.Instance.Add(new DeadlineIconsAction(groupPostponed)); ActionsCollection.Instance.Add(new TaskArchivingAction(groupClosed)); using (IRepository <Task, long> repository = PersistentFactory.GetContext().GetRepository <Task, long>()) { foreach (Task task in repository.GetAll()) { switch (task.State) { case TaskState.Open: groupOpen.AddTask(task); ActionsCollection.Instance.Add(new TaskDeadlineAction(task)); break; case TaskState.Postponed: groupPostponed.AddTask(task); ActionsCollection.Instance.Add(new TaskDeadlineAction(task)); break; case TaskState.Closed: groupClosed.AddTask(task); break; } } } TemplatesAction templatesAction = new TemplatesAction(); templatesAction.TaskCreated += task => { if (task != null) { groupOpen.Dispatcher.Invoke(() => groupOpen.AddTask(task)); using (IRepository <Task, long> repository = PersistentFactory.GetContext().GetRepository <Task, long>()) repository.Add(task); StatsHelper.Update(StatsData.TaskCreated); StatsHelper.Update(StatsData.TaskCreatedFromTemplate); NotificationHelper.Notify(NotificationType.TaskCreatedFromTemplate, task.Name); ActionsCollection.Instance.Add(new TaskDeadlineAction(task)); } }; ActionsCollection.Instance.Add(templatesAction); ActionsCollection.Instance.Add(new LastRunAction()); backgroundThread.Start(); RefreshMenu(); Log.Debug($"{groups.Sum(x => x.Count)} tasks loaded", this); Log.Info("Main window opened", this); }