Example #1
0
        private void InSertFile(string pid, string bh, string singleProjectId, string fileName, string filePath) {
            int OrderIndex = 1;
            string MaxBH = filelistBLL.GetMaxBH("SingleProjectID=" + singleProjectId + " and bh like '" + bh + "%'");
            if (MaxBH != null && MaxBH.IndexOf("-") > -1) {
                OrderIndex = ConvertEx.ToInt(MaxBH.Substring(MaxBH.LastIndexOf("-") + 1)) + 10;
            }
            MaxBH = string.Concat(bh, "-", OrderIndex.ToString("D3"));

            T_FileList_MDL filelistMDL = new T_FileList_MDL();
            filelistMDL.SingleProjectID = ConvertEx.ToInt(singleProjectId);       //工程ID
            filelistMDL.BH = MaxBH;                                               //编号
            filelistMDL.PID = ConvertEx.ToInt(pid);                               //父ID
            filelistMDL.Title = "照片" + OrderIndex.ToString();                    //提名
            filelistMDL.RootPath = filePath;                                      //保存路径
            filelistMDL.lrr = Common.Session.GetSession("UserID");                //上传人
            filelistMDL.lrsj = DateTime.Now;                                      //上传时间
            filelistMDL.wjbt = fileName;                                          //文件名称
            filelistMDL.IsFolder = false;
            filelistMDL.OrderIndex = OrderIndex;


            if (System.IO.File.Exists(filePath + fileName)) {
                EXIFMetaData em = new EXIFMetaData();
                EXIFMetaData.Metadata m = em.GetEXIFMetaData(filePath + fileName);

                filelistMDL.xjpp = m.EquipmentMake.DisplayValue;            //相机品牌
                filelistMDL.fbl = m.ImageWidth.DisplayValue + "*" + m.ImageHeight.DisplayValue;       //分辨率
                filelistMDL.xjxh = m.CameraModel.DisplayValue;              //相机型号  
                filelistMDL.XAXIS_RESOLUTION = m.XResolution.DisplayValue;  //X轴分辨率
                filelistMDL.YAXIS_RESOLUTION = m.YResolution.DisplayValue;  //Y轴分辨率
                filelistMDL.IMAGE_WIDTH = m.ImageWidth.DisplayValue;        //宽度
                filelistMDL.IMAGE_HEIGHT = m.ImageHeight.DisplayValue;      //高度
                filelistMDL.DATA_FICAL_LENGTH = m.FocalLength.DisplayValue; //焦距
                filelistMDL.DATA_APERTURE = "";                             //光圈
                filelistMDL.DATA_APERTURE_XS = "";                          //光圈系数
                filelistMDL.FLASH = m.Flash.DisplayValue;                   //闪光灯
                filelistMDL.WHITE_BALANCE = "自动";                         //白平衡

                if (m.ISOSpeed.DisplayValue != null && m.ISOSpeed.DisplayValue.Length > 0)
                    filelistMDL.ISO_SPEED_RATINGS = "ISO-" + m.ISOSpeed.DisplayValue;    //感光度
                filelistMDL.EXPOSURE_PROGRAM = m.ExposureProg.DisplayValue; //曝光程序
                filelistMDL.EXPOSURE_MODE = "";                             //曝光模式
                filelistMDL.DATA_EXPOSURE_TIME = m.ExposureTime.DisplayValue;    //曝光时间
                filelistMDL.QUALITY = "正常";     //清晰度
                filelistMDL.CONTRAST = "正常";    //对比度
                filelistMDL.SATURATION = "正常";  //饱和度
                filelistMDL.MAX_APERTURE = m.MaxAperture.DisplayValue; //最大光圈数
                //if (m.DatePictureTaken.DisplayValue != null && m.DatePictureTaken.DisplayValue.Length > 0)
                //{
                //    string[] spDt = m.DatePictureTaken.DisplayValue.Replace("\0", "").Split(new char[] { ' ' });
                //    if (spDt.Length == 2)
                //    {
                //        filelistMDL.pssj = Convert.ToDateTime(string.Concat(spDt[0].Replace(":", "-"), " ",
                //            spDt[1]));
                //    }
                //}
            }

            int FileListID = filelistBLL.Add(filelistMDL);

            BLL.T_Other_BLL otherBLL = new DigiPower.Onlinecol.Standard.BLL.T_Other_BLL();
            otherBLL.UpdateArchiveStatus(FileListID.ToString(), 10, "0");

            PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_FileList;key=", FileListID,
                ";SingleProjectID=", singleProjectId, ";FileListID=", FileListID, ";Title=", "照片" + OrderIndex.ToString(), ";工程外观图上传"));
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   result = string.Empty;
            string   type   = get_LinkParam("type");
            string   id     = string.Empty;
            string   body   = string.Empty;
            Resource rs     = new Resource();

            switch (type)
            {
            case "orderNew":    //OrderNew.aspx
                string mailFrom     = ConfigurationManager.AppSettings["mailFrom"];
                string mailSubject1 = ConfigurationManager.AppSettings["mailSubject"];
                if (string.IsNullOrEmpty(mailSubject1))
                {
                    mailSubject1 = "有新的订单";
                }

                Tool t1 = new Tool();
                mailFrom = t1.GetValue(Tool.GetDocument("/xml/System.xml"), "from");
                if (Session["OrderNew"] != null && Session["OrderNew"].ToString() != string.Empty)
                {
                    body = Session["OrderNew"].ToString();
                }
                Orders obj1 = new Orders();
                obj1.sendNewOrder(mailFrom, mailSubject1, body);
                break;

            case "validate":    //Validating.aspx
                string mail    = get_LinkParam("mail");
                string subject = get_LinkParam("subject");

                if (Session["Validate"] != null && Session["Validate"].ToString() != string.Empty)
                {
                    body = Session["Validate"].ToString();
                }
                Tool        t            = new Tool();
                XmlDocument doc          = Tool.GetDocument("/xml/System.xml");
                string      smtpHost     = t.GetValue(doc, "host");
                string      smtpUserName = t.GetValue(doc, "userName");
                string      smtpPassword = t.GetValue(doc, "password");

                string fromEmail = t.GetValue(doc, "from");

                Tool.sendMail(smtpHost, smtpUserName, smtpPassword, fromEmail, mail, subject, body);
                break;

            case "send":    //OrdersManage.aspx OrderNotPass.aspx OrderDetail.aspx
                string _userEmail  = get_LinkParam("mail");
                string mailSubject = get_LinkParam("subject");
                string mailBody    = string.Empty;
                if (Session["MailBody"] != null && Session["MailBody"].ToString() != string.Empty)
                {
                    mailBody = Session["MailBody"].ToString();
                }
                if (!string.IsNullOrEmpty(_userEmail) && !string.IsNullOrEmpty(mailBody))
                {
                    Orders obj = new Orders();
                    obj.sendNewOrderToUser(_userEmail, mailSubject, mailBody);
                }
                break;

            case "error":     //error.aspx
                string html = string.Empty;
                if (Session["ErrorHtml"] != null && Session["ErrorHtml"].ToString() != string.Empty)
                {
                    html = Session["ErrorHtml"].ToString();
                }
                if (!string.IsNullOrEmpty(html))
                {
                    XmlDocument doc1       = Tool.GetDocument("/xml/System.xml");
                    Tool        tool       = new Tool();
                    string      host       = tool.GetValue(doc1, "host");
                    string      username   = tool.GetValue(doc1, "userName");
                    string      pass       = tool.GetValue(doc1, "password");
                    string      from       = tool.GetValue(doc1, "from");
                    string      adminUid   = ConfigurationManager.AppSettings["superAdminId"];
                    string      adminEmail = new MemberShipManager().GetUserEmailByUserID(adminUid);
                    string      to         = adminEmail;
                    string      subject1   = "错误信息";
                    Tool.sendMail(host, username, pass, from, to, subject1, html);
                }
                break;

            case "exif":
                #region EXIF信息
                string folderName = get_LinkParam("folder");
                string fileName   = get_LinkParam("file");
                string yRootPath  = string.Empty;
                try {
                    ImageType obj = new ImageType();
                    yRootPath = obj.GetSourcePath(folderName, fileName);

                    EXIFMetaData          em = new EXIFMetaData();
                    EXIFMetaData.Metadata m  = em.GetEXIFMetaData(yRootPath);

                    StringBuilder sb = new StringBuilder();
                    sb.Append("<table>");
                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                    sb.Append("<span>设备制造商:</span>");
                    sb.Append("</td><td style=\"word-wrap:break-word;word-break:break-all;\">");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.EquipmentMake.DisplayValue) ? string.Empty : m.EquipmentMake.DisplayValue.Replace("\0", string.Empty));
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                    sb.Append("<span>摄影机型号:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.CameraModel.DisplayValue) ? string.Empty : m.CameraModel.DisplayValue.Replace("\0", string.Empty));
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                    sb.Append("<span>颜色表示:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ColorSpace.DisplayValue) ? string.Empty : m.ColorSpace.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                    sb.Append("<span>闪关灯模式:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.Flash.DisplayValue) ? string.Empty : m.Flash.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                    sb.Append("<span>焦距:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.FocalLength.DisplayValue) ? string.Empty : m.FocalLength.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\">");
                    sb.Append("<span>曝光时间:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ExposureTime.DisplayValue) ? string.Empty : m.ExposureTime.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>ISO:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ISOSpeed.DisplayValue) ? string.Empty : m.ISOSpeed.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>光源:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.LightSource.DisplayValue) ? string.Empty : m.LightSource.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>曝光程序:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ExposureProg.DisplayValue) ? string.Empty : m.ExposureProg.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>曝光补偿:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ExposureBias.DisplayValue) ? string.Empty : m.ExposureBias.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>相机拍照时间:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.DatePictureTaken.DisplayValue) ? string.Empty : m.DatePictureTaken.DisplayValue.Replace("\0", string.Empty));
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>宽度:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ImageWidth.DisplayValue) ? string.Empty : m.ImageWidth.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>高度:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.ImageHeight.DisplayValue) ? string.Empty : m.ImageHeight.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>水平分辨率:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.XResolution.DisplayValue) ? string.Empty : m.XResolution.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("<tr><td align=\"left\" valign=\"top\" width=\"100px\"><span>垂直分辨率:</span>");
                    sb.Append("</td><td>");
                    sb.Append("<strong>");
                    sb.Append(string.IsNullOrEmpty(m.YResolution.DisplayValue) ? string.Empty : m.YResolution.DisplayValue);
                    sb.Append("</strong>");
                    sb.Append("</td></tr>");

                    sb.Append("</table>");
                    result = sb.ToString();
                }
                catch {
                    if (string.IsNullOrEmpty(result))
                    {
                        result = "<span style=\"color:red; padding:5px 5px 5px 5px;\">获取信息失败!!</span>";
                    }
                }
                #endregion
                break;
            }

            Response.Write(result);
            Response.End();
        }