Example #1
0
        bool ExportToFile(List <Kisayol> list)
        {
            bool res = false;

            try
            {
                svFlDialog = new SaveFileDialog();
                DialogResult dr = svFlDialog.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.OK || dr == System.Windows.Forms.DialogResult.Yes)
                {
                    string fileName = svFlDialog.FileName;
                    if (ObjectUtility.ToStr(fileName).Replace(" ", "").Length == 0)
                    {
                        MessageUtil.Warn("Save File Name can not be empty.");
                        return(res);
                    }

                    if (fileName.EndsWith(".xls") == false)
                    {
                        fileName += ".xls";
                    }

                    res = ExportManager.ExportToExcel(list, fileName);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                svFlDialog = null;
            }

            return(res);
        }