コード例 #1
0
        public static bool CheckOrderAttach(int OrderID, string configName)
        {
            BLL.Order           order     = new BLL.Order();
            Common.Entity.Order oInfo     = order.GetOrderByPKID(OrderID);
            IList <string>      orderCars = order.GetCarsOrder(OrderID);
            JArray         requireJObj    = JArray.Parse(ConfigurationManager.AppSettings[configName]);
            IList <string> filesRequire   = _getMatchingAttach(oInfo, orderCars, requireJObj);
            String         uploadTempPath = ConfigurationManager.AppSettings["uploadPath"];
            string         tempPath       = oInfo.Code.Split(new char[] { '-' })[1];

            uploadTempPath = uploadTempPath + "\\OrdersPic\\" + tempPath.Substring(0, 4) + "\\" + tempPath + "\\";
            foreach (string s in filesRequire)
            {
                if ("9" == s)
                {
                    //9,B,C,D,E都为合同
                    if (!(File.Exists(string.Format("{0}{1}fufAttach9.jpg", uploadTempPath, oInfo.Code)) || File.Exists(string.Format("{0}{1}fufAttachB.jpg", uploadTempPath, oInfo.Code)) || File.Exists(string.Format("{0}{1}fufAttachC.jpg", uploadTempPath, oInfo.Code)) || File.Exists(string.Format("{0}{1}fufAttachD.jpg", uploadTempPath, oInfo.Code)) || File.Exists(string.Format("{0}{1}fufAttachE.jpg", uploadTempPath, oInfo.Code))))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!File.Exists(string.Format("{0}{1}fufAttach{2}.jpg", uploadTempPath, oInfo.Code, s)))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }