Esempio n. 1
0
        private void Bind()
        {
            try
            {
                exportInfo = new List <ExportInfo>();
                exportInfo = ExportClass.Getdata();

                this.orderdata.DataSource          = exportInfo;
                this.orderdata.AutoGenerateColumns = false;

                //string columnwidths = pub.IniReadValue(this.Name, this.orderdata.Name);
                //if (columnwidths != "")
                //{
                //    string[] columns = columnwidths.Split(',');
                //    int j = 0;
                //    for (int i = 0; i < columns.Length; i++)
                //    {
                //        if (orderdata.Columns[i].Visible == true)
                //        {
                //            orderdata.Columns[j].Width = Convert.ToInt32(columns[i]);
                //            j = j + 1;
                //        }
                //    }
                //}
                orderdata.ClearSelection();
            }
            catch (Exception ex)
            {
                // throw ex;
            }
        }
 public void ToCSV()
 {
     List<ExportClass> Temp = new ExportClass[] { new ExportClass { ID = 1, Value = "A" }, new ExportClass { ID = 2, Value = "B" }, new ExportClass { ID = 3, Value = "C" } }.ToList();
     Temp.ToCSV();
     Utilities.FileFormats.CSV.CSV TestObject = Temp.ToCSV();
     Assert.Equal(4, TestObject.Count);
     Assert.Equal("\"ID\",\"Value\"\r\n\"1\",\"A\"\r\n\"2\",\"B\"\r\n\"3\",\"C\"\r\n", TestObject.ToString());
 }
 public void ToDelimitedFile()
 {
     var Temp = new ExportClass[] { new ExportClass { ID = 1, Value = "A" }, new ExportClass { ID = 2, Value = "B" }, new ExportClass { ID = 3, Value = "C" } }.ToList();
     Temp.ToDelimitedFile();
     var TestObject = Temp.ToDelimitedFile();
     Assert.Equal(4, TestObject.Count);
     Assert.Equal("\"ID\"\t\"Value\"\r\n\"1\"\t\"A\"\r\n\"2\"\t\"B\"\r\n\"3\"\t\"C\"\r\n", TestObject.ToString());
 }
 public void ToDelimitedFile()
 {
     List<ExportClass> Temp = new ExportClass[] { new ExportClass { ID = 1, Value = "A" }, new ExportClass { ID = 2, Value = "B" }, new ExportClass { ID = 3, Value = "C" } }.ToList();
     Assert.DoesNotThrow(() => Temp.ToDelimitedFile());
     Utilities.FileFormats.GenericDelimited.GenericDelimited TestObject = Temp.ToDelimitedFile();
     Assert.Equal(4, TestObject.Count);
     Assert.Equal("\"ID\"\t\"Value\"\r\n\"1\"\t\"A\"\r\n\"2\"\t\"B\"\r\n\"3\"\t\"C\"\r\n", TestObject.ToString());
 }
Esempio n. 5
0
 //
 private void btExport_Click(object sender, EventArgs e)
 {
     if (Table_Report == null)
     {
         MessageBox.Show(Model_Data.Language.PublicInfo.NoDataFound, Model_Data.Language.PublicInfo.Info);
         return;
     }
     else
     {
         ExportClass.ExportToSvc(Table_Report, "EventLog");
     }
 }
Esempio n. 6
0
        private void Export_Click(object sender, RoutedEventArgs e)
        {
            ExportClass Export = new ExportClass();

            Export.Rules = AllRules;
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "Text file (*.txt)|*.txt";
            if (saveFileDialog.ShowDialog() == true)
            {
                Functions.WriteToXmlFile <ExportClass>(saveFileDialog.FileName, Export);
            }
        }
        public void When_adding_object_then_it_should_be_loadable()
        {
            var ctx  = new CompositionContext();
            var part = new ExportClass();

            ctx.AddPart <ExportClass, ExportClass>(part);

            var obj = new ImportClass();

            ctx.SatisfyImports(obj);

            Assert.AreEqual(part, obj.Object);
        }
Esempio n. 8
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            ExportClass ex = new ExportClass();

            if (!System.IO.File.Exists(Common.strAddfilesPath + "课程表"))
            {
                System.IO.Directory.CreateDirectory(Common.strAddfilesPath + "课程表");
            }
            string filename = "课程表\\" + cbspcial.Text + "专业" + cbname.Text + "老师的" + cbclass.Text + "课程表";

            filepath = Common.strAddfilesPath + filename + ".docx";
            ex.MakeWordDoc(selectcommand, filename);
            MessageBox.Show("导出成功");
        }
Esempio n. 9
0
        public void ToCSV()
        {
            List <ExportClass> Temp = new ExportClass[] { new ExportClass {
                                                              ID = 1, Value = "A"
                                                          }, new ExportClass {
                                                              ID = 2, Value = "B"
                                                          }, new ExportClass {
                                                              ID = 3, Value = "C"
                                                          } }.ToList();

            Assert.DoesNotThrow(() => Temp.ToCSV());
            Utilities.FileFormats.CSV.CSV TestObject = Temp.ToCSV();
            Assert.Equal(4, TestObject.Count);
            Assert.Equal("\"ID\",\"Value\"\r\n\"1\",\"A\"\r\n\"2\",\"B\"\r\n\"3\",\"C\"\r\n", TestObject.ToString());
        }
