コード例 #1
0
 internal EditFieldForm(IServiceUI editor, ServiceAction action, Field field, ServiceEntity service)
 {
     InitializeComponent();
     _action = action;
     _field = field;
     _service = service;
     _editor = editor;
 }
コード例 #2
0
ファイル: Field.cs プロジェクト: lidonghao1116/ProjectManager
        internal static Field CreateNew(string fieldName)
        {
            Field field = new Field();
            field.Target = fieldName;
            field.Mandatory = true;
            field.InputConverter = ConverterType.Empty;
            field.OutputConverter = ConverterType.Empty;
            field.Quote = true;
            field.AutoNumber = false;
            field.Required = false;
            field.Source = StringUtil.ConvertToDisplayName(fieldName);
            field.Alias = StringUtil.ConvertToDisplayName(fieldName);

            return field;
        }
コード例 #3
0
        internal FieldList(XmlElement fieldListElement)
        {
            Fields = new List<Field>();
            this.Name = string.Empty;       
            this.Source = string.Empty;

            if (fieldListElement == null)
                return;
            
            this.Name = fieldListElement.GetAttribute("Name");
            this.Source = fieldListElement.GetAttribute("Source");

           
            XmlHelper h = new XmlHelper(fieldListElement);
            foreach (XmlElement fieldElement in h.GetElements("Field"))
            {
                Field field = new Field(fieldElement);
                Fields.Add(field);
            }
        }
コード例 #4
0
 private void FillFieldRow(DataGridViewRow row, Field field)
 {
     row.Tag = field;
     foreach (DataGridViewColumn col in dgFieldList.Columns)
     {
         foreach (PropertyInfo info in field.GetType().GetProperties(FLAG))
         {
             if (info.Name == col.Name)
                 row.Cells[col.Name].Value = info.GetValue(field, null).ToString();
         }
     }
 }
コード例 #5
0
 internal FieldEventArgs(Field field)
 {
     this.Field = field;
 }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            err.Clear();
            bool valid = true;

            if (string.IsNullOrWhiteSpace(txtSource.Text))
            {
                err.SetError(txtSource, "不可空白");
                valid = false;
            }

            if (string.IsNullOrWhiteSpace(cboTarget.Text))
            {
                err.SetError(cboTarget, "不可空白");
                valid = false;
            }

            if (cboSourceType.Text == SourceType.Variable.ToString())
            {
                bool contains = false;
                foreach (IVariable v in _service.Variables)
                {
                    if (v.Name == txtSource.Text)
                    {
                        contains = true;
                        break;
                    }
                }

                if (!contains)
                {
                    foreach (Preprocess p in _service.Preprocesses)
                    {
                        if (p.Type == PreprocessType.Variable && p.Name == txtSource.Text)
                        {
                            contains = true;
                            break;
                        }
                    }
                }

                if (!contains)
                {
                    err.SetError(txtSource, "InternalVariable 中不包含此變數");
                    valid = false;
                }
            }

            if (!valid) return;

            if (Completed == null)
            {
                this.Close();
                return;
            }

            Field field = new Field();
            field.Alias = txtAlias.Text;
            field.AutoNumber = chkAutoNumber.Checked;
            field.InputConverter = ConverterType.Parse(cboInputConverter.Text);
            field.OutputConverter = ConverterType.Parse(cboOutputConverter.Text);
            field.Mandatory = chkMandatory.Checked;
            field.Quote = chkQuote.Checked;
            field.Required = chkRequired.Checked;
            field.Source = txtSource.Text;
            field.Target = cboTarget.Text;

            IOType itype = IOType.Element;
            if (!Enum.TryParse<IOType>(cboInputType.Text, true, out itype))
                itype = IOType.Element;

            field.InputType = itype;

            IOType otype = IOType.Element;
            if (!Enum.TryParse<IOType>(cboOutputType.Text, true, out otype))
                otype = IOType.Element;

            field.OutputType = otype;

            SourceType stype = SourceType.Request;
            if (!Enum.TryParse<SourceType>(cboSourceType.Text, true, out stype))
                stype = SourceType.Request;

            field.SourceType = stype;

            Completed.Invoke(this, new FieldEventArgs(field));
            this.Close();
        }
コード例 #7
0
ファイル: Field.cs プロジェクト: lidonghao1116/ProjectManager
 internal static Field Parse(System.Windows.Forms.DataGridViewRow row)
 {
     Field field = new Field();
     field.Alias = GetValue(row, "Alias");
     field.AutoNumber = GetBoolean(row, "AutoNumber", false);
     field.InputConverter = ConverterType.Parse(GetValue(row, "InputConverter"));
     field.InputType = GetIOType(row, "InputType");
     field.Mandatory = GetBoolean(row, "Mandatory", false);
     field.OutputConverter = ConverterType.Parse(GetValue(row, "OutputConverter"));
     field.OutputType = GetIOType(row, "OutputType");
     field.Quote = GetBoolean(row, "Quote", true);
     field.Required = GetBoolean(row, "Required", false);
     field.Source = GetValue(row, "Source");
     field.SourceType = GetSourceType(row, "SourceType");
     field.Target = GetValue(row, "Target");
     return field;
 }