Beispiel #1
0
        public FrmGroupFile(string msFolderPath, string mServerID)
        {
            InitializeComponent();
            this.msFolderName = msFolderPath;
            this.mServerID    = mServerID;
            IFileTypeSetService IFileTypeSetService = BLLFactory.ServiceAccess.CreateFileTypeSetService();

            fileTypeSetLists   = IFileTypeSetService.GetFileTypeSetByMonitorServerIdAndFolderName(mServerID, msFolderPath);
            this.lblTitle.Text = msFolderPath;
            if (fileTypeSetLists.id != null && fileTypeSetLists.id != "")
            {
                if (fileTypeSetLists.exceptAttributeFlg1 == "1")
                {
                    this.chkExceptAttr1.Checked = true;
                }
                else
                {
                    this.chkExceptAttr1.Checked = false;
                }
                if (fileTypeSetLists.exceptAttribute1 != null && fileTypeSetLists.exceptAttribute1 != "")
                {
                    this.txtExceptAttr1.Text = fileTypeSetLists.exceptAttribute1;
                }
                if (fileTypeSetLists.exceptAttributeFlg2 == "1")
                {
                    this.chkExceptAttr2.Checked = true;
                }
                else
                {
                    this.chkExceptAttr2.Checked = false;
                }
                if (fileTypeSetLists.exceptAttribute2 != null && fileTypeSetLists.exceptAttribute2 != "")
                {
                    this.txtExceptAttr2.Text = fileTypeSetLists.exceptAttribute2;
                }
                if (fileTypeSetLists.exceptAttributeFlg3 == "1")
                {
                    this.chkExceptAttr3.Checked = true;
                }
                else
                {
                    this.chkExceptAttr3.Checked = false;
                }
                if (fileTypeSetLists.exceptAttribute3 != null && fileTypeSetLists.exceptAttribute3 != "")
                {
                    this.txtExceptAttr3.Text = fileTypeSetLists.exceptAttribute3;
                }
                //if (fileTypeSetLists.systemFileFlg == "1")
                //{
                //    this.chkSystemFileFlg.Checked = true;
                //}
                //if (fileTypeSetLists.hiddenFileFlg == "1")
                //{
                //    this.chkHiddenFileFlg.Checked = true;
                //}
            }
        }
