Пример #1
0
        //string filePath = Application.StartupPath+"\\PicFile\\";//"D:\\ERPToysPic\\";

        public GoodsEditPage(EDMX.MainMenu menu, Object obj)
        {
            InitializeComponent();
            mainMenu = menu;
            if (obj == null)
            {
                goodsBindingSource.DataSource = new Goods();
            }
            else
            {
                //将图片缩略图转为原图
                if (!System.IO.Directory.Exists(MainForm.DownloadFilePath))
                {
                    System.IO.Directory.CreateDirectory(MainForm.DownloadFilePath);
                }
                string fileName     = MainForm.DownloadFilePath + String.Format("{0}.jpg", ((Goods)obj).Code);
                string strErrorinfo = string.Empty;
                bool   result       = true;
                if (((Goods)obj).Pic != null)
                {
                    if (!File.Exists(fileName))
                    {
                        //FtpUpDown ftpUpDown = new FtpUpDown(MainForm.ServerUrl, MainForm.ServerUserName, MainForm.ServerPassword);
                        //result = ftpUpDown.Download(MainForm.DownloadFilePath, String.Format("{0}.jpg", ((Goods)obj).Code), out strErrorinfo);
                    }
                    if (result)
                    {
                        try
                        {
                            Image img = Image.FromFile(fileName);
                            ((Goods)obj).Pic = ImageHelper.MakeBuff(img);
                            img.Dispose();
                        }
                        catch { }
                    }
                    else
                    {
                        XtraMessageBox.Show(string.Format("{0},不能显示货品原图,只显示货品缩略图。", strErrorinfo), "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                goodsBindingSource.DataSource = obj;
                goods = (Goods)obj;
            }
            BindData();

            if (mainMenu.Name == MainMenuEnum.Goods.ToString())
            {
                SetEditItem(DevExpress.XtraLayout.Utils.LayoutVisibility.Always);
            }
            else
            {
                SetEditItem(DevExpress.XtraLayout.Utils.LayoutVisibility.Never);
            }
        }
Пример #2
0
 public DataEditForm(MainMenu menu, Object obj, PageGroup child)
 {
     InitializeComponent();
     editPage      = new Dictionary <EDMX.MainMenu, object>();
     mainMenu      = menu;
     pageGroupCore = child;
     this.Text     = mainMenu.Caption;
     if (obj == null)
     {
         this.Text += "—添加";
     }
     CreateToolsButton();
     dataEditPage = CreateEditPage(obj);
     //if (obj != null && obj is VSupplier)
     //{
     //    dpMoldAllot.Enabled = true;
     //    vGoodsByMoldAllotBindingSource.DataSource = clientFactory.GetData<VGoodsByMoldAllot>().FindAll(o => o.SupplierID == ((VSupplier)obj).ID);
     //    gridView.BestFitColumns();
     //    foreach (GridColumn col in gridView.Columns)
     //    {
     //        if (col.Name.ToUpper().Contains("ID".ToUpper()))
     //            col.Visible = false;
     //        if (col.ColumnType.Equals(typeof(System.Data.Linq.Binary)))
     //        {
     //            col.Width = 50;  //调整图片的列宽度
     //        }
     //        if (col.FieldName == "单价" || col.FieldName == "售价")
     //        {
     //            col.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
     //            col.DisplayFormat.FormatString = "c5";
     //        }
     //        if (col.FieldName.Contains("金额") || col.FieldName == "额外费用")
     //        {
     //            col.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
     //            col.DisplayFormat.FormatString = "c";
     //        }
     //        if (col.FieldName == "去税单价")
     //        {
     //            col.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
     //            col.DisplayFormat.FormatString = "c6";
     //        }
     //    }
     //}
     //else
     dpMoldAllot.Enabled = false;
 }
Пример #3
0
        public void Print()
        {
            try
            {
                PrintSettingController psc = new PrintSettingController(chartControl1);
                //页眉
                psc.PrintCompany = MainForm.Company;
                MainMenu mm = MainForm.AllMainMenuList.FirstOrDefault(o =>
                                                                      o.Name == MainMenuEnum.AnnualSalesSummaryByCustomerReport.ToString());
                if (mm != null)
                {
                    psc.PrintHeader = mm.Caption;
                }
                psc.PrintSubTitle = MainForm.Contacts.Replace("\\r\\n", "\r\n");
                //页脚
                //psc.PrintRightFooter = "打印日期:" + DateTime.Now.ToString();

                psc.IsBill = false;

                //横纵向
                //psc.LandScape = this.rbtnHorizon.Checked;
                psc.LandScape = true;
                //纸型
                psc.PaperKind = System.Drawing.Printing.PaperKind.A4;
                //加载页面设置信息
                psc.LoadPageSetting();

                psc.Preview();
            }
            catch (Exception ex)
            {
                CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), "没有可打印的数据。\r\n错误信息:" + ex.Message);
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
            }
        }
Пример #4
0
        public TabbedGoodsPage(EDMX.MainMenu menu, PageGroup child, Dictionary <String, int> childButtonList)
        {
            InitializeComponent();
            mainMenu      = menu;
            pageGroupCore = child;
            queryPageList = new Dictionary <String, DataQueryPage>();
            DataQueryPage queryPage = null;

            types = MainForm.TypesList;
            //单据类型
            int i = 0;
            List <DockPanel> dpList;

            if (MainForm.Company.Contains("纸"))
            {
                dpList = dockManager.RootPanels.Where(o => o.Name == "dpMaterial").ToList();
            }
            else
            {
                dpList = dockManager.RootPanels.ToList();
            }
            //foreach (DockPanel panel in dpList)
            //{
            //    i = types.Find(o => o.Type == TypesListConstants.GoodsType && o.Name == panel.Text.Trim()).No;
            //    //list = clientFactory.GetData<VMaterial>().FindAll(o => o.Type == i);
            //    queryPage = new DataQueryPage(menu, list, child, childButtonList);
            //    queryPage.Dock = DockStyle.Fill;
            //    panel.Controls.Add(queryPage);
            //    queryPageList.Add(panel.Text.Trim(), queryPage);
            //    //MainForm.SetQueryPageGridColumn(queryPage.gridView, menu);
            //}
            MainForm.GoodsBigTypeName = "包装资料";
            ////去掉模具资料面板
            //tabbedView1.Documents.Remove(document4);
            //dockManager.RemovePanel(dpMold);
        }
Пример #5
0
 public ChartPage(MainMenu menu)
 {
     InitializeComponent();
     mainMenu = menu;
     BindData(null);
 }