Esempio n. 10
0
        public void ToDelimitedFile()
        {
            List <ExportClass> Temp = new ExportClass[] { new ExportClass {
                                                              ID = 1, Value = "A"
                                                          }, new ExportClass {
                                                              ID = 2, Value = "B"
                                                          }, new ExportClass {
                                                              ID = 3, Value = "C"
                                                          } }.ToList();

            Temp.ToDelimitedFile();
            Utilities.IO.FileFormats.Delimited.Delimited TestObject = Temp.ToDelimitedFile();
            Assert.Equal(4, TestObject.Count);
            Assert.Equal("\"ID\"\t\"Value\"\r\n\"1\"\t\"A\"\r\n\"2\"\t\"B\"\r\n\"3\"\t\"C\"\r\n", TestObject.ToString());
        }
        public void When_adding_object_and_name_then_it_should_be_loadable()
        {
            var ctx   = new CompositionContext();
            var part1 = new ExportClass();
            var part2 = new ExportClass();

            ctx.AddPart <ExportClass, ExportClass>(part1, "1");
            ctx.AddPart <ExportClass, ExportClass>(part2, "2");

            var obj = new ImportClass2();

            ctx.SatisfyImports(obj);

            Assert.AreEqual(part1, obj.Object1);
            Assert.AreEqual(part2, obj.Object2);
        }
Esempio n. 12
0
        public ActionResult ExportCList(string cbspcial = "全部", string cbname = "全部", string cbclass = "全部")
        {
            ExportClass ex           = new ExportClass();
            string      filename     = cbspcial + "专业" + cbname + "老师的" + cbclass + "课程表" + ".docx";
            string      virtualPath  = string.Format("~/App_Data/{0}/{1}/{2}", Session["AdminUser"], "课程表", filename);
            string      fullFileName = this.Server.MapPath(virtualPath);
            string      wordpath     = Server.MapPath("~/Resources/classes.docx");
            //创建文件夹,保存文件
            string path = Path.GetDirectoryName(fullFileName);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            ex.MakeWordDoc(selectExport(cbspcial, cbname, cbclass, lstclasses), fullFileName, wordpath);
            return(File(fullFileName, "application/zip-x-compressed", filename));
        }
        // returns sorted list of public types
        public List <string> GetPublicTypes()
        {
            Type[] types = assembly.GetTypes();

            List <string> output = new List <string>();

            foreach (Type type in types)
            {
                if (type.IsPublic && type.IsDefined(typeof(ExportClass)))
                {
                    ExportClass attr = (ExportClass)type.GetCustomAttribute(typeof(ExportClass));

                    Console.WriteLine("Класс - " + type.Name);
                    Console.WriteLine("Name aтрибута - " + attr.Name);
                }
            }

            output.Sort();

            return(output);
        }
Esempio n. 14
0
        //多条打码机的数据可以写到一个文件上发送过去,不过每次发送的明细不能超过一万条
        private void export(string synseq, string groupno, string linetype)//lineno打码机编号
        {
            this.btn_export.Enabled = false;
            panel2.Visible          = true;
            label2.Visible          = true;
            progressBar1.Visible    = true;
            label2.Text             = "数据查询中,准备进行数据导出...";
            label2.Refresh();
            int    taskseq = 0, seq = 1;
            String tasknum = "", cuscode = "", cusname = "", itemno = "", itemname = "", quantity = "", regioncode = "", orderdate = "", cuscodetmp = "";

            List <InfoExport> list = new List <InfoExport>();

            list = ExportClass.Export(Convert.ToDecimal(synseq));

            //取批次号
            //String batchcodesql = "select SEQ_ONEHAOGONGCHENG.Nextval from dual";

            int len = list.Count;


            String onesynseq = "0";//一号工程批次号


            //DataTable table = Db.Query(sql);
            //int len = table.Rows.Count;
            //String[] infostr = new String[len];

            if (len > 0)
            {
                InitSocket();
                //DataRow row = new DataRow();
                //创建到处目录
                String folder = "HighSpeedExportData";
                if (!Directory.Exists("D:\\" + folder))
                {
                    Directory.CreateDirectory("D:\\" + folder);
                }
                int    count = 0, fileSeq = 1, rowCcount = 0, bz = 0, succCount = 0;
                String fileNameStr = ""; String info = "", tmpInfo = "", tempCode = "", unSuccFile = "";
                for (int i = 0; i < len; i++)
                {
                    progressBar1.Value = ((i + 1) * 100 / len);
                    progressBar1.Refresh();

                    InfoExport infos = new InfoExport();
                    infos = list[i];

                    tasknum    = infos.SortNum.ToString();
                    cuscode    = infos.CustomerCode.ToString();
                    cusname    = infos.CustomerName.ToString();
                    itemno     = infos.CigaretteCode.ToString();
                    itemname   = infos.CigaretteName.ToString();
                    quantity   = infos.PokeNum.ToString();
                    regioncode = infos.RegionCode.ToString();
                    orderdate  = infos.Orderdate.ToString();
                    //lineno = row["SORTNAME"].ToString();
                    taskseq++;
                    rowCcount = rowCcount + 1;

                    label2.Text = "正在导出第" + fileSeq + "个文件...";
                    label2.Refresh();
                    //取下条记录比较车组与零售户
                    if (i + 1 < len)
                    {
                        cuscodetmp = list[i + 1].CustomerCode.ToString();
                        tempCode   = list[i + 1].RegionCode.ToString();
                    }
                    else
                    {
                        cuscodetmp = "";
                        tempCode   = "";
                    }
                    //infostr[i] = tasknum + taskseq + "," + tasknum + "," + cuscode + "," + cusname + "," + itemno + "," + itemname + "," + quantity + ",2," + seq + "," + regioncode + "," + regioncode + "," + orderdate + "," + orderdate + ",S1001,1";
                    tmpInfo = tmpInfo + tasknum + "," + tasknum + "," + cuscode + "," + cusname + "," + itemno + "," + itemname + "," + quantity + "," + onesynseq + "," + seq + "," + regioncode + "," + regioncode + "," + orderdate + "," + orderdate + ",1;\r\n";

                    if (cuscode != cuscodetmp)
                    {
                        taskseq = 0;
                        seq++;
                    }
                    //当下个车组与当前不同时
                    if (!tempCode.Equals(regioncode))
                    {
                        //判断累计记录数是否大于10000,大于则将之前的记录数导出,否则将记录数合并
                        if (rowCcount + count > 1000000000)
                        {
                            label2.Text = "正在压缩第" + fileSeq + "个文件...";
                            label2.Refresh();
                            //将之前的记录信息导出
                            DateTime dt       = DateTime.Now;
                            String   time     = string.Format("{0:yyyyMMddHHmmssfff}", dt);
                            String   filename = "RetailerOrder-" + time + "-" + synseq + "-" + fileSeq;
                            fileNameStr = fileNameStr + "," + filename + ".zip";
                            StreamWriter sw = new StreamWriter("D:\\HighSpeedExportData\\" + filename + ".Order", false, Encoding.UTF8);
                            sw.WriteLine(info.Substring(0, info.Length - 1));
                            sw.Close();//写入
                            //CompressFile("D:\\" + filename + ".Order");
                            GetFileToZip("D:\\HighSpeedExportData\\" + filename + ".Order", "D:\\HighSpeedExportData\\" + filename + ".zip", filename + ".Order");
                            //发送数据
                            label2.Text = "正在发送第" + fileSeq + "个文件";
                            label2.Refresh();
                            bz = sendFile("D:\\HighSpeedExportData\\" + filename + ".zip");
                            //记录发送成功数量和失败文件信息
                            if (bz == 0)
                            {
                                succCount   = succCount + 1;
                                label2.Text = "第" + fileSeq + "个文件发送完毕!";
                            }
                            else
                            {
                                unSuccFile  = unSuccFile + "," + filename + ".zip";
                                label2.Text = "第" + fileSeq + "个文件发送失败!";
                            }

                            label2.Refresh();
                            //记录新车组的信息
                            fileSeq = fileSeq + 1;
                            count   = rowCcount;
                            info    = tmpInfo;
                        }
                        else
                        {
                            count = rowCcount + count;
                            info  = info + tmpInfo;
                        }

                        //判断循环是否完成(是否为最后一条记录),如果是最后一条,则将剩余记录导出
                        if ("".Equals(tempCode))
                        {
                            //fileSeq = fileSeq + 1;
                            label2.Text = "正在压缩第" + fileSeq + "个文件";
                            label2.Refresh();
                            DateTime dt       = DateTime.Now;
                            String   time     = string.Format("{0:yyyyMMddHHmmssfff}", dt);
                            String   filename = "RetailerOrder-" + time + "-" + synseq + "-" + fileSeq;
                            fileNameStr = fileNameStr + "," + filename + ".zip";
                            StreamWriter sw = new StreamWriter("D:\\HighSpeedExportData\\" + filename + ".Order", false, Encoding.UTF8);
                            sw.WriteLine(info.Substring(0, info.Length - 1));
                            sw.Close();//写入
                            //CompressFile("D:\\" + filename + ".Order");
                            GetFileToZip("D:\\HighSpeedExportData\\" + filename + ".Order", "D:\\HighSpeedExportData\\" + filename + ".zip", filename + ".Order");
                            //发送数据
                            //sendFile("D:\\HighSpeedExportData\\" + filename + ".zip");
                            label2.Text = "正在发送第" + fileSeq + "个文件";
                            label2.Refresh();
                            bz = sendFile("D:\\HighSpeedExportData\\" + filename + ".zip");
                            //记录发送成功数量和失败文件信息
                            if (bz == 0)
                            {
                                succCount   = succCount + 1;
                                label2.Text = "第" + fileSeq + "个文件发送完毕!";
                            }
                            else
                            {
                                unSuccFile  = unSuccFile + "," + filename + ".zip";
                                label2.Text = "第" + fileSeq + "个文件发送失败!";
                            }

                            label2.Refresh();
                        }
                        tmpInfo   = "";
                        rowCcount = 0;
                    }
                }
                //在弹窗前关闭控件
                panel2.Visible       = false;
                label2.Visible       = false;
                progressBar1.Visible = false;

                String msg = "成功导出" + fileSeq + "个文件,成功发送" + succCount + "个文件!";
                //导出的文件的所有文件名
                if (!"".Equals(fileNameStr))
                {
                    fileNameStr = fileNameStr.Substring(1);
                }
                //发送失败的所有文件名
                if (!"".Equals(unSuccFile))
                {
                    unSuccFile = unSuccFile.Substring(1);
                    msg        = msg + "其中发送失败文件为(" + unSuccFile + ")!";
                }
                else
                {
                    msg = msg + "文件名为(" + fileNameStr + ")!";
                }

                MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                socketClient.Disconnect(false);
                socketClient.Close();
            }
            this.btn_export.Enabled = true;
        }
        public void When_adding_object_and_name_then_it_should_be_loadable()
        {
            var ctx = new CompositionContext();
            var part1 = new ExportClass();
            var part2 = new ExportClass();

            ctx.AddPart<ExportClass, ExportClass>(part1, "1");
            ctx.AddPart<ExportClass, ExportClass>(part2, "2");

            var obj = new ImportClass2();
            ctx.SatisfyImports(obj);

            Assert.AreEqual(part1, obj.Object1);
            Assert.AreEqual(part2, obj.Object2);
        }
        public void When_adding_object_then_it_should_be_loadable()
        {
            var ctx = new CompositionContext();
            var part = new ExportClass();
            ctx.AddPart<ExportClass, ExportClass>(part);

            var obj = new ImportClass();
            ctx.SatisfyImports(obj);

            Assert.AreEqual(part, obj.Object);
        }