Beispiel #2
0
 public int InsertFileTypeSet(FileTypeSet FileTypeSet, SqlConnection conn)
 {
     try
     {
         return(db.insert(FileTypeSet, "FileTypeSet", conn));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static extern bool CreateDelta([MarshalAs(UnmanagedType.I8)] FileTypeSet fileTypeSet,
                                       long setFlags,
                                       long resetFlags,
                                       string sourceName,
                                       string targetName,
                                       string sourceOptionsName,
                                       string targetOptionsName,
                                       DeltaInput globalOptions,
                                       IntPtr targetFileTime,
                                       [MarshalAs(UnmanagedType.U4)] HashAlgId hashAlgId,
                                       string deltaName);
Beispiel #4
0
        public int InsertFileTypeSet(FileTypeSet FileTypeSet)
        {
            OdbcConnection conn;
            int            count = 0;

            using (conn = OdbcHelper.CreateConntion())
            {
                conn.Open();
                count = FileTypeSetDal.InsertFileTypeSet(FileTypeSet, conn);
                conn.Close();
            }
            return(count);
        }
Beispiel #5
0
        private FileTypeSet searchFileTypeSet(string msID, string folderName)
        {
            FileTypeSet fSet = null;

            foreach (FileTypeSet fts in setFileList)
            {
                if (fts.monitorServerID.ToString() == msID && fts.monitorServerFolderName == folderName)
                {
                    fSet = fts;
                    setFileList.Remove(fts);
                    break;
                }
            }
            return(fSet);
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="FileTypeSet"></param>
        /// <param name="conn"></param>
        /// <returns></returns>
        public int UpdateFileTypeSet(FileTypeSet FileTypeSet, OdbcConnection conn)
        {
            int    result = -1;
            string sql    = "UPDATE fileTypeSet SET monitorServerFolderName = ?,"
                            + " monitorServerID = ?,"
                            + " exceptAttribute1 = ?,"
                            + " exceptAttribute2 = ?,"
                            + " exceptAttribute3 = ?,"
                            + " exceptAttributeFlg1 = ?,"
                            + " exceptAttributeFlg2 = ?,"
                            + " exceptAttributeFlg3 = ?,"
                            + " systemFileFlg = ?,"
                            + " hiddenFileFlg = ?,"
                            //+ " creater = ?,"
                            //+ " createDate = ?,"
                            + " updater = ?,"
                            + " updateDate = ?"
                            + " WHERE id = ?";

            OdbcParameter[] para = new OdbcParameter[] {
                new OdbcParameter("@monitorServerFolderName", FileTypeSet.monitorServerFolderName),
                new OdbcParameter("@monitorServerID", FileTypeSet.monitorServerID),
                new OdbcParameter("@exceptAttribute1", FileTypeSet.exceptAttribute1),
                new OdbcParameter("@exceptAttribute2", FileTypeSet.exceptAttribute2),
                new OdbcParameter("@exceptAttribute3", FileTypeSet.exceptAttribute3),
                new OdbcParameter("@exceptAttributeFlg1", FileTypeSet.exceptAttributeFlg1),
                new OdbcParameter("@exceptAttributeFlg2", FileTypeSet.exceptAttributeFlg2),
                new OdbcParameter("@exceptAttributeFlg3", FileTypeSet.exceptAttributeFlg3),
                new OdbcParameter("@systemFileFlg", FileTypeSet.systemFileFlg),
                new OdbcParameter("@hiddenFileFlg", FileTypeSet.hiddenFileFlg),
                //new OdbcParameter("@creater",FileTypeSet.creater),
                //new OdbcParameter("@createDate",FileTypeSet.createDate),
                new OdbcParameter("@updater", FileTypeSet.updater),
                new OdbcParameter("@updateDate", FileTypeSet.updateDate),
                new OdbcParameter("@id", FileTypeSet.id)
            };
            try
            {
                result = db.Udaquery(sql, conn, para);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Beispiel #7
0
        public ActionResult GetFileTypeSet(string msID, string folderName)
        {
            string strResult = string.Empty;
            IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();

            try
            {
                FileTypeSet fSet = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, folderName);
                strResult = JsonHelper.GetJson <FileTypeSet>(fSet);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            Response.Write(strResult);
            Response.End();
            return(null);
        }
Beispiel #8
0
        public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e)
        {
            string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? strStartPath : e.NodeName;
            List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>();

            if (!bInit)
            {
                return;
            }
            else
            {
                bInit = false;
            }
            if (string.IsNullOrEmpty(e.NodeName))
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode(strStartPath, strStartPath);
                childNode.Image.Url = ServerImageUrl;
                children.Add(childNode);
            }
            else if (Directory.Exists(parentNodePath))
            {
                IBLL.IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
                FileTypeSet   fset    = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, parentNodePath);
                DirectoryInfo dirInfo = new DirectoryInfo(parentNodePath);
                foreach (DirectoryInfo folder in dirInfo.GetDirectories())
                {
                    TreeViewVirtualNode childNode = new TreeViewVirtualNode(folder.FullName.ToString(), folder.Name.ToString());
                    childNode.Image.Url = DirImageUrl;
                    childNode.Target    = "99";
                    children.Add(childNode);
                }
                foreach (FileInfo file in dirInfo.GetFiles())
                {
                    TreeViewVirtualNode childNode = new TreeViewVirtualNode(file.FullName.ToString(), file.Name.ToString());
                    childNode.IsLeaf = true;
                    childNode.Target = file.Extension;//ファイル拡張子
                    children.Add(childNode);
                }
            }
            e.Children = children;
        }
Beispiel #9
0
        /// <summary>
        /// 保存選択の子フォルダ
        /// </summary>
        /// <param name="strFolderPath"></param>
        /// <param name="dt"></param>
        /// <param name="msID"></param>
        /// <returns></returns>
        private int InsertFolder(string strFolderPath, string dt, int msID)
        {
            int result = 0;

            try
            {
                if (Directory.Exists(strFolderPath))
                {
                    FileTypeSet   fset    = searchFileTypeSet(msID.ToString(), strFolderPath);
                    DirectoryInfo dirInfo = new DirectoryInfo(strFolderPath);
                    foreach (DirectoryInfo folder in dirInfo.GetDirectories())
                    {
                        if (fset != null)
                        {
                            if (fset.hiddenFileFlg == "1")
                            {//隠しファイル
                                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                {
                                    continue;
                                }
                            }
                            if (fset.systemFileFlg == "1")
                            {//システムファイル
                                if ((folder.Attributes & FileAttributes.System) == FileAttributes.System)
                                {
                                    continue;
                                }
                            }
                        }
                        MonitorServerFolder model = new MonitorServerFolder();
                        model.createDate      = dt;
                        model.updateDate      = dt;
                        model.creater         = Session["LoginId"].ToString();
                        model.updater         = Session["LoginId"].ToString();
                        model.monitorFlg      = "0";
                        model.deleteFlg       = 0;
                        model.initFlg         = "0";
                        model.monitorServerID = msID;
                        model.monitorFileName = folder.Name;
                        //model.monitorFilePath = folder.Parent.FullName.ToString();
                        model.monitorFilePath = strFolderPath;
                        model.monitorFileType = "99";
                        result = msFolderService.InsertMonitorServerFolder(model);
                        result = InsertFolder(folder.FullName, dt, msID);
                    }
                    foreach (FileInfo file in dirInfo.GetFiles())
                    {
                        if (fset != null)
                        {
                            string strExceptAttribute1 = string.Empty;
                            string strExceptAttribute2 = string.Empty;
                            string strExceptAttribute3 = string.Empty;
                            if (fset.exceptAttributeFlg1 == "1")
                            {
                                strExceptAttribute1 = fset.exceptAttribute1;
                            }
                            if (fset.exceptAttributeFlg2 == "1")
                            {
                                strExceptAttribute2 = fset.exceptAttribute2;
                            }
                            if (fset.exceptAttributeFlg3 == "1")
                            {
                                strExceptAttribute3 = fset.exceptAttribute3;
                            }
                            if (CommonUtil.IsExceptFile(file.Name, strExceptAttribute1, strExceptAttribute2, strExceptAttribute3))
                            {
                                continue;
                            }
                            if (fset.hiddenFileFlg == "1")
                            {//隠しファイル
                                if ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                {
                                    continue;
                                }
                            }
                            if (fset.systemFileFlg == "1")
                            {//システムファイル
                                if ((file.Attributes & FileAttributes.System) == FileAttributes.System)
                                {
                                    continue;
                                }
                            }
                        }
                        MonitorServerFolder model = new MonitorServerFolder();
                        //FileInfo file = new FileInfo(strFolderPath);
                        model.createDate      = dt;
                        model.updateDate      = dt;
                        model.creater         = Session["LoginId"].ToString();
                        model.updater         = Session["LoginId"].ToString();
                        model.monitorFlg      = "1";
                        model.deleteFlg       = 0;
                        model.initFlg         = "0";
                        model.monitorServerID = msID;
                        model.monitorFileName = file.Name;
                        //model.monitorFilePath = file.DirectoryName;
                        model.monitorFilePath = strFolderPath;
                        model.monitorFileType = file.Extension.ToString();
                        result = msFolderService.InsertMonitorServerFolder(model);
                    }
                }
            }
            catch (Exception ex)
            {
                result = -99;
                logger.Error(ex.Message);
            }
            return(result);
        }
Beispiel #10
0
        /// <summary>
        /// 获取所有父节点的除外条件
        /// </summary>
        /// 2014-8-30 wjd add
        /// <param name="msID"></param>
        /// <param name="folderName"></param>
        /// <returns></returns>
        public ActionResult GetBranchFileTypeSet(string msID, string folderName)
        {
            string strResult = string.Empty;
            IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();

            try
            {
                string        p1  = folderName.Substring(folderName.IndexOf("\\\\") + 2);
                string[]      ps  = p1.Split(new char[] { '\\' }, System.StringSplitOptions.RemoveEmptyEntries);
                List <string> pss = new List <string>();
                int           j   = 0;
                for (int i = 0; i < ps.Length; i++)
                {
                    j = i;
                    if (ps[i] == "")
                    {
                        j -= 1;
                        continue;
                    }
                    if (i == 0)
                    {
                        pss.Add("\\\\" + ps[i]);
                    }
                    else
                    {
                        pss.Add(pss[j - 1] + "\\" + ps[i]);
                    }
                }
                List <string> exceptedExt = new List <string>();
                foreach (string path in pss)
                {
                    FileTypeSet fts   = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, path);
                    string      ea1   = fts.exceptAttribute1;
                    bool        flag1 = fts.exceptAttributeFlg1 == "1";
                    string      ea2   = fts.exceptAttribute2;
                    bool        flag2 = fts.exceptAttributeFlg2 == "1";
                    string      ea3   = fts.exceptAttribute3;
                    bool        flag3 = fts.exceptAttributeFlg3 == "1";

                    if (flag1 && ea1 != "")
                    {
                        exceptedExt.Add(ea1);
                    }
                    if (flag2 && ea2 != "")
                    {
                        exceptedExt.Add(ea2);
                    }
                    if (flag3 && ea3 != "")
                    {
                        exceptedExt.Add(ea3);
                    }
                }

                strResult = JsonHelper.GetJson <List <string> >(exceptedExt);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            Response.Write(strResult);
            Response.End();
            return(null);
        }
Beispiel #11
0
        /// <summary>
        /// フォルダ設定
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult AddFileTypeSet(FileTypeSet model)
        {
            int result = -1;

            if (Session["LoginId"] == null)
            {
                result = -99;
            }
            else
            {
                try
                {
                    //FileTypeSet model = JsonHelper.ParseFormJson<FileTypeSet>(jsonModel);
                    string dt = Common.CommonUtil.DateTimeNowToString();
                    IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
                    if (model.monitorServerFolderName == null)
                    {
                        model.monitorServerFolderName = "";
                    }
                    if (model.systemFileFlg == null)
                    {
                        model.systemFileFlg = "0";
                    }
                    if (model.hiddenFileFlg == null)
                    {
                        model.hiddenFileFlg = "0";
                    }
                    if (model.exceptAttributeFlg1 == null)
                    {
                        model.exceptAttributeFlg1 = "0";
                    }
                    if (model.exceptAttributeFlg2 == null)
                    {
                        model.exceptAttributeFlg2 = "0";
                    }
                    if (model.exceptAttributeFlg3 == null)
                    {
                        model.exceptAttributeFlg3 = "0";
                    }
                    if (model.exceptAttribute1 == null)
                    {
                        model.exceptAttribute1 = "";
                    }
                    if (model.exceptAttribute2 == null)
                    {
                        model.exceptAttribute2 = "";
                    }
                    if (model.exceptAttribute3 == null)
                    {
                        model.exceptAttribute3 = "";
                    }
                    if (model.id == null || model.id == "")
                    {//インサート
                        model.createDate = dt;
                        model.updateDate = dt;
                        model.creater    = Session["LoginId"].ToString();
                        model.updater    = Session["LoginId"].ToString();
                        result           = setService.InsertFileTypeSet(model);
                    }
                    else
                    { //更新
                        model.updateDate = dt;
                        model.updater    = Session["LoginId"].ToString();
                        result           = setService.UpdateFileTypeSet(model);
                    }
                }
                catch (Exception ex)
                {
                    result = -10;
                    logger.Error(ex.Message);
                }
            }
            Response.Write(result);
            Response.End();
            return(null);
        }
Beispiel #12
0
        public ActionResult GetFolderDetail(string folderPath, bool checkstate, string msID)
        {
            string strResult = string.Empty;
            List <budbackup.Models.FolderDetail> detailList = new List <Models.FolderDetail>();

            try
            {
                if (Directory.Exists(folderPath))
                {
                    IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
                    FileTypeSet         fset       = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, folderPath);
                    DirectoryInfo       dirInfo    = new DirectoryInfo(folderPath);
                    foreach (DirectoryInfo folder in dirInfo.GetDirectories())
                    {
                        if (fset.id != null)
                        {
                            if (fset.hiddenFileFlg == "1")
                            {//隠しファイル
                                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                {
                                    continue;
                                }
                            }
                            if (fset.systemFileFlg == "1")
                            {//システムファイル
                                if ((folder.Attributes & FileAttributes.System) == FileAttributes.System)
                                {
                                    continue;
                                }
                            }
                        }
                        budbackup.Models.FolderDetail detail = new Models.FolderDetail();
                        detail.checkState         = checkstate;
                        detail.fileExtensionType  = "99";//99はフォルダーのフラグ
                        detail.fileLastUpdateTime = folder.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss");
                        detail.fileName           = folder.Name;
                        detail.fileSize           = "&lt;DIR&gt;";
                        detail.filePath           = folderPath;
                        detailList.Add(detail);
                    }
                    foreach (FileInfo file in dirInfo.GetFiles())
                    {
                        if (fset.id != null)
                        {
                            //string strExceptAttribute1 = string.Empty;
                            //string strExceptAttribute2 = string.Empty;
                            //string strExceptAttribute3 = string.Empty;
                            //if (fset.exceptAttributeFlg1 == "1")
                            //{
                            //    strExceptAttribute1 = fset.exceptAttribute1;
                            //}
                            //if (fset.exceptAttributeFlg2 == "1")
                            //{
                            //    strExceptAttribute2 = fset.exceptAttribute2;
                            //}
                            //if (fset.exceptAttributeFlg3 == "1")
                            //{
                            //    strExceptAttribute3 = fset.exceptAttribute3;
                            //}
                            //if (CommonWeb.CommonUtil.IsExceptFile(file.Name, strExceptAttribute1, strExceptAttribute2, strExceptAttribute3))
                            //{
                            //    continue;
                            //}
                            if (fset.hiddenFileFlg == "1")
                            {//隠しファイル
                                if ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                {
                                    continue;
                                }
                            }
                            if (fset.systemFileFlg == "1")
                            {//システムファイル
                                if ((file.Attributes & FileAttributes.System) == FileAttributes.System)
                                {
                                    continue;
                                }
                            }
                        }
                        budbackup.Models.FolderDetail detail = new Models.FolderDetail();
                        detail.checkState         = checkstate;
                        detail.fileExtensionType  = file.Extension.ToString();
                        detail.fileLastUpdateTime = file.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss");
                        detail.fileName           = file.Name;
                        detail.fileSize           = file.Length.ToString("###,###");
                        detail.filePath           = folderPath;
                        detailList.Add(detail);
                    }
                }
                else if (System.IO.File.Exists(folderPath))
                {
                    FileInfo file = new FileInfo(folderPath);
                    budbackup.Models.FolderDetail detail = new Models.FolderDetail();
                    detail.checkState         = checkstate;
                    detail.fileExtensionType  = file.Extension.ToString();
                    detail.fileLastUpdateTime = file.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss");
                    detail.fileName           = file.Name;
                    detail.fileSize           = file.Length.ToString("###,###");
                    detail.filePath           = file.DirectoryName;
                    detailList.Add(detail);
                }
                strResult = JsonHelper.GetJson <List <budbackup.Models.FolderDetail> >(detailList);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            Response.Write(strResult);
            Response.End();
            return(null);
        }
Beispiel #13
0
        public ActionResult Add(string dataJson, int intMonitorServerID)
        {
            int result = 0;

            if (Session["LoginId"] == null)
            {
                result = -99;
            }
            else
            {
                try {
                    List <MonitorServerFolder> folderList = new List <MonitorServerFolder>();
                    folderList = JsonHelper.ParseFormJson <List <MonitorServerFolder> >(dataJson);
                    IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
                    setFileList = setService.GetFileTypeSetByMonitorServerID(intMonitorServerID.ToString());
                    string dt = Common.CommonUtil.DateTimeNowToString();
                    msFolderService.DeleteMonitorServerFolderByServerId(intMonitorServerID);

                    //format folder list
                    globalfolderList = folderList;

                    tempRemoveLists.Clear();
                    //Not filter——2014-06-11 wjd commented
                    //formatListsByFileTypeSet(intMonitorServerID.ToString());

                    foreach (MonitorServerFolder model in globalfolderList)
                    {
                        if (model != null)
                        {
                            model.id = null;
                            model.monitorFilePath = model.monitorFilePath.TrimEnd('\\');
                            if (model.monitorFileType == "99")
                            { //選択のはフォルダの場合
                                string strpath = string.Empty;
                                if (model.monitorFileName == "")
                                {
                                    strpath = model.monitorFilePath;
                                }
                                else
                                {
                                    strpath = model.monitorFilePath + "\\" + model.monitorFileName;
                                }
                                if (Directory.Exists(strpath))
                                {
                                    FileTypeSet   fset    = setService.GetFileTypeSetByMonitorServerIdAndFolderName(intMonitorServerID.ToString(), model.monitorFilePath);
                                    DirectoryInfo dirInfo = new DirectoryInfo(strpath);
                                    if (fset != null)
                                    {
                                        if (fset.hiddenFileFlg == "1")
                                        {//隠しファイル
                                            if ((dirInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                            {
                                                continue;
                                            }
                                        }
                                        if (fset.systemFileFlg == "1")
                                        {//システムファイル
                                            if ((dirInfo.Attributes & FileAttributes.System) == FileAttributes.System)
                                            {
                                                continue;
                                            }
                                        }
                                    }
                                    model.createDate      = dt;
                                    model.updateDate      = dt;
                                    model.creater         = Session["LoginId"].ToString();
                                    model.updater         = Session["LoginId"].ToString();
                                    model.monitorServerID = intMonitorServerID;
                                    model.monitorFlg      = "0";
                                    model.initFlg         = "1";
                                    model.deleteFlg       = 0;
                                    result = msFolderService.InsertMonitorServerFolder(model);
                                    //Not save subfolder——2014-06-11 wjd commented
                                    //result = InsertFolder(strpath, dt.ToString(), intMonitorServerID);
                                }
                            }
                            else
                            {//選択のはファイルの場合
                                string      pathName = model.monitorFilePath + "\\" + model.monitorFileName;
                                FileTypeSet fset     = setService.GetFileTypeSetByMonitorServerIdAndFolderName(intMonitorServerID.ToString(), model.monitorFilePath);
                                FileInfo    fileInfo = new FileInfo(pathName);
                                if (fset != null)
                                {
                                    if (fset.hiddenFileFlg == "1")
                                    {//隠しファイル
                                        if ((fileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                        {
                                            continue;
                                        }
                                    }
                                    if (fset.systemFileFlg == "1")
                                    {//システムファイル
                                        if ((fileInfo.Attributes & FileAttributes.System) == FileAttributes.System)
                                        {
                                            continue;
                                        }
                                    }
                                }
                                model.createDate      = dt;
                                model.updateDate      = dt;
                                model.creater         = Session["LoginId"].ToString();
                                model.updater         = Session["LoginId"].ToString();
                                model.monitorServerID = intMonitorServerID;
                                model.monitorFlg      = "1";
                                model.deleteFlg       = 0;
                                model.initFlg         = "1";
                                result = msFolderService.InsertMonitorServerFolder(model);
                            }
                        }
                    }

                    /* --選択条件 不要
                     * foreach (FileTypeSet fts in setFileList)
                     * {
                     *  if (Directory.Exists(fts.monitorServerFolderName))
                     *  {
                     *      DirectoryInfo dirInfo = new DirectoryInfo(fts.monitorServerFolderName);
                     *      foreach (FileInfo file in dirInfo.GetFiles())
                     *      {
                     *
                     *          if (CommonUtil.IsExceptFile(file.Name, fts.includeAttribute1, fts.includeAttribute2, fts.includeAttribute3))
                     *          {
                     *              bool bSaved = false;
                     *              foreach (MonitorServerFolder modelFolder in folderList)
                     *              {
                     *
                     *                  if (fts.monitorServerFolderName == modelFolder.monitorFilePath && file.Name == modelFolder.monitorFileName)
                     *                  {
                     *                      bSaved = true;
                     *                      break;
                     *                  }
                     *              }
                     *              if (bSaved)
                     *              {
                     *                  continue;
                     *              }
                     *              MonitorServerFolder model = new MonitorServerFolder();
                     *              //FileInfo file = new FileInfo(strFolderPath);
                     *              model.createDate = dt.ToString();
                     *              model.updateDate = dt.ToString();
                     *              model.creater = Session["LoginId"].ToString();
                     *              model.updater = Session["LoginId"].ToString();
                     *              model.monitorFlg = "1";
                     *              model.deleteFlg = 0;
                     *              model.initFlg = "1";
                     *              model.monitorServerID = intMonitorServerID;
                     *              model.monitorFileName = file.Name;
                     *              model.monitorFilePath = file.DirectoryName;
                     *              model.monitorFileType = file.Extension.ToString();
                     *              result = msFolderService.InsertMonitorServerFolder(model);
                     *          }
                     *      }
                     *
                     *  }
                     * }
                     */
                }
                catch (Exception ex)
                {
                    result = -10;
                    logger.Error(ex.Message);
                }
            }
            Response.Write(result);
            Response.End();
            return(null);
        }
        private FileManagerRootFolder CreateRootFolder2()
        {
            //Use object initializers instead of assignment statements for making the code more compact.

            var rootFolder = new FileManagerRootFolder
            {
                Name     = "2. Feature Tests",
                Location = "~/App_Data/Feature Tests"
            };

            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\",
                AllowedPermissions = FileManagerPermissions.ReadOnly
            });

            //Access controls for subfolder "6. Permissions" and below
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions",
                AllowedPermissions = FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\01. Full",
                AllowedPermissions = FileManagerPermissions.Full
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\02. Read",
                AllowedPermissions = FileManagerPermissions.ReadOnly
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\03. List subfolders",
                AllowedPermissions = FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\04. List files",
                AllowedPermissions = FileManagerPermissions.ListFiles
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\05. Create",
                AllowedPermissions = FileManagerPermissions.Create
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\06. Delete",
                AllowedPermissions = FileManagerPermissions.Delete
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\07. Rename",
                AllowedPermissions = FileManagerPermissions.Rename
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\08. Edit",
                AllowedPermissions = FileManagerPermissions.Edit
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\09. Upload",
                AllowedPermissions = FileManagerPermissions.Upload
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\10. Download",
                AllowedPermissions = FileManagerPermissions.Download
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\11. Compress",
                AllowedPermissions = FileManagerPermissions.Compress
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\12. Extract",
                AllowedPermissions = FileManagerPermissions.Extract
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\13. Cut",
                AllowedPermissions = FileManagerPermissions.Cut
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\14. Copy",
                AllowedPermissions = FileManagerPermissions.Copy
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\6. Permissions\15. Paste",
                AllowedPermissions = FileManagerPermissions.Paste
                                     | FileManagerPermissions.ListFiles
                                     | FileManagerPermissions.ListSubfolders
            });

            //Access controls for subfolder "7. File Type Restrictions" and below
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\7. File Type Restrictions\1. Only Image files (jpg, png, bmp, gif)",
                AllowedPermissions = FileManagerPermissions.Full,
                AllowedFileTypes   = FileTypeSet.Parse("*.jpg|*.png|*.bmp|*.gif")
            });

            //Access controls for subfolder "8. Quota Restrictions" and below
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\8. Quota Restrictions\1. Quota (1 MB)",
                AllowedPermissions = FileManagerPermissions.Full,
                Quota = ByteSizeValue.Parse("1MB")
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\8. Quota Restrictions\2. Quota (15 MB)",
                AllowedPermissions = FileManagerPermissions.Full,
                Quota = ByteSizeValue.Parse("15MB")
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\8. Quota Restrictions\2. Quota (15 MB)\Quota (1 MB)",
                AllowedPermissions = FileManagerPermissions.Full,
                Quota = ByteSizeValue.Parse("1MB")
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\8. Quota Restrictions\2. Quota (15 MB)\Deep\Quota (1 MB)",
                AllowedPermissions = FileManagerPermissions.Full,
                Quota = ByteSizeValue.Parse("1MB")
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\8. Quota Restrictions\3. Quota (Unlimited)",
                AllowedPermissions = FileManagerPermissions.Full
            });
            rootFolder.AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\8. Quota Restrictions\3. Quota (Unlimited)\Quota (1 MB)",
                AllowedPermissions = FileManagerPermissions.Full,
                Quota = ByteSizeValue.Parse("1MB")
            });

            return(rootFolder);
        }
        public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e)
        {
            //string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Request.MapPath("~/") : e.NodeName;
            string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? strStartPath : e.NodeName;
            List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>();

            //if (strStartPath == "")
            //{

            //}
            if (!bInit)
            {
                return;
            }
            else
            {
                bInit = false;
            }
            if (string.IsNullOrEmpty(e.NodeName))
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode(strStartPath, strStartPath);
                childNode.Image.Url = ServerImageUrl;
                children.Add(childNode);
            }
            //else if (Directory.Exists(parentNodePath))
            //{
            //    foreach (string childPath in Directory.GetDirectories(parentNodePath))
            //    {
            //        string childDirName = Path.GetFileName(childPath);
            //        //if(IsSystemName(childDirName))
            //        //    continue;
            //        TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childDirName);
            //        childNode.Image.Url = DirImageUrl;
            //        childNode.Target = "99";
            //        children.Add(childNode);
            //    }
            //    // ファイルを表示する必要がない。
            //    foreach (string childPath in Directory.GetFiles(parentNodePath))
            //    {
            //        string childFileName = Path.GetFileName(childPath);
            //        //if(IsSystemName(childFileName))
            //        //    continue;
            //        TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childFileName);
            //        childNode.IsLeaf = false;
            //        childNode.Image.Url = FileImageUrl;
            //        childNode.ClientVisible = false;
            //        children.Add(childNode);
            //    }
            //}
            else if (Directory.Exists(parentNodePath))
            {
                IBLL.IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
                FileTypeSet   fset    = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, parentNodePath);
                DirectoryInfo dirInfo = new DirectoryInfo(parentNodePath);
                try
                {
                    foreach (DirectoryInfo folder in dirInfo.GetDirectories())
                    {
                        if (fset.id != null)
                        {
                            if (fset.hiddenFileFlg == "1")
                            {//隠しファイル
                                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                {
                                    continue;
                                }
                            }
                            if (fset.systemFileFlg == "1")
                            {//システムファイル
                                if ((folder.Attributes & FileAttributes.System) == FileAttributes.System)
                                {
                                    continue;
                                }
                            }
                        }
                        TreeViewVirtualNode childNode = new TreeViewVirtualNode(folder.FullName.ToString(), folder.Name.ToString());
                        childNode.Image.Url = DirImageUrl;
                        childNode.Target    = "99";
                        children.Add(childNode);
                    }

                    foreach (FileInfo file in dirInfo.GetFiles())
                    {
                        if (fset.id != null)
                        {
                            //string strExceptAttribute1 = string.Empty;
                            //string strExceptAttribute2 = string.Empty;
                            //string strExceptAttribute3 = string.Empty;
                            //if (fset.exceptAttributeFlg1 == "1")
                            //{
                            //    strExceptAttribute1 = fset.exceptAttribute1;
                            //}
                            //if (fset.exceptAttributeFlg2 == "1")
                            //{
                            //    strExceptAttribute2 = fset.exceptAttribute2;
                            //}
                            //if (fset.exceptAttributeFlg3 == "1")
                            //{
                            //    strExceptAttribute3 = fset.exceptAttribute3;
                            //}
                            //if (CommonWeb.CommonUtil.IsExceptFile(file.Name, strExceptAttribute1, strExceptAttribute2, strExceptAttribute3))
                            //{
                            //    continue;
                            //}
                            if (fset.hiddenFileFlg == "1")
                            {//隠しファイル
                                if ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                                {
                                    continue;
                                }
                            }
                            if (fset.systemFileFlg == "1")
                            {//システムファイル
                                if ((file.Attributes & FileAttributes.System) == FileAttributes.System)
                                {
                                    continue;
                                }
                            }
                        }
                        TreeViewVirtualNode childNode = new TreeViewVirtualNode(file.FullName.ToString(), file.Name.ToString());

                        //show files——2014-06-02 wjd modified

                        //childNode.IsLeaf = true;
                        childNode.Image.Url           = FileImageUrl;
                        childNode.Image.AlternateText = file.Extension;//ファイル拡張子
                        //childNode.Target = file.Extension;
                        childNode.Expanded = true;
                        //childNode.ClientVisible = false;
                        children.Add(childNode);
                    }
                }
                catch (System.Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
            e.Children = children;
        }
