Ejemplo n.º 1
0
 public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (e.Item.Caption == "保存界面")
     {
         Stream stream = new System.IO.MemoryStream();
         this.pivotGridControl1.SaveLayoutToStream(stream);
         stream.Seek(0, System.IO.SeekOrigin.Begin);
         ERP_C009_Layout layout = new ERP_C009_Layout();
         layout.FrmType  = this.Name;
         layout.LayFiles = FileStreamHelp.StreamToBytes(stream);
         C009_Layout frm = new C009_Layout(layout);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             XtraMessageBox.Show("保存成功");
         }
     }
     else if (e.Item.Caption == "显示表头")
     {
         this.pivotGridControl1.OptionsView.ShowColumnHeaders = !this.pivotGridControl1.OptionsView.ShowColumnHeaders;
         this.pivotGridControl1.OptionsView.ShowDataHeaders   = !this.pivotGridControl1.OptionsView.ShowDataHeaders;
         this.pivotGridControl1.OptionsView.ShowFilterHeaders = !this.pivotGridControl1.OptionsView.ShowFilterHeaders;
     }
     else if (e.Item.Caption == BtnCommandEnum.Print)
     {
         PrintHelper.Print(this.pivotGridControl1, "产量统计报表", "冲压框架事业部");
     }
 }
Ejemplo n.º 2
0
        private void InitData()
        {
            this.dashboardViewer1.LoadDashboard(FileStreamHelp.FileToStream("OrderInfo.xml"));
            // this.dashboardViewer1.Dashboard.LoadFromXml()
            //this.dashboardViewer1.LoadDashboard
            var orderList = this.orderService.GetOrderDashboardModelListGroupByMouth();

            dashboardViewer1.Dashboard.DataSources[0].Data = orderList;
            dashboardViewer1.Dashboard.Title.Text          = "订单查看";
            //DataSource orderDataSource = new DataSource("Order", orderList);

            //db.DataSources.Add(orderDataSource);
            //dashboardViewer1.Dashboard = db;
        }
Ejemplo n.º 3
0
        private void ShowLayForm(string type)
        {
            var layoutService = Unity.Instance.GetService <IERP_C009_LayoutService>();
            var layout        = layoutService.GetByType(this.Name, type);

            if (layout != null)
            {
                Stream stream = FileStreamHelp.BytesToStream(layout.LayFiles);
                this.dataLayoutControl1.RestoreLayoutFromStream(stream);
                stream.Seek(0, System.IO.SeekOrigin.Begin);
                Stream stream2 = FileStreamHelp.BytesToStream(layout.LayFiles2);
                this.gridJobTxDetail.RestoreLayoutFromStream(stream2);
                stream2.Seek(0, System.IO.SeekOrigin.Begin);
            }
            else
            {
                //dataLayoutControl1.re
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 读取界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReadLayout_Click(object sender, EventArgs e)
        {
            SimpleButton btn    = sender as SimpleButton;
            var          layout = layoutService.GetByType(this.Name, btn.Text);

            if (layout != null)
            {
                Stream stream = FileStreamHelp.BytesToStream(layout.LayFiles);
                this.pivotGridControl1.RestoreLayoutFromStream(stream);
                stream.Seek(0, System.IO.SeekOrigin.Begin);
                this.pivotGridControl1.OptionsView.ShowColumnHeaders = false;
                this.pivotGridControl1.OptionsView.ShowDataHeaders   = false;
                this.pivotGridControl1.OptionsView.ShowFilterHeaders = false;
            }
            else
            {
                throw new ApplicationException("该界面尚未有保存的模版");
            }
        }
Ejemplo n.º 5
0
 public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (e.Item.Caption == BtnCommandEnum.Add)
     {
         this.mESM501JobTxBindingSource.AddNew();
         toolStrip1.Visible = true;
         dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.False;
         gridJobTxDetail.OptionsBehavior.ReadOnly  = false;
         gridControlJobTx.Enabled = false;
     }
     else if (e.Item.Caption == BtnCommandEnum.Edit)
     {
         toolStrip1.Visible = true;
         dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.False;
         gridJobTxDetail.OptionsBehavior.ReadOnly  = false;
         gridControlJobTx.Enabled = false;
     }
     else if (e.Item.Caption == BtnCommandEnum.Save)
     {
         this.gridJobTxDetail.CloseEditor();
         this.mESM501JobTxBindingSource.EndEdit();
         var jobtx             = this.mESM501JobTxBindingSource.Current as MES_M501_JobTx;
         var jobtxDetailList   = this.mESM501JobTxDetailBindingSource.DataSource as List <MES_M501_JobTxDetail>;
         var jobtxProdInfoList = this.mESM501JobTxProdInfoBindingSource.DataSource as List <MES_M501_JobTxProdInfo>;
         jobtxService.Save(jobtx, jobtxDetailList.Where(a => a.OutDt != null).ToList(), null, jobtxProdInfoList);
         //DialogResult = DialogResult.OK;
         dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.True;
         gridJobTxDetail.OptionsBehavior.ReadOnly  = true;
         gridProdInfo.OptionsBehavior.ReadOnly     = true;
         gridControlJobTx.Enabled = true;
         toolStrip1.Visible       = false;
         XtraMessageBox.Show("保存成功");
     }
     else if (e.Item.Caption == BtnCommandEnum.Cancel)
     {
         if (ERPHelper.Instance.MessageIf("确定要取消未保存的数据吗"))
         {
             this.mESM501JobTxBindingSource.CancelEdit();
             dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.True;
             gridJobTxDetail.OptionsBehavior.ReadOnly  = true;
             gridControlJobTx.Enabled = true;
             toolStrip1.Visible       = false;
         }
     }
     else if (e.Item.Caption == BtnCommandEnum.Delete)
     {
         if (ERPHelper.Instance.MessageDel())
         {
             var jobtx = this.mESM501JobTxBindingSource.Current as MES_M501_JobTx;
             jobtxService.Delete(jobtx.Id);
             mESM501JobTxBindingSource.RemoveCurrent();
             dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.True;
             gridJobTxDetail.OptionsBehavior.ReadOnly  = true;
             gridProdInfo.OptionsBehavior.ReadOnly     = true;
             gridControlJobTx.Enabled = true;
             toolStrip1.Visible       = false;
         }
     }
     if (e.Item.Caption == "保存界面")
     {
         ERP_C009_Layout layout = new ERP_C009_Layout();
         layout.FrmType = this.Name;
         Stream stream1 = new System.IO.MemoryStream();
         this.dataLayoutControl1.SaveLayoutToStream(stream1);
         stream1.Seek(0, System.IO.SeekOrigin.Begin);
         layout.LayFiles = FileStreamHelp.StreamToBytes(stream1);
         Stream stream2 = new System.IO.MemoryStream();
         this.gridJobTxDetail.SaveLayoutToStream(stream2);
         stream2.Seek(0, System.IO.SeekOrigin.Begin);
         layout.LayFiles2 = FileStreamHelp.StreamToBytes(stream2);
         C009_Layout frm = new C009_Layout(layout);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             XtraMessageBox.Show("保存成功");
         }
     }
 }