Esempio n. 17
0
        public void ProcessRequest(HttpContext context)
        {
            //查看session
            if (HttpContext.Current.Session["user"] == null)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("nosession");
                return;
            }
            if ((context.Request["type"] == null) || (context.Request["data"] == null))
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("type或data参数为空");
            }
            //标题
            string title = "";

            //传递参数
            SqlParameter[] parm = new SqlParameter[1];
            //存储过程名称
            string ProName = "";
            //获取分页及单页面数据条数限制
            int totalCount = 0;
            int page       = 1;
            int limit      = 20;

            if ((context.Request.QueryString["page"] != null) && (context.Request.QueryString["limit"] != null))
            {
                page  = int.Parse(context.Request.QueryString["page"].ToString());
                limit = int.Parse(context.Request.QueryString["limit"].ToString());
            }

            #region 学生实时预警统计(图书)
            if (context.Request["data"] == "xsssyjtjts")
            {
                //存储过程名称
                ProName = "EW_TSYJ_ByXYAndNJ";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[2];
                parm[0] = new SqlParameter("@time", DateTime.Now.AddMonths(-12).ToString("yyyy-MM-dd"));
                parm[1] = new SqlParameter("@lastestgrade", 2017);
            }
            #endregion
            #region 学生实时预警统计(健康)
            if (context.Request["data"] == "xsssyjtjjk")
            {
                //存储过程名称
                ProName = "EW_JKYJ_ByXYAndNJ";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[1];
                parm[0] = new SqlParameter("@lastestgrade", 2017);
            }
            #endregion
            #region 学生实时预警统计(医务)
            if (context.Request["data"] == "xsssyjtjyw")
            {
                //存储过程名称
                ProName = "EW_YWYJ_ByXYAndNJ";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[2];
                parm[0] = new SqlParameter("@time", DateTime.Now.AddMonths(-2).ToString("yyyy-MM-dd"));
                parm[1] = new SqlParameter("@lastestgrade", 2017);
            }
            #endregion
            #region 学生实时预警统计(消费)
            if (context.Request["data"] == "xsssyjtj")
            {
                //存储过程名称
                ProName = "EW_XSYJByXYAndNJ";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[3];
                parm[0] = new SqlParameter("@time", "20180425");
                parm[1] = new SqlParameter("@waring", 3);
                parm[2] = new SqlParameter("@lastestgrade", 2017);
            }
            #endregion
            #region 学生预警(按辅导员统计)
            if (context.Request["data"] == "xsyj")
            {
                //存储过程名称
                ProName = "EW_XSYJByFDY";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[2];
                parm[0] = new SqlParameter("@time", "20180425");
                parm[1] = new SqlParameter("@waring", 3);
            }
            #endregion
            #region 晚归学生分布情况
            if (context.Request["data"] == "wgxsfbqk")
            {
                //存储过程名称
                ProName = "EW_WGXS";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[2];
                parm[0] = new SqlParameter("@begintime", "20140415 22:00:00");
                parm[1] = new SqlParameter("@endtime", "20140416 04:00:00");
            }
            #endregion
            #region 预警学生详情
            if (context.Request["data"] == "EWDetail")
            {
                //存储过程名称
                ProName = "EW_StudentDetail";
                //具体申请几个空间看存储过程中需要几个参数
                parm               = new SqlParameter[11];
                parm[0]            = new SqlParameter("@xh", context.Request["xh"]);
                parm[1]            = new SqlParameter("@xm", context.Request["xm"]);
                parm[2]            = new SqlParameter("@yxmc", context.Request["yxmc"]);
                parm[3]            = new SqlParameter("@zymc", context.Request["zymc"]);
                parm[4]            = new SqlParameter("@bjmc", context.Request["bjmc"]);
                parm[5]            = new SqlParameter("@time", context.Request["time"]);
                parm[6]            = new SqlParameter("@warning", context.Request["warning"]);
                parm[7]            = new SqlParameter("@fdy", context.Request[("fdy")]);
                parm[8]            = new SqlParameter("@page_size", limit);
                parm[9]            = new SqlParameter("@page_num", page);
                parm[10]           = new SqlParameter("@total_record", SqlDbType.Int);
                parm[10].Direction = ParameterDirection.Output;
            }
            #endregion

            //运行SQL
            DataSet dt = DBUtility.ProceureToTable(ProName, parm);
            if (context.Request["data"] == "EWDetail")
            {
                totalCount = Convert.ToInt32(parm[10].Value);
            }

            #region 输出图形分成几份
            int count = 0;
            //分成几份传参
            if (context.Request["count"] != null)
            {
                int.TryParse(context.Request["count"], out count);
            }
            else if (dt.Tables[0] != null)
            {
                count = dt.Tables[0].Rows.Count;
            }
            #endregion

            #region 生成前台使用数据
            //生成柱状图数据---type=column
            if (context.Request["type"] == "column")
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(DataSetConvertJson.TransformToColumnJson(dt, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"), count, title));
            }
            //生成饼图数据---type=pie
            if (context.Request["type"] == "pie")
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(DataSetConvertJson.TransformToPieJson(dt, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"), count, title));
            }
            //生成表格所需数据---type=table
            if (context.Request["type"] == "table")
            {
                string str = "{\"items\":[" + DataSetConvertJson.DataTable2Json(dt.Tables[0]) + "]}";
                context.Response.ContentType = "text/plain";
                context.Response.Write(str);
            }
            //分页生成表格所需数据---type=tablepaged
            if (context.Request["type"] == "tablepaged")
            {
                string str = "{\"items\":[" + DataSetConvertJson.DataTable2Json(dt.Tables[0]) + "],";
                str += "totalCount:" + "'" + totalCount.ToString() + "'" + "}";
                context.Response.ContentType = "text/plain";
                context.Response.Write(str);
            }
            //导出表格数据到Excel---type=export_excel
            if (context.Request["type"] == "export_excel")
            {
                ExportClass.DataGridViewExportToExcel(dt, title);
            }
            #endregion
        }
Esempio n. 18
0
        public void ProcessRequest(HttpContext context)
        {
            //查看session
            if (HttpContext.Current.Session["user"] == null)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("nosession");
                return;
            }
            if ((context.Request["type"] == null) || (context.Request["data"] == null))
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("type或data参数为空");
            }
            //标题
            string title = "";
            //传递参数
            SqlParameter[] parm = new SqlParameter[1];
            //存储过程名称
            string ProName = "";
            //初始化检索
            int datecount = 7;
            //初始化时间
            DateTime endtime = DateTime.Now.AddDays(-1);
            DateTime begtime = endtime;
            if (context.Request["time"] != null)
            {
                if (context.Request["time"] == "一周")
                {
                    datecount = 7;
                }
                else if (context.Request["time"] == "两周")
                {
                    datecount = 14;
                }
                else if (context.Request["time"] == "一月")
                {
                    datecount = 30;
                }
                else if (context.Request["time"] == "一年")
                {
                    datecount = 366;
                }

                begtime = endtime.AddDays(-datecount);
            }
            if ((context.Request["begtime"] != null) && (context.Request["endtime"] != null))
            {
                begtime = DateTime.Parse(context.Request["begtime"].ToString());
                endtime = DateTime.Parse(context.Request["endtime"].ToString());
                datecount = (endtime - begtime).Days;
            }
            //获取分页及单页面数据条数限制
            int totalCount = 0;
            int page = 1;
            int limit = 20;
            if ((context.Request.QueryString["page"] != null) && (context.Request.QueryString["limit"] != null))
            {
                page = int.Parse(context.Request.QueryString["page"].ToString());
                limit = int.Parse(context.Request.QueryString["limit"].ToString());
            }
            #region 用户信息详情
            if (context.Request["data"] == "CustomerDetail")
            {
                //存储过程名称(需要注意在哪个用户下)
                ProName = "Card_CustomerDetail";
                //具体申请几个空间看存储过程中需要几个参数
                parm = new SqlParameter[10];
                parm[0] = new SqlParameter("@stuempno", context.Request["stuempno"]);
                parm[1] = new SqlParameter("@custname", context.Request["custname"]);
                parm[2] = new SqlParameter("@sex", context.Request["sex"]);
                parm[3] = new SqlParameter("@custtypename", context.Request["custtypename"]);
                parm[4] = new SqlParameter("@idno", context.Request["idno"]);
                parm[5] = new SqlParameter("@deptname", context.Request["deptname"]);
                parm[6] = new SqlParameter("@classname", context.Request[("classname")]);
                parm[7] = new SqlParameter("@page_size", limit);
                parm[8] = new SqlParameter("@Page_num", page);
                parm[9] = new SqlParameter("@total_record", SqlDbType.Int);
                parm[9].Direction = ParameterDirection.Output;
            }
            #endregion

            //运行SQL
            DataSet dt = DBUtility.ProceureToTable(ProName, parm);
            if (context.Request["data"] == "CustomerDetail")
                totalCount = Convert.ToInt32(parm[9].Value);

            #region 输出图形分成几份
            int count = 0;
            //分成几份传参
            if (context.Request["count"] != null)
            {
                int.TryParse(context.Request["count"], out count);
            }
            else if (dt.Tables[0] != null)
            {
                count = dt.Tables[0].Rows.Count;
            }
            #endregion

            #region 生成前台使用数据
            //生成柱状图数据---type=column
            if (context.Request["type"] == "column")
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(DataSetConvertJson.TransformToColumnJson(dt, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"), count, title));
            }
            //生成饼图数据---type=pie
            if (context.Request["type"] == "pie")
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(DataSetConvertJson.TransformToPieJson(dt, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"), count, title));
            }
            //生成表格所需数据---type=table
            if (context.Request["type"] == "table")
            {
                string str = "{\"items\":[" + DataSetConvertJson.DataTable2Json(dt.Tables[0]) + "]}";
                context.Response.ContentType = "text/plain";
                context.Response.Write(str);
            }
            //分页生成表格所需数据---type=tablepaged
            if (context.Request["type"] == "tablepaged")
            {
                string str = "{\"items\":[" + DataSetConvertJson.DataTable2Json(dt.Tables[0]) + "],";
                str += "totalCount:" + "'" + totalCount.ToString() + "'" + "}";
                context.Response.ContentType = "text/plain";
                context.Response.Write(str);
            }
            //导出表格数据到Excel---type=export_excel
            if (context.Request["type"] == "export_excel")
            {
                ExportClass.DataGridViewExportToExcel(dt, title);
            }
            #endregion
        }
Esempio n. 19
0
 private void номераЗачетокToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ExportClass.SetStudyNumbers();
 }