Beispiel #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            IFileTypeSetService IFileTypeSetService = BLLFactory.ServiceAccess.CreateFileTypeSetService();
            FileTypeSet         fileTypeSet         = new FileTypeSet();

            if (msFolderName != "")
            {
                fileTypeSet.monitorServerFolderName = msFolderName;
            }
            fileTypeSet.monitorServerID     = Convert.ToInt32(mServerID);
            fileTypeSet.exceptAttribute1    = "";
            fileTypeSet.exceptAttribute2    = "";
            fileTypeSet.exceptAttribute3    = "";
            fileTypeSet.exceptAttributeFlg1 = "0";
            fileTypeSet.exceptAttributeFlg2 = "0";
            fileTypeSet.exceptAttributeFlg3 = "0";
            fileTypeSet.systemFileFlg       = "0";
            fileTypeSet.hiddenFileFlg       = "0";
            if (this.chkExceptAttr1.Checked == true && this.txtExceptAttr1.Text.Trim() != "")
            {
                fileTypeSet.exceptAttributeFlg1 = "1";
            }
            if (this.txtExceptAttr1.Text.Trim() != "")
            {
                fileTypeSet.exceptAttribute1 = this.txtExceptAttr1.Text.Trim();
            }
            if (this.chkExceptAttr2.Checked == true && this.txtExceptAttr2.Text.Trim() != "")
            {
                fileTypeSet.exceptAttributeFlg2 = "1";
            }
            if (this.txtExceptAttr2.Text.Trim() != "")
            {
                fileTypeSet.exceptAttribute2 = this.txtExceptAttr2.Text.Trim();
            }
            if (this.chkExceptAttr3.Checked == true && this.txtExceptAttr3.Text.Trim() != "")
            {
                fileTypeSet.exceptAttributeFlg3 = "1";
            }
            if (this.txtExceptAttr3.Text.Trim() != "")
            {
                fileTypeSet.exceptAttribute3 = this.txtExceptAttr3.Text.Trim();
            }
            //if (this.chkSystemFileFlg.Checked == true)
            //{
            //    fileTypeSet.systemFileFlg = "1";
            //}
            //if (this.chkHiddenFileFlg.Checked == true)
            //{
            //    fileTypeSet.hiddenFileFlg = "1";
            //}
            fileTypeSet.deleteFlg  = 0;
            fileTypeSet.creater    = FrmMain.userinfo.loginID;
            fileTypeSet.createDate = CommonUtil.DateTimeNowToString();
            fileTypeSet.updater    = FrmMain.userinfo.loginID;
            fileTypeSet.updateDate = CommonUtil.DateTimeNowToString();

            FileTypeSet fts = IFileTypeSetService.GetFileTypeSetByMonitorServerIdAndFolderName(mServerID, msFolderName);

            if (fts.id != "" && fts.id != null)
            {
                fileTypeSet.id = fts.id;
                int updateFlg = -1;
                if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                {
                    try
                    {
                        updateFlg = IFileTypeSetService.UpdateFileTypeSet(fileTypeSet);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                if (updateFlg > -1)
                {
                    MsgHelper.InfoMsg(ValidationRegex.U001, ValidationRegex.publicTitle);
                    gFlag = true;
                    this.Dispose();
                }
                else
                {
                    MsgHelper.InfoMsg(ValidationRegex.U002, ValidationRegex.publicTitle);
                }
            }
            else
            {
                int insertFlg = -1;
                if (this.txtExceptAttr1.Text.Trim() != "" ||
                    this.txtExceptAttr2.Text.Trim() != "" ||
                    this.txtExceptAttr3.Text.Trim() != "" ||
                    this.chkHiddenFileFlg.Checked == true ||
                    this.chkSystemFileFlg.Checked == true)
                {
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q002, ValidationRegex.publicTitle))
                    {
                        try
                        {
                            insertFlg = IFileTypeSetService.InsertFileTypeSet(fileTypeSet);
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                        }
                    }
                }
                if (this.txtExceptAttr1.Text.Trim() == "" &&
                    this.txtExceptAttr2.Text.Trim() == "" &&
                    this.txtExceptAttr3.Text.Trim() == "" ||
                    this.chkHiddenFileFlg.Checked == true ||
                    this.chkSystemFileFlg.Checked == true)
                {
                    insertFlg = 0;
                }
                if (insertFlg > -1)
                {
                    MsgHelper.InfoMsg(ValidationRegex.I001, ValidationRegex.publicTitle);
                    gFlag = true;
                    this.Dispose();
                }
                else
                {
                    MsgHelper.InfoMsg(ValidationRegex.I002, ValidationRegex.publicTitle);
                }
            }
            this.DialogResult = DialogResult.OK;
        }