private void button1_Click(object sender, EventArgs e) { if (form != null) { FormObjectLogic al = FormObjectLogic.GetInstance(); if (al.ExistsName(form.FormName)) { if (MessageBox.Show("系统中已经存在该表单,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { int id = al.AddFormObject(form); if (id > 0) { form.ID = id; LoadFormObjects(); MessageBox.Show("添加成功!"); } } } else { int id = al.AddFormObject(form); if (id > 0) { form.ID = id; LoadFormObjects(); MessageBox.Show("添加成功!"); } } } else { MessageBox.Show("请先编辑好表单!"); } }
private void button3_Click(object sender, EventArgs e) { SelectOneForm sof = new SelectOneForm(); if (sof.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (sof.SelectedForm != null) { FormObject thisForm = sof.SelectedForm; if (this.User != null) { thisForm.Owner = this.User; } if (MessageBox.Show("确定只提取原表单的格式(不要原来的数据)?", "模板提取提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { thisForm = Commons.GetFormModule(sof.SelectedForm, this.User); } string name; int id = FormObjectLogic.GetInstance().CopyFormObject(thisForm, out name); thisForm.ID = id; LoadFormObject(thisForm); } else { MessageBox.Show("是否没选到合法的表单?要复制的表单为空!"); } } sof.Dispose(); }
public List <DocObject> GetDocObjectsByOwner(User user) { List <DocObject> elements = new List <DocObject>(); string sql = "select * from TF_DocObject where Owner=" + user.ID; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { FormObjectLogic fol = FormObjectLogic.GetInstance(); FormItemLogic fil = FormItemLogic.GetInstance(); UserLogic ul = UserLogic.GetInstance(); for (int i = 0; i < dt.Rows.Count; i++) { DocObject element = new DocObject(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.Name = dt.Rows[i]["Name"].ToString(); element.Form = fol.GetFormObject(Convert.ToInt32(dt.Rows[i]["FormID"])); element.DocItems = fil.GetFormItemsByIds(dt.Rows[i]["DocItems"].ToString()); element.Owner = ul.GetUser(Convert.ToInt32(dt.Rows[i]["Owner"])); element.Remark = dt.Rows[i]["Remark"].ToString(); element.Flag = Convert.ToInt32(dt.Rows[i]["Flag"]); elements.Add(element); } } return(elements); }
public List <DocObject> GetDocObjectsByTemplateId(List <int> flowTemplateIds) { List <DocObject> elements = new List <DocObject>(); if (flowTemplateIds != null && flowTemplateIds.Count > 0) { string sql = "select TF_DocObject.* from TF_DocObject,TaskInfo,Flow,FlowTemplate where TF_DocObject.ID=TaskInfo.EntityId and TaskInfo.FlowID=Flow.ID and Flow.TemplateID in (" + flowTemplateIds + ")"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { FormObjectLogic fol = FormObjectLogic.GetInstance(); FormItemLogic fil = FormItemLogic.GetInstance(); UserLogic ul = UserLogic.GetInstance(); for (int i = 0; i < dt.Rows.Count; i++) { DocObject element = new DocObject(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.Name = dt.Rows[i]["Name"].ToString(); element.Form = fol.GetFormObject(Convert.ToInt32(dt.Rows[i]["FormID"])); element.DocItems = fil.GetFormItemsByIds(dt.Rows[i]["DocItems"].ToString()); element.Owner = ul.GetUser(Convert.ToInt32(dt.Rows[i]["Owner"])); element.Remark = dt.Rows[i]["Remark"].ToString(); element.Flag = Convert.ToInt32(dt.Rows[i]["Flag"]); elements.Add(element); } } } return(elements); }
public static FormObjectLogic GetInstance() { if (instance == null) { instance = new FormObjectLogic(); } return(instance); }
private void LoadAllFormObjects() { List <FormObject> forms = FormObjectLogic.GetInstance().GetAllFormObjects(); listBox1.Items.Clear(); foreach (FormObject form in forms) { listBox1.Items.Add(form); } }
private void LoadFormObjects() { List <FormObject> elements = FormObjectLogic.GetInstance().GetAllFormObjects(); comboBox1.Items.Clear(); foreach (FormObject element in elements) { comboBox1.Items.Add(element); } dataGridView1.DataSource = FormObjectLogic.GetInstance().GetFormObjects(string.Empty); }
private void LoadAllFormObjects() { listBox1.Items.Clear(); List <FormObject> forms = FormObjectLogic.GetInstance().GetAllFormObjects(); listBox1.Tag = forms; foreach (FormObject form in forms) { string info = form.FormInfo; listBox1.Items.Add(info); } }
private void FormEditForm_Load(object sender, EventArgs e) { base.DisableUserPermission(this); LoadFormTypes(); if (formId > 0) { FormObject form = FormObjectLogic.GetInstance().GetFormObject(formId); if (form != null) { comboBox1.SelectedIndex = GetIndexByFormType(form.FormType, comboBox1); } } }
private DataTable Search(string name = null, FormType formType = null) { string nm = ""; if (!string.IsNullOrEmpty(name) && name.Trim() != "") { nm = " and FormName like '%" + name + "%'"; } string ft = ""; if (formType != null) { ft = " and FormType=" + formType.ID; } string where = "(1=1)" + nm + ft; return(FormObjectLogic.GetInstance().GetFormObjects(where)); }
public DocObject GetDocObject(int id) { string sql = "select * from TF_DocObject where ID=" + id; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { DocObject element = new DocObject(); element.ID = id; element.Name = dt.Rows[0]["Name"].ToString(); element.Form = FormObjectLogic.GetInstance().GetFormObject(Convert.ToInt32(dt.Rows[0]["FormID"])); element.DocItems = FormItemLogic.GetInstance().GetFormItemsByIds(dt.Rows[0]["DocItems"].ToString()); element.Owner = UserLogic.GetInstance().GetUser(Convert.ToInt32(dt.Rows[0]["Owner"])); element.Remark = dt.Rows[0]["Remark"].ToString(); element.Flag = Convert.ToInt32(dt.Rows[0]["Flag"]); return(element); } return(null); }
private void button3_Click(object sender, EventArgs e) { SelectOneForm sof = new SelectOneForm(); if (sof.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (sof.SelectedForm != null) { FormObject thisForm = sof.SelectedForm; string name; int id = FormObjectLogic.GetInstance().CopyFormObject(thisForm, out name); thisForm.ID = id; thisForm.FormName = name; LoadFormObject(thisForm); } else { MessageBox.Show("是否没选到合法的表单?要复制的表单为空!"); } } sof.Dispose(); }
private void button2_Click(object sender, EventArgs e) { if (form != null) { FormObjectLogic al = FormObjectLogic.GetInstance(); if (al.ExistsNameOther(form.FormName, form.ID)) { if (MessageBox.Show("系统中已经存在该表单,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { if (al.UpdateFormObject(form, this.User)) { LoadFormObjects(); MessageBox.Show("修改成功!"); } else { MessageBox.Show("修改失败或者您没有权限修改别人的表单!"); } } } else { if (al.UpdateFormObject(form, this.User)) { LoadFormObjects(); MessageBox.Show("修改成功!"); } else { MessageBox.Show("修改失败或者您没有权限修改别人的表单!"); } } } else { MessageBox.Show("所选择的表单为空!"); } }
private void button3_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { if (MessageBox.Show("确定要删除该表单?", "删除表单", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { FormObject formObject = (FormObject)comboBox1.SelectedItem; if (FormObjectLogic.GetInstance().DeleteFormObject(formObject, this.User)) { MessageBox.Show("删除表单成功!"); LoadFormObjects(); } else { MessageBox.Show("删除失败或者您没有权限删除别人的表单!"); } } } else { MessageBox.Show("先选定要删除的表单!"); } }