Esempio n. 20
0
    //Function launches corresponding actions based on activated widget
    void UnifiedActionControl(Storage storedwidget, string widgetname)
    {
        switch (widgetname)
        {
        //Convert to DAISY format
        case "daisy":
            ExportClass.Extract(this, lat);
            break;

        //Delete current audiotrack
        case "delete_file":
            if (Audio_GUI_Index > 0)
            {
                int index = Audio_GUI_Index - 1;
                lat.RemoveAt(index);
                if (index >= lat.Count)
                {
                    Audio_GUI_Index--;
                }
                Refresh_Audio_Widgets();
                Stamp_GUI_Index = -1;
                Refresh_Timestamp_Widgets();
            }
            break;

        //Delete the whole project from memory
        case "create":
            StopPlay();
            Audio_GUI_Index = -1;
            Stamp_GUI_Index = -1;
            lat.Clear();
            Refresh_Audio_Widgets();
            Refresh_Timestamp_Widgets();
            MainTitle.Text = "[*No project*]";
            break;

        //Move track to the previous position, if available
        case "skip_previous":
            if (Audio_GUI_Index > 0)
            {
                int index = Audio_GUI_Index - 1;
                if (index > 0)
                {
                    var lost_element = lat [index];
                    lat.RemoveAt(index);
                    lat.Insert(index - 1, lost_element);
                    Audio_GUI_Index--;
                    Refresh_Audio_Widgets(Audio_GUI_Index, true);
                }
            }
            break;

        //Move track to the next position, if available
        case "skip1":
            if (Audio_GUI_Index > 0)
            {
                int index = Audio_GUI_Index - 1;
                if (index < lat.Count - 1)
                {
                    var lost_element = lat [index];
                    lat.RemoveAt(index);
                    lat.Insert(index + 1, lost_element);
                    Audio_GUI_Index++;
                    Refresh_Audio_Widgets(Audio_GUI_Index, true);
                }
            }
            break;

        //Show Open Dialog
        case "open":
            Show_OpenDialog();
            break;

        //Show Save Dialog
        case "save":
            Show_SaveDialog();
            break;

        //Minimize window
        case "window_minimize":
            this.Iconify();
            break;

        //Close window
        case "window_close":
            OnDeleteEvent(this, null);
            break;

        //Mute sound
        case "sound":
            if (!storedwidget.current_state)
            {
                storedvol = MainClass.wmp.settings.volume;
                MainClass.wmp.settings.volume = 0;
            }
            else
            {
                MainClass.wmp.settings.volume = storedvol;
                storedvol = -1;
            }
            break;

        //About window
        case "info":
            Alert.Show(this, "About", true);
            break;

        //Play or pause
        case "play":
            if (Audio_GUI_Index > 0)
            {
                if (!storedwidget.current_state)
                {
                    MainClass.wmp.Ctlcontrols.play();
                }
                else
                {
                    MainClass.wmp.Ctlcontrols.pause();
                }
            }
            break;

        //Stop playing
        case "stop":
            MainClass.wmp.Ctlcontrols.stop();
            //Find "play" button and force default state
            var otherstoredwidget = ControlStorage.Find(y => y.widget.Name == "play");
            otherstoredwidget.current_state          = true;
            ((Image)otherstoredwidget.widget).Pixbuf = Gdk.Pixbuf.LoadFromResource("DAISYGen.Buttons.play_on_usual.png");
            break;

        //Add new timestamp for the selected audiotrack
        case "new":
            if (Audio_GUI_Index > 0)
            {
                AddDaisyTime(lat [Audio_GUI_Index - 1].Timestamps);
                Refresh_Timestamp_Widgets();
            }
            break;

        //Move selected timestamp higher up the hierarchy
        case "up":
            if (Audio_GUI_Index > 0 && Stamp_GUI_Index > 0)
            {
                ChangeHierarchyLevel(lat [Audio_GUI_Index - 1].Timestamps, Stamp_GUI_Index, -1);
                Refresh_Timestamp_Widgets();
            }
            break;

        //Move selected timestamp lower down the hierarchy
        case "down":
            if (Audio_GUI_Index > 0 && Stamp_GUI_Index > 0)
            {
                if (lat [Audio_GUI_Index - 1].Timestamps [Stamp_GUI_Index].position < lat [Audio_GUI_Index - 1].Timestamps [Stamp_GUI_Index - 1].position + 1)
                {
                    ChangeHierarchyLevel(lat [Audio_GUI_Index - 1].Timestamps, Stamp_GUI_Index, 1);
                }
                Refresh_Timestamp_Widgets();
            }
            break;

        //Erase timestamp
        case "delete":
            if (Audio_GUI_Index > 0 && Stamp_GUI_Index > 0)
            {
                EraseStamp(lat [Audio_GUI_Index - 1].Timestamps, Stamp_GUI_Index);
                Refresh_Timestamp_Widgets();
            }
            break;

        //Switch activation mode
        case "activation":
            ActivationAsSearch = storedwidget.current_state;
            break;

        //Change current timestamp title
        case "write":
            if (Audio_GUI_Index > 0 && Stamp_GUI_Index > -1)
            {
                lat [Audio_GUI_Index - 1].Timestamps [Stamp_GUI_Index].title = textbox.Text;
                Refresh_Timestamp_Widgets();
            }
            break;
        }
    }
