Exemplo n.º 1
0
        public async Task <ActionResult <ChangeField> > PostChangeField(ChangeField changeField)
        {
            _context.ChangeFields.Add(changeField);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetChangeField", new { id = changeField.ID }, changeField));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutChangeField(int id, ChangeField changeField)
        {
            if (id != changeField.ID)
            {
                return(BadRequest());
            }

            _context.Entry(changeField).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChangeFieldExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("ID,Field")] ChangeField changeField)
        {
            if (ModelState.IsValid)
            {
                await NetworkMethodModel.Post <ChangeField>(ConsulUri, changeField);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(changeField));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Field")] ChangeField changeField)
        {
            if (id != changeField.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                await NetworkMethodModel.Put <ChangeField>(ConsulUri, id, changeField);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(changeField));
        }
Exemplo n.º 5
0
 protected void OnPropertyChanged(string propertyName)
 {
     if (!InitReady)
     {
         return;
     }
     if (!ChangeField.Contains(propertyName))
     {
         ChangeField.Add(propertyName);
     }
     if (this.State == EDBEntityState.UnChanged)
     {
         this.State = EDBEntityState.Modified;
     }
 }
        private BuildStatus GetStatus(string buildTypeId)
        {
            var pendingChanges = this.teamCityClient.Changes.ByBuildConfigId(buildTypeId).FirstOrDefault();
            var queuedBuild    = this.teamCityClient.BuildQueue.ByBuildTypeLocator(BuildTypeLocator.WithId(buildTypeId)).FirstOrDefault();
            var runningBuild   = this.teamCityClient.Builds.ByBuildLocator(BuildLocator.WithDimensions(BuildTypeLocator.WithId(buildTypeId), running: true)).FirstOrDefault();
            var lastBuild      = this.teamCityClient.Builds
                                 .GetFields(BuildsField
                                            .WithFields(BuildField.WithFields(
                                                            true,
                                                            true,
                                                            changes: ChangesField.WithFields(ChangeField.WithFields(true)),
                                                            status: true))
                                            .ToString()).ByBuildConfigId(buildTypeId).OrderByDescending(x => x.Number).FirstOrDefault();

            if (lastBuild != null)
            {
                return(new BuildStatus(queuedBuild != null | runningBuild != null | GetHasPendingChanges(pendingChanges, lastBuild), lastBuild.Status));
            }

            return(new BuildStatus(false, "None"));
        }
Exemplo n.º 7
0
        private void contextMenuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.contextMenuStrip2.Visible = false;
            try
            {
                if (e.ClickedItem.Text == "文本内容")
                {
                    IInput input = new InputString();
                    string def   = "";
                    if (SelectObjects.Count == 1)
                    {
                        IContextable contextable = (IContextable)SelectObjects[0];
                        def = contextable.Context;
                    }
                    if (input.Input(def, out def) == true)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IContextable contextable = (IContextable)ins;
                            contextable.Context = def;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "文本对齐")
                {
                    ISelectContextAlign align = new SelectContextAlign();
                    int def = 0;
                    if (SelectObjects.Count == 1)
                    {
                        IContextAlignAble contextalignable = (IContextAlignAble)SelectObjects[0];
                        def = contextalignable.Align;
                    }
                    if (align.Select(def, out def) == true)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IContextAlignAble contextalignable = (IContextAlignAble)ins;
                            contextalignable.Align = def;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "区域")
                {
                    IInput input = new InputString();
                    int    Area  = -1;
                    if (SelectObjects.Count == 1)
                    {
                        IChangeAreaAble changeareaable = (IChangeAreaAble)SelectObjects[0];
                        Area = changeareaable.Area;
                    }
                    IChangePrintArea printarea = new ChangePrintArea();
                    if (printarea.Change(Area, out Area) == true)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IChangeAreaAble changeareaable = (IChangeAreaAble)ins;
                            changeareaable.Area = Area;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "删除")
                {
                    List <IPrintObject> lst = new List <IPrintObject>();
                    foreach (IPrintObject ins in SelectObjects)
                    {
                        lst.Add(ins);
                    }
                    foreach (IPrintObject ins in lst)
                    {
                        IDeleteable deleteable = (IDeleteable)ins;
                        deleteable.Delete(pnl);
                    }
                    Record();
                }
                else if (e.ClickedItem.Text == "字体")
                {
                    FontDialog f = new FontDialog();

                    if (SelectObjects.Count == 1)
                    {
                        IFontable fontable = (IFontable)SelectObjects[0];
                        f.Font = fontable.Font;
                    }
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IFontable fontable = (IFontable)ins;
                            fontable.Font = f.Font;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "边框")
                {
                    IEditBorder border       = new EditBorder();
                    int         borderLeft   = 0;
                    int         borderRight  = 0;
                    int         borderTop    = 0;
                    int         borderBottom = 0;
                    if (SelectObjects.Count == 1)
                    {
                        IBorderable borderable = (IBorderable)SelectObjects[0];
                        borderLeft   = borderable.BorderLeft;
                        borderRight  = borderable.BorderRight;
                        borderTop    = borderable.BorderTop;
                        borderBottom = borderable.BorderBottom;
                    }
                    if (border.EditBorder(borderLeft, borderRight, borderTop, borderBottom,
                                          out borderLeft, out borderRight, out borderTop, out borderBottom) == true)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IBorderable borderable = (IBorderable)ins;
                            borderable.BorderLeft   = borderLeft;
                            borderable.BorderRight  = borderRight;
                            borderable.BorderTop    = borderTop;
                            borderable.BorderBottom = borderBottom;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "颜色")
                {
                    ColorDialog f   = new ColorDialog();
                    Color       def = Color.Black;
                    if (SelectObjects.Count == 1)
                    {
                        IColorable colorable = (IColorable)SelectObjects[0];
                        def = colorable.Color;
                    }
                    f.Color = def;
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IColorable colorable = (IColorable)ins;
                            colorable.Color = f.Color;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "左对齐")
                {
                    ISizeable sizeable2 = (ISizeable)_fistSelectObject;
                    foreach (IPrintObject ins in SelectObjects)
                    {
                        ISizeable sizeable = (ISizeable)ins;

                        sizeable.Location = new Point(sizeable2.Location.X, sizeable.Location.Y);
                    }
                    Record();
                }
                else if (e.ClickedItem.Text == "右对齐")
                {
                    ISizeable sizeable2 = (ISizeable)_fistSelectObject;
                    foreach (IPrintObject ins in SelectObjects)
                    {
                        ISizeable sizeable = (ISizeable)ins;

                        sizeable.Location = new Point((sizeable2.Location.X + sizeable2.Size.Width) - sizeable.Size.Width, sizeable.Location.Y);
                    }
                    Record();
                }
                else if (e.ClickedItem.Text == "上对齐")
                {
                    ISizeable sizeable2 = (ISizeable)_fistSelectObject;
                    foreach (IPrintObject ins in SelectObjects)
                    {
                        ISizeable sizeable = (ISizeable)ins;

                        sizeable.Location = new Point(sizeable.Location.X, sizeable2.Location.Y);
                    }
                    Record();
                }
                else if (e.ClickedItem.Text == "下对齐")
                {
                    ISizeable sizeable2 = (ISizeable)_fistSelectObject;
                    foreach (IPrintObject ins in SelectObjects)
                    {
                        ISizeable sizeable = (ISizeable)ins;

                        sizeable.Location = new Point(sizeable.Location.X, (sizeable2.Location.Y + sizeable2.Size.Height) - sizeable.Size.Height);
                    }
                    Record();
                }
                else if (e.ClickedItem.Text == "表格内容")
                {
                    IGridable     gridable = (IGridable)_fistSelectObject;
                    List <string> lst      = new List <string>();

                    if (tbdetail != null)
                    {
                        foreach (System.Data.DataColumn col in tbdetail.Columns)
                        {
                            if (col.ColumnName.StartsWith("#") == false)
                            {
                                lst.Add(col.ColumnName);
                            }
                        }
                    }

                    if (lst.Contains("#") == false)
                    {
                        lst.Add("#");
                    }
                    if (lst.Contains("i") == false)
                    {
                        lst.Add("i");
                    }



                    if (gridable.EditGrid(lst.ToArray()) == true)
                    {
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "表格格式")
                {
                    IGridable gridable = (IGridable)_fistSelectObject;
                    if (gridable.SetStyle() == true)
                    {
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "导入图片")
                {
                    OpenFileDialog f = new OpenFileDialog();
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        var     fileInfo = new System.IO.FileInfo(f.FileName);
                        decimal len      = Conv.ToDecimal(fileInfo.Length);
                        len = len / 1024;
                        if (len > 500)
                        {
                            throw new Exception("图片文件大于500K");
                        }
                        var        img       = Image.FromFile(f.FileName);
                        IImageAble imageable = (IImageAble)_fistSelectObject;
                        imageable.Image = img;
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "导出图片")
                {
                    IImageAble imageable = (IImageAble)_fistSelectObject;
                    if (imageable.Image == null)
                    {
                        throw new Exception("无可导出的图片");
                    }
                    else
                    {
                        SaveFileDialog f = new SaveFileDialog();
                        f.Filter = "*.jpg|*.jpg";
                        if (f.ShowDialog() == DialogResult.OK)
                        {
                            imageable.Image.Save(f.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
                        }
                    }
                }
                else if (e.ClickedItem.Text == "属性")
                {
                    System.Windows.Forms.MessageBox.Show(_fistSelectObject.propertyInfo, "属性");
                }
                else if (e.ClickedItem.Text == "格式化")
                {
                    IInput input = new InputFormatString();
                    string def   = "";
                    if (SelectObjects.Count == 1)
                    {
                        IFormatable formatable = (IFormatable)SelectObjects[0];
                        def = formatable.Format;
                    }
                    if (input.Input(def, out def) == true)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IFormatable formatable = (IFormatable)ins;
                            formatable.Format = def;
                        }
                        Record();
                    }
                }
                else if (e.ClickedItem.Text == "改字段")
                {
                    string def = "";
                    if (SelectObjects.Count == 1)
                    {
                        IFieldAble fieldable = (IFieldAble)SelectObjects[0];
                        def = fieldable.Field;
                    }
                    IChangeField  chg = new ChangeField();
                    List <string> lst = new List <string>();
                    if (tbmain != null)
                    {
                        foreach (System.Data.DataColumn col in tbmain.Columns)
                        {
                            lst.Add(col.ColumnName);
                        }
                    }
                    if (chg.Change(lst.ToArray(), def, out def) == true)
                    {
                        foreach (IPrintObject ins in SelectObjects)
                        {
                            IFieldAble fieldable = (IFieldAble)ins;
                            fieldable.Field = def;
                        }
                        Record();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }