private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { Alert alert = comboBox1.SelectedItem as Alert; if (alert != null) { textBox1.Text = alert.提醒项目; dateTimePicker1.Value = alert.提醒时间; comboBox3.SelectedIndex = GetIndexByAlertType(alert.提醒方式, comboBox3); 提醒方式 type = (提醒方式)comboBox3.SelectedItem; if (type == 提醒方式.系统提示 || type == 提醒方式.员工短信) { selectStaffControl1.SelectedStaffs = Commons.GetStaffByIdStr(alert.提醒对象); } else if (type == 提醒方式.会员短信) { selectMemberControl1.SelectedMembers = Commons.GetMemberByIdStr(alert.提醒对象); } checkBox1.Checked = alert.Flag == 1; textBox3.Text = alert.备注; } } }
private void LoadItems(List <FormItem> items) { if (items != null) { panel2.SuspendLayout(); panel2.Controls.Clear(); for (int i = 0; i < items.Count; i++) { FormItem item = items[i]; if (doc == null) { SystemType type = Commons.GetSystemType(item.ItemType); switch (type) { case SystemType.附件: break; case SystemType.时间: item.ItemValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); break; case SystemType.数字: item.ItemValue = "0.00"; break; case SystemType.字符: item.ItemValue = string.Empty; break; default: break; } } DocEditControl dec = new DocEditControl(); dec.Field = item; dec.Location = new Point(width, height + (height + dec.Height) * i); dec.Width = panel2.Width - width * 2; dec.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; dec.comboBox1.Enabled = (doc == null); if (!dec.comboBox1.Enabled) {//已经存在的文档,限制编辑 bool canEdit = false; bool isAppr; int level; dec.GetExecAppr(out isAppr, out level); TaskInfo task = TaskInfoLogic.GetInstance().GetTaskInfoByEntityId(doc.ID); if (task != null) { TaskStageTemplate stageTemp = task.Flow.Template.Stages[task.Flow.CurrentIndex]; TaskStatus currentStatus = task.Flow.Current.Status; if (level == 0) { if (task.Sponsor == this.User.Username && currentStatus == TaskStatus.Initiative) { canEdit = true;//只有未被接收(即初始化状态)的文档允许文档发起者修改普通字段 } } else//level>0是执行字段和审批字段... { if (isAppr)//审批 { if (stageTemp.Approvers.Contains(this.User.ID.ToString()) && currentStatus == TaskStatus.Processed) { canEdit = true; } } else//执行 { if (stageTemp.Executors.Contains(this.User.ID.ToString()) && currentStatus == TaskStatus.Processing) { canEdit = true; } } } } else { canEdit = true;//没启动流程之前的文档可以修改任何字段 } dec.CanEdit = canEdit; } panel2.Controls.Add(dec); } panel2.ResumeLayout(true); } }
private void ImportData(DataTable data, FieldMap <string, string> map, bool clearOldData = true) { ImportDataProcessHandler process = new ImportDataProcessHandler(ImportProcess); bool f = Commons.ImportData(comboBox2.Text, clearOldData, data, map, process); }