Esempio n. 21
0
 private void smiSberbank_Click(object sender, EventArgs e)
 {
     ExportClass.ExportSber();
 }
Esempio n. 22
0
 private void smiVTB_Click(object sender, EventArgs e)
 {
     ExportClass.ExportVTB();
 }
Esempio n. 23
0
        public void ProcessRequest(HttpContext context)
        {
            //查看session
            if (HttpContext.Current.Session["user"] == null)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("nosession");
                return;
            }
            if ((context.Request["type"] == null) || (context.Request["data"] == null))
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("type或data参数为空");
            }
            //标题
            string title = "";

            //传递参数
            SqlParameter[] parm = new SqlParameter[1];
            //存储过程名称
            string ProName = "";
            //初始化检索
            int datecount = 7;
            //初始化时间
            DateTime endtime = DateTime.Now.AddDays(-1);
            DateTime begtime = endtime;

            if (context.Request["time"] != null)
            {
                if (context.Request["time"] == "一周")
                {
                    datecount = 7;
                }
                else if (context.Request["time"] == "两周")
                {
                    datecount = 14;
                }
                else if (context.Request["time"] == "一月")
                {
                    datecount = 30;
                }
                else if (context.Request["time"] == "一年")
                {
                    datecount = 366;
                }

                begtime = endtime.AddDays(-datecount);
            }
            if ((context.Request["begtime"] != null) && (context.Request["endtime"] != null))
            {
                begtime   = DateTime.Parse(context.Request["begtime"].ToString());
                endtime   = DateTime.Parse(context.Request["endtime"].ToString());
                datecount = (endtime - begtime).Days;
            }
            //获取分页及单页面数据条数限制
            int totalCount = 0;
            int page       = 1;
            int limit      = 20;

            if ((context.Request.QueryString["page"] != null) && (context.Request.QueryString["limit"] != null))
            {
                page  = int.Parse(context.Request.QueryString["page"].ToString());
                limit = int.Parse(context.Request.QueryString["limit"].ToString());
            }

            #region 馆藏图书按中图法分类
            if (context.Request["data"] == "ztf")
            {
                //存储过程名称
                ProName = "Library_ZTF";
                //具体申请几个空间看存储过程中需要几个参数
                parm = new SqlParameter[0];
            }
            #endregion
            #region 馆藏图书按类型分类
            if (context.Request["data"] == "lx")
            {
                //存储过程名称
                ProName = "Library_LX";
                //具体申请几个空间看存储过程中需要几个参数
                parm = new SqlParameter[0];
            }
            #endregion
            #region 图书借阅分学院统计
            if (context.Request["data"] == "tsjybyxy")
            {
                //存储过程名称
                ProName = "Library_JYByXY";
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[2];
                parm[0] = new SqlParameter("@begintime", "20170101");
                parm[1] = new SqlParameter("@endtime", "20180417");
            }
            #endregion
            #region 图书利用率统计
            if (context.Request["data"] == "tslyl")
            {
                //存储过程名称(需要注意在哪个用户下)
                if (context.Request["type"] == "column")
                {
                    ProName = "Library_TSLYL_Chart";
                }
                if ((context.Request["type"] == "table") || (context.Request["type"] == "export_excel"))
                {
                    ProName = "Library_TSLYL_Tab";
                }
                //具体申请几个空间看存储过程中需要几个参数
                parm    = new SqlParameter[2];
                parm[0] = new SqlParameter("@begintime", begtime.ToString("yyyyMMdd"));
                parm[1] = new SqlParameter("@endtime", endtime.ToString("yyyyMMdd"));
            }
            #endregion
            #region 热点图书
            if (context.Request["data"] == "rdts")
            {
                //存储过程名称(需要注意在哪个用户下)
                if (context.Request["type"] == "column")
                {
                    ProName = "Library_RDTS_Chart";
                }
                if ((context.Request["type"] == "table") || (context.Request["type"] == "export_excel"))
                {
                    ProName = "Library_RDTS_Tab";
                }
                //具体申请几个空间看存储过程中需要几个参数
                parm = new SqlParameter[3];
                int top = 10;
                parm[0] = new SqlParameter("@top", top);
                if ((context.Request["top"] != null) && (int.TryParse(context.Request["top"], out top)))
                {
                    parm[0].Value = top;
                }
                else
                {
                    parm[0].Value = 10;
                }
                parm[1] = new SqlParameter("@begintime", begtime.ToString("yyyyMMdd"));
                parm[2] = new SqlParameter("@endtime", endtime.ToString("yyyyMMdd"));
            }
            #endregion
            #region 图书借阅详情
            if (context.Request["data"] == "BorrowDetail")
            {
                //存储过程名称(需要注意在哪个用户下)
                ProName = "Library_BorrowDetail";
                //具体申请几个空间看存储过程中需要几个参数
                parm               = new SqlParameter[11];
                parm[0]            = new SqlParameter("@begintime", begtime.ToString("yyyyMMdd"));
                parm[1]            = new SqlParameter("@endtime", endtime.ToString("yyyyMMdd"));
                parm[2]            = new SqlParameter("@xh", context.Request["iv_id"]);
                parm[3]            = new SqlParameter("@xm", context.Request["iv_name"]);
                parm[4]            = new SqlParameter("@xy", context.Request["iv_department"]);
                parm[5]            = new SqlParameter("@title", context.Request["iv_book_name"]);
                parm[6]            = new SqlParameter("@author", context.Request[("iv_author")]);
                parm[7]            = new SqlParameter("@isbn", context.Request["iv_ISBN"]);
                parm[8]            = new SqlParameter("@page_size", limit);
                parm[9]            = new SqlParameter("@Page_num", page);
                parm[10]           = new SqlParameter("@total_record", SqlDbType.Int);
                parm[10].Direction = ParameterDirection.Output;
            }
            #endregion

            //运行SQL
            DataSet dt = DBUtility.ProceureToTable(ProName, parm);
            if (context.Request["data"] == "BorrowDetail")
            {
                totalCount = Convert.ToInt32(parm[10].Value);
            }

            #region 输出图形分成几份
            int count = 0;
            //分成几份传参
            if (context.Request["count"] != null)
            {
                int.TryParse(context.Request["count"], out count);
            }
            else if (dt.Tables[0] != null)
            {
                count = dt.Tables[0].Rows.Count;
            }
            #endregion

            #region 生成前台使用数据
            //生成柱状图数据---type=column
            if (context.Request["type"] == "column")
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(DataSetConvertJson.TransformToColumnJson(dt, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"), count, title));
            }
            //生成饼图数据---type=pie
            if (context.Request["type"] == "pie")
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(DataSetConvertJson.TransformToPieJson(dt, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"), count, title));
            }
            //生成表格所需数据---type=table
            if (context.Request["type"] == "table")
            {
                string str = "{\"items\":[" + DataSetConvertJson.DataTable2Json(dt.Tables[0]) + "]}";
                context.Response.ContentType = "text/plain";
                context.Response.Write(str);
            }
            //分页生成表格所需数据---type=tablepaged
            if (context.Request["type"] == "tablepaged")
            {
                string str = "{\"items\":[" + DataSetConvertJson.DataTable2Json(dt.Tables[0]) + "],";
                str += "totalCount:" + "'" + totalCount.ToString() + "'" + "}";
                context.Response.ContentType = "text/plain";
                context.Response.Write(str);
            }
            //导出表格数据到Excel---type=export_excel
            if (context.Request["type"] == "export_excel")
            {
                ExportClass.DataGridViewExportToExcel(dt, title);
            }
            #endregion
        }
Esempio n. 24
0
        async private void Button_Click(object sender, RoutedEventArgs e)
        {
            progressBar.Visibility = Visibility.Visible;
            exportBtn.IsEnabled    = false;
            //DbAccess da = new DbAccess();
            await da.InitCon();

            dt = await da.ExecuteQuery();


            // var masterDatas = new List<MasterData>();
            await Task.Factory.StartNew(() =>
            {
                // var masterDatas = new List<MasterData>();
                mainMasterData = ts.GetDataTables(dt);


                var result = mainMasterData.SelectMany(m => m.ReferenceRanges, (MasterData, ReferenceRange) => new { MasterData, ReferenceRange }).ToList();
                foreach (var item in result)
                {
                    FullData f = new FullData()
                    {
                        PanelId        = item.MasterData.PanelId,
                        PanelName      = item.MasterData.PanelName,
                        TestId         = item.MasterData.TestId,
                        TestName       = item.MasterData.TestName,
                        LabsectionId   = item.MasterData.LabsectionId,
                        Labsection     = item.MasterData.Labsection,
                        Units          = item.MasterData.Units,
                        TubeId         = item.MasterData.TubeId,
                        TubeName       = item.MasterData.TubeName,
                        SampleTypeId   = item.MasterData.SampleTypeId,
                        SampleTypeName = item.MasterData.SampleTypeName,
                        RefRangeType   = item.ReferenceRange.RefRangeType,
                        Sex            = item.ReferenceRange.Sex,
                        SpecialPeriod  = item.ReferenceRange.SpecialPeriod,
                        TimeScale      = item.ReferenceRange.TimeScale,
                        From           = item.ReferenceRange.From,
                        To             = item.ReferenceRange.To,
                        DiscardLow     = item.ReferenceRange.DiscardLow,
                        PanicLow       = item.ReferenceRange.PanicLow,
                        RefRange       = item.ReferenceRange.RefRange,
                        PanicHigh      = item.ReferenceRange.PanicHigh,
                        DiscardHigh    = item.ReferenceRange.DiscardHigh
                    };


                    fD.Add(f);
                }
            });

            progressBar.Visibility = Visibility.Collapsed;
            using (SaveFileDialog sf = new SaveFileDialog
            {
                Filter = "Excel File|*.xlsx",
                Title = "Save an Excel File"
            })
            {
                sf.ShowDialog();
                var name = sf.FileName;


                if (name != "")
                {
                    FileInfo    f  = new FileInfo(name);
                    ExportClass ex = new ExportClass(fD, f);
                    progressBar.Visibility = Visibility.Visible;
                    await ex.Export();

                    progressBar.Visibility = Visibility.Collapsed;
                    exportBtn.IsEnabled    = true;
                    System.Windows.MessageBox.Show("File created!");
                }
            }
        }
Esempio n. 25
0
        private void button9_Click(object sender, EventArgs e)
        {
            ExportClass MyExcel_Class = new ExportClass();

            MyExcel_Class.DataGridViewExportToExcel(dataset, "查询导出Excel");
        }
Esempio n. 26
0
        private void butOk_Click(object sender, EventArgs e)
        {
            if (this.CheckingInput())
            {
                this.textBox1.Enabled     = false;
                this.button1.Enabled      = false;
                this.butOk.Enabled        = false;
                this.progressBar1.Enabled = true;
                this.progressBar1.Visible = true;
                this.progressBar1.Minimum = 0;
                int progressValue = 0;

                try
                {
                    if (MainForm.dt_class != null)
                    {
                        progressValue += MainForm.dt_class.Rows.Count;
                    }

                    if (MainForm.dt_land != null)
                    {
                        progressValue += MainForm.dt_land.Rows.Count;
                    }

                    if (MainForm.dt_EcosystemIndex != null)
                    {
                        progressValue += MainForm.dt_EcosystemIndex.Rows.Count;
                    }

                    if (MainForm.dt_custom != null)
                    {
                        progressValue += MainForm.dt_custom.Rows.Count;
                    }
                    if (MainForm.dt_Population != null)
                    {
                        progressValue += MainForm.dt_Population.Rows.Count;
                    }
                    this.progressBar1.Maximum = progressValue + 1;

                    if (MainForm.dt_class != null)
                    {
                        exportClass = new ExportClass(MainForm.dt_class);
                        string name = "C_" + textBox2.Text;
                        if (MainForm.baseData.zone_FC != null)
                        {
                            exportClass.ExportIFeatureClass(textBox1.Text, name, this.progressBar1);
                        }
                        else
                        {
                            exportClass.ExportITableClass(textBox1.Text, name, this.progressBar1);
                        }
                    }

                    if (MainForm.dt_land != null)
                    {
                        exportClass = new ExportClass(MainForm.dt_land);
                        string name = "L_" + textBox2.Text;
                        if (MainForm.baseData.zone_FC != null)
                        {
                            exportClass.ExportIFeatureClass(textBox1.Text, name, this.progressBar1);
                        }
                        else
                        {
                            exportClass.ExportITableClass(textBox1.Text, name, this.progressBar1);
                        }
                    }

                    if (MainForm.dt_EcosystemIndex != null)
                    {
                        exportClass = new ExportClass(MainForm.dt_EcosystemIndex);
                        string name = "eco_" + textBox2.Text;
                        if (MainForm.baseData.zone_FC != null)
                        {
                            exportClass.ExportIFeatureClass(textBox1.Text, name, this.progressBar1);
                        }
                        else
                        {
                            exportClass.ExportITableClass(textBox1.Text, name, this.progressBar1);
                        }
                    }

                    if (MainForm.dt_custom != null)
                    {
                        exportClass = new ExportClass(MainForm.dt_custom);
                        string name = "custom_" + textBox2.Text;
                        if (MainForm.baseData.zone_FC != null)
                        {
                            exportClass.ExportIFeatureClass(textBox1.Text, name, this.progressBar1);
                        }
                        else
                        {
                            exportClass.ExportITableClass(textBox1.Text, name, this.progressBar1);
                        }
                    }
                    if (MainForm.dt_Population != null)
                    {
                        exportClass = new ExportClass(MainForm.dt_Population);
                        string name = "population_" + textBox2.Text;
                        if (MainForm.baseData.zone_FC != null)
                        {
                            exportClass.ExportIFeatureClass(textBox1.Text, name, this.progressBar1);
                        }
                        else
                        {
                            exportClass.ExportITableClass(textBox1.Text, name, this.progressBar1);
                        }
                    }
                    MessageBox.Show("处理完成。");
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("处理失败!");
                }

                this.Close();
            }
        }
Esempio n. 27
0
 private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     ExportClass.ExportGrid(gridView);
 }