Esempio n. 1
0
 private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         int index = listBox1.SelectedIndex;
         if (index > -1)
         {
             List <FormObject> forms = listBox1.Tag as List <FormObject>;
             if (forms != null && forms.Count > 0 && index < forms.Count)
             {
                 selectedForm      = forms[index];
                 this.DialogResult = System.Windows.Forms.DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("没有选择到合适的表单!");
             }
         }
     }
 }
Esempio n. 2
0
        private FormObject GetFormObject()
        {
            string name = textBox1.Text.Trim();

            if (name == "")
            {
                name = "未命名表单";
            }

            FormObject form = new FormObject();

            form.ID        = formId;
            form.FormName  = name;
            form.FormType  = comboBox1.SelectedItem as FormType;
            form.FormItems = items;
            if (formId == 0)
            {
                form.Owner = this.User;
            }
            form.Remark = textBox2.Text;
            return(form);
        }
Esempio n. 3
0
        public bool DeleteFormObject(FormObject element, User user)
        {
            if (user == null)
            {
                return(false);
            }
            string s       = "(1>1)";
            int    adminId = Common.AdminId;

            if (user.ID == adminId)
            {
                s = "(1=1)";
            }
            string sql = "delete from TF_FormObject where ID=" + element.ID + " and (Owner=" + user.ID + " or " + s + ")";
            int    r   = sqlHelper.ExecuteSql(sql);

            if (r > 0)
            {
                FormItemLogic.GetInstance().DeleteFormItems(FormItemLogic.GetItemString(element.FormItems));
            }
            return(r > 0);
        }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
 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("先选定要删除的表单!");
     }
 }
Esempio n. 6
0
 private DialogResult Next()
 {
     if (listBox1.SelectedIndex > -1)
     {
         FormObject form = listBox1.SelectedItem as FormObject;
         if (form != null)
         {
             this.owner.RefreshMsg("正在打开表单模板中,请稍候...");
             DocEditForm def = new DocEditForm(this.User, this.owner, form);
             this.owner.RefreshMsg("Ready...");
             return(def.ShowDialog());
         }
         else
         {
             MessageBox.Show("您选择的表单模板为空!");
         }
     }
     else
     {
         MessageBox.Show("请先选择一个表单模板!");
     }
     return(System.Windows.Forms.DialogResult.Cancel);
 }
Esempio n. 7
0
        public static bool NewDocument(User user, MainForm owner, FormObject form)
        {
            DocEditForm def = new DocEditForm(user, owner, form);

            return(def.ShowDialog() == DialogResult.OK);
        }