Пример #1
0
        void exportList()
        {
            if (cbListSend.SelectedItem == null)
            {
                MessageBox.Show("请先选择送审名单 ");
                return;
            }

            string fileName;
            string filepath = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "desktop", "").ToString();

            if (!(String.IsNullOrEmpty(filepath)))
            {
                fileName = filepath + "\\" + txtDSN.Text + ".xlsx";
            }
            else
            {
                System.Windows.Forms.SaveFileDialog saveFile = new System.Windows.Forms.SaveFileDialog();
                saveFile.Filter = "Excel文件|*.xlsx";
                if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileName = saveFile.FileName;
                }
                else
                {
                    return;
                }
            }


            List <sp_SelectTable3ForExcel_Result> sendCollection = visaORM.sp_SelectTable3ForExcel(cbListSend.SelectedItem.ToString()).ToList();

            if (cbVietnamCompany.SelectedItem == null)
            {
                MessageBox.Show("请选择越南公司");
                return;
            }



            if (sendCollection.Count() > 0)
            {
                Excel.ExportC.ExportTable3(fileName, sendCollection, txtDate.Text.Substring(4, 2) + "/" + txtDate.Text.Substring(2, 2) + "/" + "20" + txtDate.Text.Substring(0, 2), txtDSN.Text, cbVietnamCompany.SelectedItem.ToString(), messages);
                //Excel.ExportC.PirntExcel(fileName);
            }
        }
Пример #2
0
        void exportList()
        {
            try
            {
                if (string.IsNullOrEmpty(this.sendNoString))
                {
                    MessageBox.Show("请先选择送审名单 ");
                    return;
                }

                string fileName;
                string filepath = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "desktop", "").ToString();
                if (!(String.IsNullOrEmpty(filepath)))
                {
                    fileName = filepath + "\\" + txtDSN.Text + ".xlsx";
                }
                else
                {
                    System.Windows.Forms.SaveFileDialog saveFile = new System.Windows.Forms.SaveFileDialog();
                    saveFile.Filter = "Excel文件|*.xlsx";
                    if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        fileName = saveFile.FileName;
                    }
                    else
                    {
                        return;
                    }
                }

                int i = 0;

                List <sp_SelectTable3ForExcel_Result> sendCollection = visaORM.sp_SelectTable3ForExcel(this.sendNoString).ToList();

                if (cbVietnamCompany.EditValue == null || cbVietnamCompany.EditValue.ToString() == "")
                {
                    MessageBox.Show("请填写越南公司");
                    return;
                }

                if (sendCollection.Count() > 0)
                {
                    Excel.ExportC.ExportTable3(fileName, sendCollection, txtDate.DateTime.ToString("MM/dd/yyyy"), txtDSN.Text, txtSpecial.Text, messages);
                    //Excel.ExportC.(fileName);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);
            }
        }
Пример #3
0
        private void GetSendListDetail(ComboBoxEdit cb)
        {
            if (cb.SelectedItem != null)
            {
                string SentNo = cb.SelectedItem.ToString();

                var model = visaORM.SendInfo.FirstOrDefault(s => s.FSendNo == SentNo);
                if (model != null)
                {
                    txtDSN.Text     = model.FDSN;
                    txtSendNo.Text  = model.FSendNo;
                    txtCompany.Text = model.FCreateCompany;
                    txtDate.Text    = model.FCDate;
                    if (model.FCDate != null)
                    {
                        txtDate.Text = model.FCDate.ToString();
                    }



                    //sendCollection = (from c in visaORM.Customer
                    //                       join s in visaORM.SendInfo
                    //                       on c.FID equals s.FCustomerID
                    //                       where s.FSendNo == SentNo
                    //                       select c).ToList();


                    // sendCollection = visaORM.sp_SelectTable3ForExcel(SentNo).ToList();
                    //gridMain.ItemsSource = sendCollection;

                    foreach (var sObj in visaORM.sp_SelectTable3ForExcel(SentNo))
                    {
                        sendCollection.Add(sObj);
                    }

                    gridMain.DataContext = sendCollection;
                }
            }
            else
            {
                gridMain.ItemsSource = null;
            }
        }