private void BarButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            var xtraOpenFileDialog = new XtraOpenFileDialog
            {
                AddExtension = true,
                Filter       = @"图片文件| *.png;*.jpg;*.jpeg",
                Multiselect  = true
            };

            if (xtraOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (var fileName in xtraOpenFileDialog.FileNames)
                {
                    var fileInfo           = new FileInfo(fileName);
                    var fileUploadResponse = fileInfo.UploadFile("反面样式");
                    SystemBackStyleApi.InsertBackStyle(
                        fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length),
                        fileUploadResponse.Id,
                        result =>
                    {
                        if (gridControl1.DataSource is List <BackStyleResponse> dataSource)
                        {
                            dataSource.Add(result);
                            gridControl1.RefreshDataSource();
                        }
                    },
                        message => { XtraMessageBox.Show("反面样式插入失败!"); });
                }
            }
        }
        public BackStyleManageForm()
        {
            InitializeComponent();

            SystemBackStyleApi.GetAllBackStyleFromServer(
                result => { gridControl1.DataSource = result; },
                message => { XtraMessageBox.Show(message); });
        }
 private void BarButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (gridView1.GetRow(gridView1.FocusedRowHandle) is BackStyleResponse backStyleResponse)
     {
         SystemBackStyleApi.DeleteById(backStyleResponse.Id, result =>
         {
             if (gridControl1.DataSource is List <BackStyleResponse> backStyleResponses)
             {
                 backStyleResponses.Remove(backStyleResponse);
                 gridControl1.RefreshDataSource();
             }
         });
     }
 }
        private void GridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            var row = gridView1.GetRow(e.RowHandle);

            if (row is BackStyleResponse backStyleResponse)
            {
                SystemBackStyleApi.UpdateBackStyle(backStyleResponse.Id, new BackStyleUpdateRequest
                {
                    Name = backStyleResponse.Name
                }, result =>
                {
                    // XtraMessageBox.Show("更新成功");
                    // var toastNotification = new                    ToastNotification();
                    // toastNotification.Body = "更新成功!";
                    // toastNotification.
                });
            }
        }
예제 #5
0
 public EnvelopeSettingControl()
 {
     InitializeComponent();
     SystemSizeApi.GetSizeInfoFromServer("productSize", response =>
     {
         response.ForEach(k => productSizeList.Items.Add(new PostSize
         {
             Name   = k.Name,
             Width  = k.Width,
             Height = k.Height
         }));
         productSizeList.Refresh();
     });
     SystemBackStyleApi.GetAllBackStyleFromServer(success =>
                                                  success.ForEach(backStyle => backStyleList.Items.Add(new BackStyleInfo
     {
         FileId = backStyle.FileId,
         Name   = backStyle.Name
     })));
 }