Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            string               xqid      = context.Request["xqid"];
            string               startdate = context.Request["startdate"];
            string               enddate   = context.Request["enddate"];
            DBOpration           db        = new DBOpration();
            List <UserInfoEnity> list_ui   = new List <UserInfoEnity>();

            list_ui = db.GetPeopleInfoList(xqid, startdate, enddate);
            List <string> imagepaths = new List <string>();

            SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
            ExcelFile      excel = new ExcelFile();
            ExcelWorksheet sheet = excel.Worksheets.Add("sheet1");

            sheet.Rows[0].Cells[0].Value  = "序号";
            sheet.Rows[0].Cells[1].Value  = "小区";
            sheet.Rows[0].Cells[2].Value  = "姓名";
            sheet.Rows[0].Cells[3].Value  = "身份证号";
            sheet.Rows[0].Cells[4].Value  = "车辆信息";
            sheet.Rows[0].Cells[5].Value  = "地址信息";
            sheet.Rows[0].Cells[6].Value  = "户主关系";
            sheet.Rows[0].Cells[7].Value  = "是否流动人口";
            sheet.Rows[0].Cells[8].Value  = "是否人户一致";
            sheet.Rows[0].Cells[9].Value  = "是否有户无人";
            sheet.Rows[0].Cells[10].Value = "图片信息";
            sheet.Rows[0].Cells[11].Value = "新增时间";
            string currentpath = HttpContext.Current.Server.MapPath("~");

            for (int i = 0; i < list_ui.Count; i++)
            {
                sheet.Rows[i + 1].Cells[0].Value  = i;
                sheet.Rows[i + 1].Cells[1].Value  = list_ui[i].Xq;
                sheet.Rows[i + 1].Cells[2].Value  = list_ui[i].Username;
                sheet.Rows[i + 1].Cells[3].Value  = list_ui[i].Idcard;
                sheet.Rows[i + 1].Cells[4].Value  = list_ui[i].Carnum;
                sheet.Rows[i + 1].Cells[5].Value  = list_ui[i].Addr;
                sheet.Rows[i + 1].Cells[6].Value  = list_ui[i].Relationship;
                sheet.Rows[i + 1].Cells[7].Value  = list_ui[i].Isoutcoming;
                sheet.Rows[i + 1].Cells[8].Value  = list_ui[i].Isidentical;
                sheet.Rows[i + 1].Cells[9].Value  = list_ui[i].Isempty;
                sheet.Rows[i + 1].Cells[10].Value = list_ui[i].Imagename;
                if (list_ui[i].Imageurl != "")
                {
                    imagepaths.Add(currentpath + list_ui[i].Imageurl);
                }
                sheet.Rows[i + 1].Cells[11].Value = list_ui[i].Inserttime;
            }

            string path     = "/tmp/file/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            string filepath = "/tmp/file/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip";

            excel.Save(currentpath + path);
            imagepaths.Add(currentpath + path);
            ZipHelper zh     = new ZipHelper();
            bool      result = zh.ZipManyFilesOrDictorys(imagepaths, currentpath + filepath, "");

            context.Response.ContentType = "text/plain";
            context.Response.Write(filepath);
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            List <Parms> parms = new List <Parms>();
            DBOpration   db    = new DBOpration();

            parms = db.GetParms();
            context.Response.ContentType = "text/plain";
            context.Response.Write(JsonHelper.GetJson <List <Parms> >(parms));
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            string               xqid      = context.Request["xqid"];
            string               startdate = context.Request["startdate"];
            string               enddate   = context.Request["enddate"];
            DBOpration           db        = new DBOpration();
            List <UserInfoEnity> list_ui   = new List <UserInfoEnity>();

            list_ui = db.GetPeopleInfoList(xqid, startdate, enddate);
            context.Response.ContentType = "text/plain";
            context.Response.Write(JsonHelper.GetJson <List <UserInfoEnity> >(list_ui));
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            MSG msg = new MSG();

            msg.Code = "200";
            DBOpration     db   = new DBOpration();
            List <XQEnity> list = new List <XQEnity>();

            list     = db.GetXQ();
            msg.Data = list;
            context.Response.ContentType = "text/plain";
            context.Response.Write(JsonHelper.GetJson <MSG>(msg));
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            UserInfoEnity ui = new UserInfoEnity();

            ui.Xq           = context.Request["xq"];
            ui.Username     = context.Request["username"];
            ui.Tel          = context.Request["tel"];
            ui.Idcard       = context.Request["idcard"];
            ui.Carnum       = context.Request["carnum"];
            ui.Addr         = context.Request["addr"];
            ui.Isidentical  = context.Request["identical"];
            ui.Isempty      = context.Request["isempty"];
            ui.Isoutcoming  = context.Request["isoutcoming"];
            ui.Relationship = context.Request["relationship"];
            ui.Imageurl     = context.Request["imageurl"];
            ui.Inserttime   = DateTime.Now.ToString();
            MSG        msg         = new MSG();
            DBOpration db          = new DBOpration();
            bool       checkidcard = db.CheckIDCard(ui.Idcard);

            if (checkidcard)
            {
                int result = db.InsertInfo(ui);

                if (result == 1)
                {
                    msg.Code = "200";
                }
                else
                {
                    msg.Code = "300";
                    msg.Msg  = "新增失败";
                }
            }
            else
            {
                msg.Code = "301";
                msg.Msg  = "新增失败,身份证号重复";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(JsonHelper.GetJson <MSG>(msg));
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            MSG msg = new MSG();

            try
            {
                HttpPostedFile file = HttpContext.Current.Request.Files["file"];

                if (file != null)
                {
                    string     key          = context.Request["user"];
                    string     serialnumber = DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N");
                    string     filename     = serialnumber + ".jpg";
                    string     smallname    = "S_" + filename;
                    string     currentpath  = HttpContext.Current.Server.MapPath("~");
                    string     path         = "/tmp/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                    ImageEnity image        = new ImageEnity();
                    image.Serialnum  = serialnumber;
                    image.Imagename  = filename;
                    image.Imagepath  = path + filename;
                    image.Simagepath = path + smallname;
                    image.Isrelated  = "0";
                    image.Openid     = key;
                    DBOpration db      = new DBOpration();
                    int        imageid = db.InsertImage(image);
                    if (imageid > 0)
                    {
                        Stream sr = file.InputStream;        //文件流
                        if (!Directory.Exists(currentpath + path))
                        {
                            DirectoryInfo dir = new DirectoryInfo(currentpath + path);
                            dir.Create();
                        }
                        Image.FromStream(sr).Save(currentpath + path + filename);
                        if (sr != null)
                        {
                            sr.Close();
                        }
                        MakeThumbnail(currentpath + path + filename, currentpath + path + smallname, 60, 80, "HW");
                        //bitmap.Save(currentpath + path);
                        msg.Code = "200";
                        msg.Msg  = serialnumber;
                    }
                    else
                    {
                        msg.Code = "300";
                        msg.Msg  = "图片提交失败";
                    }
                }
                else
                {
                    msg.Code = "300";
                    msg.Msg  = "图片未提交";
                }
            }
            catch (Exception ex)
            {
                msg.Code = "300";
                msg.Msg  = "图片提交失败";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(JsonHelper.GetJson <MSG>(msg));
        }