Ejemplo n.º 1
0
    //---------------------------------------------------------------

    #region ---------------SaveFiles---------------
    //-----------------------------------------------
    //SaveFiles
    //-----------------------------------------------
    protected void SaveFiles(UsersDataEntity UserDataObject)
    {
        #region Save uploaded photo
        //Photo-----------------------------
        if (fuPhoto.HasFile)
        {
            //if has an old photo
            if (!string.IsNullOrEmpty(oldPhotoExtension))
            {
                //Delete old original photo
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID) + oldPhotoExtension);
                //Delete old Thumbnails
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
            }
            //------------------------------------------------
            //Save new original photo
            fuPhoto.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UserDataObject.Photo);
            //Create new thumbnails
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID), UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID), UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
        }
        //------------------------------------------------
        #endregion
    }
Ejemplo n.º 2
0
 public static void CreateUserFolder(MembershipUser user, UsersDataEntity userdata)
 {
     if (user != null && userdata != null)
     {
         if (user.IsApproved && UsersDataFactory.IsSubSubSiteOwner(userdata.UserType))
         {
             string subSiteFolder             = DCSiteUrls.GetPath_SubSiteUploadFolder(user.UserName);
             string subSiteFolderPhysicalPath = DCServer.MapPath(subSiteFolder);
             if (!Directory.Exists(subSiteFolderPhysicalPath))
             {
                 string        subSiteEmptyFolderPhysicalPath = DCServer.MapPath(DCSiteUrls.GetPath_DefaultSubSiteFolder());
                 DirectoryInfo diSource = new DirectoryInfo(subSiteEmptyFolderPhysicalPath);
                 DirectoryInfo diTarget = new DirectoryInfo(subSiteFolderPhysicalPath);
                 DcDirectoryManager.CopyAll(diSource, diTarget);
             }
         }
         else
         {
             // Create msg folder
             string folder             = DCSiteUrls.GetPath_UserDataDirectory(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID);
             string folderPhysicalPath = DCServer.MapPath(folder);
             if (!Directory.Exists(folderPhysicalPath))
             {
                 string        defaultFolder             = DCSiteUrls.GetPath_DefaultUserDataFolder();
                 string        defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder);
                 DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath);
                 DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath);
                 DcDirectoryManager.CopyAll(diSource, diTarget);
             }
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates ItemCategories object by calling ItemCategories data provider create method.
        /// <example>[Example]bool status=ItemCategoriesFactory.Create(itemCategoriesObject);.</example>
        /// </summary>
        /// <param name="itemCategoriesObject">The ItemCategories object.</param>
        /// <returns>Status of create operation.</returns>
        public static ExecuteCommandStatus Create(ItemCategoriesEntity category, ItemsModulesOptions currentModule)
        {
            //Insert user name------------------------------------------
            string username = "";

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                username = HttpContext.Current.User.Identity.Name;
                category.InsertUserName = username;
            }
            //----------------------------------------------------------
            ExecuteCommandStatus status = ItemCategoriesSqlDataPrvider.Instance.Create(category, currentModule);

            //-------------------------------------
            if (status == ExecuteCommandStatus.Done)
            {
                string folder             = DCSiteUrls.GetPath_ItemCategoriesDirectory(category.OwnerName, category.ModuleTypeID, category.CategoryID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (!Directory.Exists(folderPhysicalPath))
                {
                    string        defaultFolder             = DCSiteUrls.GetPath_DefaultCategoryFolder();
                    string        defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder);
                    DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath);
                    DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.CopyAll(diSource, diTarget);
                }
            }
            //-------------------------------------
            return(status);
        }
Ejemplo n.º 4
0
 public static void DeleteUserFolder(MembershipUser user, UsersDataEntity userdata)
 {
     if (user != null && userdata != null)
     {
         if (user.IsApproved && UsersDataFactory.IsSubSubSiteOwner(userdata.UserType))
         {
             string subSiteFolder             = DCSiteUrls.GetPath_SubSiteUploadFolder(user.UserName);
             string subSiteFolderPhysicalPath = DCServer.MapPath(subSiteFolder);
             if (Directory.Exists(subSiteFolderPhysicalPath))
             {
                 DirectoryInfo dir = new DirectoryInfo(subSiteFolderPhysicalPath);
                 DcDirectoryManager.DeletDirectory(dir);
             }
         }
         else
         {
             string folder             = DCSiteUrls.GetPath_UserDataDirectory(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID);
             string folderPhysicalPath = DCServer.MapPath(folder);
             if (Directory.Exists(folderPhysicalPath))
             {
                 DirectoryInfo dir = new DirectoryInfo(folderPhysicalPath);
                 DcDirectoryManager.DeletDirectory(dir);
             }
         }
     }
 }
Ejemplo n.º 5
0
            public static bool AddUserToGroup(Guid usrid, Guid groupid)
            {
                bool        res      = false;
                XmlDocument xmlDoc   = GetSecurityConfig();
                XmlNodeList nodeList = xmlDoc.SelectNodes("/Security/Groups/Group[@ID='" + groupid.ToString() + "']");

                if (nodeList.Count == 1)
                {
                    XmlNode group = nodeList[0];
                    XmlNode users = group.SelectNodes("Users")[0];

                    XmlNode      user      = xmlDoc.CreateNode(XmlNodeType.Element, "User", "");
                    XmlAttribute att_usrid = xmlDoc.CreateAttribute("ID");
                    att_usrid.InnerText = usrid.ToString();
                    user.Attributes.Append(att_usrid);

                    users.AppendChild(user);

                    xmlDoc.Save(DCServer.MapPath("~") + DCSiteUrls.GetPath_ZecurityConfigurationPath());

                    res = true;
                }

                return(res);
            }
Ejemplo n.º 6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int i = 0;

        if (!int.TryParse(txtOffset.Text, out i))
        {
            lblMessage.CssClass = "operation_error";
            lblMessage.Text     = "أدخل رقم صحيح";
            return;
        }

        string      path = DCServer.MapPath("/ConfigrationFiles/hijri.xml");
        XmlDocument xDoc = new XmlDocument();

        xDoc.Load(path);
        XmlNode node = xDoc.SelectSingleNode("hijriDate/offset");

        node.InnerText = i.ToString();
        xDoc.Save(path);



        LoadData();
        lblMessage.CssClass = "operation_done";
        lblMessage.Text     = "تم تعديل التقويم بنجاح";
    }
Ejemplo n.º 7
0
        //---------------------------------------------------------------------------------------------------------------------------------
        public static string LoadAudioPlayer(string virtualPath, string ext)
        {
            string player = "";

            ext = ext.ToLower();
            string PhysicalPath = DCServer.MapPath(virtualPath);

            if (File.Exists(PhysicalPath))
            {
                if (ext.Contains("mp3"))
                {
                    player = BuildSoundPlayer(virtualPath, "100%");
                }
                else if (ext.Contains("ram") || ext.Contains("rm") || ext.Contains("ra") || ext.Contains("mp3") || ext.Contains("wma"))
                {
                    player = BuildRealPlayerAudio(virtualPath, "100%", "65");
                }
                else
                {
                    player = "عفوا لا يمكن تشغيل هذا الملف";
                }
            }
            else
            {
                player = "عفوا الملف غير موجود";
            }
            return(player);
        }
Ejemplo n.º 8
0
        //---------------------------------------------------------------------------------------------------------------------------------
        public static string LoadVedioPlayer(string virtualPath, string preview, string ext, string width, string height)
        {
            string player = "";

            ext = ext.ToLower();
            string PhysicalPath = DCServer.MapPath(virtualPath);

            if (File.Exists(PhysicalPath))
            {
                if (ext.Contains("wmv") || ext.Contains("avi") || ext.Contains("mpg") || ext.Contains("mpeg"))
                {
                    player = BuildMediaPlayer(virtualPath, width, height);
                }
                else if (ext.Contains("ram") || ext.Contains("rm") || ext.Contains("ra") || ext.Contains("wma"))
                {
                    player = BuildRealPlayerVideo(virtualPath, width, height);
                }
                else if (ext.Contains("flv"))
                {
                    player = BuildFlvPlayer(virtualPath, preview, width, height, "D5D7D8", "000000");
                }
                else
                {
                    player = "عفوا لا يمكن تشغيل هذا الملف";
                }
            }
            else
            {
                player = "عفوا الملف غير موجود";
            }
            return(player);
        }
Ejemplo n.º 9
0
        //-----------------------------------------
        public static bool SavePhoto(string path, PhotosEntity PhotosObj, HttpPostedFile postedFile)
        {
            bool result = false;

            try
            {
                if (!CheckIsImage(postedFile))
                {
                    return(false);
                }
                //To Get The Photo Data----------------------------------
                Bitmap image     = (Bitmap)Bitmap.FromStream(postedFile.InputStream, true);
                string extension = Path.GetExtension(postedFile.FileName);
                postedFile.InputStream.Position = 0;
                PhotosObj.Height = image.Height;
                PhotosObj.Width  = image.Width;
                //
                Thumb thumb = new Thumb();
                //
                string phisycalPath = DCServer.MapPath(path);
                postedFile.SaveAs(phisycalPath + PhotosObj.PhotoID + extension);
                Thumbs.CreateThumb(PhotosObj, new Thumb(190, 125), phisycalPath, image);
                image.Dispose();
                postedFile.InputStream.Close();
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Creates Messages object by calling Messages data provider create method.
        /// <example>[Example]bool status=MessagesFactory.Create(msg);.</example>
        /// </summary>
        /// <param name="msg">The Messages object.</param>
        /// <returns>Status of create operation.</returns>
        public static bool Create(MessagesEntity msg, bool createMsgFolder)
        {
            //Insert user name------------------------------------------
            string username = "";

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                username           = HttpContext.Current.User.Identity.Name;
                msg.InsertUserName = username;
            }
            //----------------------------------------------------------
            bool status = MessagesSqlDataPrvider.Instance.Create(msg);

            //-------------------------------------
            if (status && createMsgFolder)
            {
                // Create msg folder
                string folder             = DCSiteUrls.GetPath_MessagesDirectory(msg.OwnerName, msg.ModuleTypeID, msg.CategoryID, msg.MessageID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (!Directory.Exists(folderPhysicalPath))
                {
                    string        defaultFolder             = DCSiteUrls.GetPath_DefaultMessageFolder();
                    string        defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder);
                    DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath);
                    DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.CopyAll(diSource, diTarget);
                }
            }
            //-------------------------------------
            return(status);
        }
Ejemplo n.º 11
0
        public static string GetThumb(string originalPath, int width, int height, long quality)
        {
            string fileName = VirtualPathUtility.GetFileName(originalPath);

            fileName = Path.GetFileNameWithoutExtension(fileName);



            string thubPath          = string.Format(thumbnailPathPattern, width, height, fileName);
            string physicalThumbPath = DCServer.MapPath(thubPath);



            if (!File.Exists(physicalThumbPath))
            {
                string physicalOriginalPath = DCServer.MapPath(originalPath);
                if (File.Exists(physicalOriginalPath))
                {
                    //----------------------------------
                    //check does directory exists
                    //----------------------------------
                    string thumbDirectoryPath         = string.Format(thumbnailDirectoryPattern, width, height);
                    string physicalthumbDirectoryPath = DCServer.MapPath(thumbDirectoryPath);

                    if (!Directory.Exists(physicalthumbDirectoryPath))
                    {
                        Directory.CreateDirectory(physicalthumbDirectoryPath);
                    }
                    //----------------------------------

                    CreateThumb(physicalOriginalPath, physicalThumbPath, width, height, quality);
                }
            }
            return(thubPath);
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            //DCServer server = DCServer.Instance ("global");
            //server.StartWork ();

            //PerformanceCounter pc_cpu = new PerformanceCounter ();
            //pc_cpu.CategoryName = "Process";
            //pc_cpu.CounterName = "% Processor Time";
            //pc_cpu.InstanceName = GetInstanceName ();
            //PerformanceCounter pc_ram = new PerformanceCounter ();
            //pc_ram.CategoryName = "Process";
            //pc_ram.CounterName = "Private Bytes";
            //pc_ram.InstanceName = GetInstanceName ();
            //PerformanceCounter pc_vram = new PerformanceCounter ();
            //pc_vram.CategoryName = "Process";
            //pc_vram.CounterName = "Virtual Bytes";
            //pc_vram.InstanceName = GetInstanceName ();

            //Thread pcThread = new Thread(new ThreadStart(delegate()
            //{
            //    while (true)
            //    {
            //        Thread.Sleep(5000);
            //        try
            //        {
            //            Console.WriteLine(string.Format("CPU:{0:F2}%;内存:{1:F2}/{2:F2}"
            //                , pc_cpu.NextValue()
            //                , pc_ram.NextValue() / (1024 * 1024)
            //                , pc_vram.NextValue() / (1024 * 1024)
            //               ));
            //        }
            //        catch (Exception e)
            //        {
            //            Console.WriteLine(e.Message);
            //        }
            //    }
            //}
            //));
            //pcThread.IsBackground = true;
            //pcThread.Start();

            Host host = HostFactory.New(x =>
            {
                x.Service <DCServer>(s =>
                {
                    s.ConstructUsing(name => DCServer.Instance("global"));
                    s.WhenStarted(tc => tc.StartWork());
                    s.WhenStopped(tc => tc.StopWork());
                });

                x.StartAutomatically();
                x.SetDescription("数据总线服务-t");
                x.SetDisplayName("ConsoleServer-t");
                x.SetServiceName("ConsoleServer-t");
                x.RunAsNetworkService();
            });

            host.Run();
        }
Ejemplo n.º 13
0
            public static void DeleteAllModules()
            {
                XmlDocument xmlDoc       = GetSecurityConfig();
                XmlNode     commonParent = xmlDoc.SelectSingleNode("/Security/Modules");

                commonParent.RemoveAll();
                xmlDoc.Save(DCServer.MapPath("~") + DCSiteUrls.GetPath_ZecurityConfigurationPath());
            }
Ejemplo n.º 14
0
    //-------------------------------------------------------------------------------//

    protected void Page_Load(object sender, EventArgs e)
    {
        BaseThmbnailWidth  = Convert.ToInt32(Request.QueryString["W"]);
        BaseThmbnailHeight = Convert.ToInt32(Request.QueryString["H"]);
        string originalPath = Request.QueryString["file"];

        CreateThumb(DCServer.MapPath(originalPath));
    }
Ejemplo n.º 15
0
            public static void RemoveUserFromAllgroups(Guid id)
            {
                XmlDocument xmlDoc   = GetSecurityConfig();
                XmlNodeList nodeList = xmlDoc.SelectNodes("/Security/Groups/Group/Users/User[@ID='" + id.ToString() + "']");

                foreach (XmlNode user in nodeList)
                {
                    XmlNode parentnode = user.ParentNode;
                    parentnode.RemoveChild(user);
                }

                xmlDoc.Save(DCServer.MapPath("~") + DCSiteUrls.GetPath_ZecurityConfigurationPath());
            }
Ejemplo n.º 16
0
    //--------------------------------------------------------
    #endregion

    #region ---------------SaveFiles---------------
    //-----------------------------------------------
    //SaveFiles
    //-----------------------------------------------
    protected void SaveFiles(ItemCategoriesEntity itemCategoriesObject)
    {
        #region Save uploaded photo
        //Photo-----------------------------
        if (fuPhoto.HasFile)
        {
            //------------------------------------------------
            //Save new original photo
            fuPhoto.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemCategoriesPhotoOriginals(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID)) + itemCategoriesObject.Photo);
            //Create new thumbnails
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_ItemCategoriesPhotoNormalThumbs(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID), ItemCategoriesFactory.CreateItemCategoriesPhotoName(itemCategoriesObject.CategoryID), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_ItemCategoriesPhotoBigThumbs(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID), ItemCategoriesFactory.CreateItemCategoriesPhotoName(itemCategoriesObject.CategoryID), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
            //-------------------------------------------------------
        }
        #endregion

        #region Save uploaded file
        //File-----------------------------
        if (fuFile.HasFile)
        {
            //Save new original file
            fuFile.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemCategoriesFiles(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID)) + itemCategoriesObject.File);
        }
        #endregion

        #region Save uploaded video
        //Video-----------------------------
        if (fuVideo.HasFile)
        {
            fuVideo.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemCategoriesFiles(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID)) + itemCategoriesObject.Video);
        }
        #endregion

        #region Save uploaded audio
        //Audio-----------------------------
        if (fuAudio.HasFile)
        {
            fuAudio.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemCategoriesFiles(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID)) + itemCategoriesObject.Audio);
        }
        #endregion

        #region Save uploaded photo2
        //-------------------------------------------------------------------------------------
        //Photo2-----------------------------
        if (fuPhoto2.HasFile)
        {
            fuPhoto2.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemCategoriesFiles(itemCategoriesObject.OwnerName, itemCategoriesObject.ModuleTypeID, itemCategoriesObject.CategoryID)) + itemCategoriesObject.Photo2);
        }
        #endregion
    }
Ejemplo n.º 17
0
        /// <summary>
        /// FlagPath
        /// </summary>
        /// <param name="ctry"></param>
        /// <returns></returns>
        public static string GetCountryFlagPath(object ctry)
        {
            string filename = "/Content/images/flags/" + ctry.ToString().Trim() + ".png";

            if (File.Exists(DCServer.MapPath(filename)))
            {
                return(filename);
            }

            else
            {
                return(null);
            }
        }
Ejemplo n.º 18
0
    private int GetConfigSettings()
    {
        string      path = DCServer.MapPath("/ConfigrationFiles/hijri.xml");
        XmlDocument xDoc = new XmlDocument();

        xDoc.Load(path);
        XmlNode node = xDoc.SelectSingleNode("hijriDate/offset");

        int i = 0;

        int.TryParse(node.InnerText, out i);

        return(i);
    }
Ejemplo n.º 19
0
    //--------------------------------------------------------
    #endregion

    public string GetSubSiteFolderSize(object identifire)
    {
        string text                   = "";
        long   folderSize             = 0;
        string folderPath             = DCSiteUrls.GetPath_SubSiteUploadFolder((string)identifire);
        string folderPathPhysicalPath = DCServer.MapPath(folderPath);

        if (Directory.Exists(folderPathPhysicalPath))
        {
            DirectoryInfo dir = new DirectoryInfo(folderPathPhysicalPath);
            DcDirectoryManager.GetDirectorySize(dir, ref folderSize);
            text = DcDirectoryManager.CalculateSizeToRead(folderSize);
        }
        return(text);
    }
Ejemplo n.º 20
0
 //--------------------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------------------
 public static void AddAttatchPath(List <string> attachments, FileUpload fuAttach)
 {
     if (fuAttach.HasFile)
     {
         string attachmentDir = DCServer.MapPath(DCSiteUrls.GetPath_MailList_AttachmentDir());
         string fileName      = fuAttach.PostedFile.FileName;
         string filePath      = attachmentDir + fileName;
         if (File.Exists(filePath))
         {
             File.Delete(filePath);
         }
         fuAttach.SaveAs(filePath);
         attachments.Add(filePath);
     }
 }
Ejemplo n.º 21
0
 //-----------------------------------------------
 #endregion
 //-------------------------------------------------------
 #region ---------------SaveFiles---------------
 //-----------------------------------------------
 //SaveFiles
 //-----------------------------------------------
 protected void SaveFiles(UsersDataEntity userdata)
 {
     #region Save uploaded photo
     //Photo-----------------------------
     if (fuPhoto.HasFile)
     {
         //------------------------------------------------
         //Save new original photo
         fuPhoto.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID)) + userdata.Photo);
         //Create new thumbnails
         MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID), UsersDataFactory.CreateUserPhotoName(userdata.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
         MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID), UsersDataFactory.CreateUserPhotoName(userdata.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
         //-------------------------------------------------------
     }
     #endregion
 }
Ejemplo n.º 22
0
            public static bool AddGroup(Zecurity.Group group)
            {
                bool        res      = false;
                XmlDocument xmlDoc   = GetSecurityConfig();
                XmlNodeList nodeList = xmlDoc.SelectNodes("/Security/Groups/Group[@Name='" + group.Name + "']");

                if (nodeList.Count == 0)
                {
                    //Group Attributes
                    XmlElement xmlNewGroup = xmlDoc.CreateElement("Group");
                    AddAttribute("ID", group.ID.ToString(), xmlNewGroup);
                    AddAttribute("Name", group.Name, xmlNewGroup);

                    //Adding Permissions
                    if (group.Permissions.Count > 0)
                    {
                        XmlElement xmlPermissions = xmlDoc.CreateElement("Permissions");
                        foreach (Zecurity.Permission permission in group.Permissions)
                        {
                            XmlElement xmlPermission = xmlDoc.CreateElement("Permission");
                            AddAttribute("ID", permission.ID.ToString(), xmlPermission);
                            AddAttribute("Path", permission.Path, xmlPermission);
                            AddAttribute("Add", permission.Add.ToString(), xmlPermission);
                            AddAttribute("Edit", permission.Edit.ToString(), xmlPermission);
                            AddAttribute("Delete", permission.Delete.ToString(), xmlPermission);
                            AddAttribute("Trusted", permission.Trusted.ToString(), xmlPermission);
                            AddAttribute("Name", permission.Name, xmlPermission);

                            xmlPermissions.AppendChild(xmlPermission);
                        }

                        xmlNewGroup.AppendChild(xmlPermissions);
                    }

                    //Preparing for Users
                    XmlElement xmlUsers = xmlDoc.CreateElement("Users");
                    xmlNewGroup.AppendChild(xmlUsers);

                    XmlNode commonParent = xmlDoc.SelectSingleNode("/Security/Groups");
                    commonParent.AppendChild(xmlNewGroup);

                    xmlDoc.Save(DCServer.MapPath("~") + DCSiteUrls.GetPath_ZecurityConfigurationPath());
                    res = true;
                }

                return(res);
            }
Ejemplo n.º 23
0
    //-----------------------------------------------
    //btnSave_Click
    //-----------------------------------------------
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
        {
            if (!Page.IsValid)
            {
                return;
            }
            int              itemID     = Convert.ToInt32(Request.QueryString["ID"]);
            ItemsEntity      item       = ItemsFactory.GetObject(itemID, Languages.Unknowen, UsersTypes.Admin, OwnerID);
            ItemsFilesEntity ItemsFiles = new ItemsFilesEntity();
            ItemsFiles.ItemID = itemID;
            //-------------
            ItemsFiles.FileExtension = Path.GetExtension(fuPhoto.FileName);
            //-----------------------------------------------------------------
            ItemsFiles.FileType = FileType;
            //-----------------------------------------------------------------
            ItemsFiles.CategoryID   = item.CategoryID;
            ItemsFiles.ModuleTypeID = item.ModuleTypeID;
            ItemsFiles.OwnerName    = item.OwnerName;
            ItemsFiles.OwnerID      = OwnerID;
            //-----------------------------------------------------------------
            bool status = ItemsFilesFactory.Create(ItemsFiles);
            if (status)
            {
                //Photo-----------------------------
                if (fuPhoto.HasFile)
                {
                    string filesPath = DCSiteUrls.GetPath_ItemsFiles(ItemsFiles.OwnerName, ItemsFiles.ModuleTypeID, ItemsFiles.CategoryID, ItemsFiles.ItemID);

                    fuPhoto.SaveAs(DCServer.MapPath(filesPath + ItemsFiles.Photo));
                }
                lblResult.CssClass = "lblResult_Done";
                lblResult.Text     = Resources.AdminText.SavingDataSuccessfuly;
                LoadList();
                //ClearControls();
            }
            else
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.SavingDataFaild;
            }
        }
    }
Ejemplo n.º 24
0
            public static bool UpdateGroup(Zecurity.Group group)
            {
                bool res = false;

                try
                {
                    XmlDocument xmlDoc   = GetSecurityConfig();
                    XmlNodeList nodeList = xmlDoc.SelectNodes("/Security/Groups/Group[@ID='" + group.ID.ToString() + "']");
                    if (nodeList.Count == 1)
                    {
                        XmlNode xmlGroup = nodeList[0];
                        xmlGroup.Attributes["Name"].Value = group.Name;

                        XmlNode oldPermissions = xmlGroup.SelectNodes("Permissions")[0];
                        XmlNode newPermissions = xmlDoc.CreateNode(XmlNodeType.Element, "Permissions", "");
                        if (group.Permissions != null)
                        {
                            if (group.Permissions.Count > 0)
                            {
                                foreach (Zecurity.Permission permission in group.Permissions)
                                {
                                    XmlNode xmlPermission = xmlDoc.CreateNode(XmlNodeType.Element, "Permission", "");
                                    AddAttribute("ID", permission.ID.ToString(), xmlPermission);
                                    AddAttribute("Path", permission.Path, xmlPermission);
                                    AddAttribute("Add", permission.Add.ToString(), xmlPermission);
                                    AddAttribute("Edit", permission.Edit.ToString(), xmlPermission);
                                    AddAttribute("Delete", permission.Delete.ToString(), xmlPermission);
                                    AddAttribute("Trusted", permission.Trusted.ToString(), xmlPermission);
                                    AddAttribute("Name", permission.Name, xmlPermission);
                                    newPermissions.AppendChild(xmlPermission);
                                }
                            }
                        }

                        xmlGroup.ReplaceChild(newPermissions, oldPermissions);
                        xmlDoc.Save(DCServer.MapPath("~") + DCSiteUrls.GetPath_ZecurityConfigurationPath());
                        res = true;
                    }
                }
                catch { }

                return(res);
            }
Ejemplo n.º 25
0
        //------------------------------------------
        #endregion

        public static void DeleteFiles(ItemsFilesEntity itemFile)
        {
            HttpContext context = HttpContext.Current;

            //ItemsEntity item = ItemsFactory.GetObject(itemFile.ItemID,
            //-----------------------------
            if (!string.IsNullOrEmpty(itemFile.FileExtension))
            {
                if (itemFile.FileType == ItemFileTypes.Photo)
                {
                    //Delete old Thumbnails
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID)) + itemFile.GetPhotoName(PhotoTypes.Thumb));
                }
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID)) + itemFile.GetPhotoName(PhotoTypes.Big));
                //------------------------------------------------
            }
            //Delete old original photo
            File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID)) + itemFile.File);
        }
Ejemplo n.º 26
0
            private static XmlDocument GetSecurityConfig()
            {
                XmlDocument xmlDoc;

                if (HttpContext.Current.Cache["SecurityConfig"] != null)
                {
                    xmlDoc = (XmlDocument)HttpContext.Current.Cache["SecurityConfig"];
                }
                else
                {
                    string path = DCServer.MapPath("~") + DCSiteUrls.GetPath_ZecurityConfigurationPath();
                    xmlDoc = new XmlDocument();
                    xmlDoc.Load(path);

                    CacheDependency dep = new CacheDependency(path);
                    HttpContext.Current.Cache.Insert("SecurityConfig", xmlDoc, dep);
                }
                return(xmlDoc);
            }
Ejemplo n.º 27
0
    protected void btnDeletePhoto_Click(object sender, EventArgs e)
    {
        int departmentID = Convert.ToInt32(Request.QueryString["id"]);
        SiteDeparmentsEntity siteDepartment = SiteDeparmentsFactory.GetObject(departmentID, Languages.Unknowen);

        if (siteDepartment != null)
        {
            if (trParents.Visible)
            {
                siteDepartment.ParentID = Convert.ToInt32(ddlParents.SelectedValue);
            }
            //Photo-----------------------------
            if (!string.IsNullOrEmpty(siteDepartment.PhotoExtension))
            {
                //Delete old original photo
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_SiteDeparmentsPhotoOriginals(siteDepartment.OwnerName)) + siteDepartment.Photo);
                //Delete old Thumbnails
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_SiteDeparmentsPhotoNormalThumbs(siteDepartment.OwnerName)) + SiteDeparmentsFactory.CreateSiteDeparmentsPhotoName(siteDepartment.DepartmentID) + MoversFW.Thumbs.thumbnailExetnsion);
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_SiteDeparmentsPhotoBigThumbs(siteDepartment.OwnerName)) + SiteDeparmentsFactory.CreateSiteDeparmentsPhotoName(siteDepartment.DepartmentID) + MoversFW.Thumbs.thumbnailExetnsion);
            }
            //------------------------------------------------

            trPhotoPreview.Visible = false;
            //-----------------------------

            siteDepartment.PhotoExtension = "";

            ExecuteCommandStatus status = SiteDeparmentsFactory.Update(siteDepartment);
            if (status == ExecuteCommandStatus.Done)
            {
                lblResult.CssClass = "lblResult_Done";
                lblResult.Text     = Resources.AdminText.DeletingOprationDone;
            }

            else
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.DeletingOprationFaild;
            }
        }
    }
Ejemplo n.º 28
0
    //-----------------------------------------------
    #endregion

    #region ---------------btnSave_Click---------------
    //-----------------------------------------------
    //btnSave_Click
    //-----------------------------------------------
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        int    FileID        = 0;
        string Titel         = "";
        string FileName      = "";
        string FileExtention = "";

        //-------------
        FileExtention = Path.GetExtension(fuFile.FileName);
        FileName      = fuFile.FileName;
        Titel         = txtTitle.Text;
        //-----------------------------------------------------------------
        AddNewStudentsFile(out FileID, Titel, FileName, FileExtention);


        if (FileID > 0)
        {
            //Photo-----------------------------
            if (fuFile.HasFile)
            {
                string filesPath    = "/Content/UpFiles/Excel/"; // Server.MapPath() n;
                string PhysicalPath = DCServer.MapPath(filesPath) + FileID + FileExtention;

                fuFile.SaveAs(PhysicalPath);
                DataTable dtNumbersAndMsgs = ReadExcelFile(PhysicalPath, FileExtention, FileID);
                bool      result           = SaveExcelData(dtNumbersAndMsgs);
            }
            General.MakeAlertSucess(lblResult, Resources.AdminText.SavingDataSuccessfuly);
            //LoadList();
            //ClearControls();
        }
        else
        {
            General.MakeAlertError(lblResult, Resources.AdminText.SavingDataFaild);
        }
    }
Ejemplo n.º 29
0
        //------------------------------------------
        #endregion

        #region --------------Delete--------------
        /// <summary>
        /// Deletes single Messages object .
        /// <example>[Example]bool status=MessagesFactory.Delete(messageID);.</example>
        /// </summary>
        /// <param name="messageID">The msg id.</param>
        /// <returns>Status of delete operation.</returns>
        public static bool Delete(int messageID)
        {
            MessagesEntity msg    = MessagesFactory.GetMessagesObject(messageID, UsersTypes.Admin, SitesHandler.GetOwnerIDAsGuid());
            bool           status = MessagesSqlDataPrvider.Instance.Delete(messageID);

            //-------------------------------------
            if (status)
            {
                //delete message folder
                //-------------------------------------
                string folder             = DCSiteUrls.GetPath_MessagesDirectory(msg.OwnerName, msg.ModuleTypeID, msg.CategoryID, msg.MessageID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (Directory.Exists(folderPhysicalPath))
                {
                    DirectoryInfo dir = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.DeletDirectory(dir);
                }
            }
            //-------------------------------------
            return(status);
        }
Ejemplo n.º 30
0
        //------------------------------------------
        #endregion

        #region --------------Delete--------------
        /// <summary>
        /// Deletes single ItemCategories object .
        /// <example>[Example]bool status=ItemCategoriesFactory.Delete(categoryID);.</example>
        /// </summary>
        /// <param name="categoryID">The itemCategoriesObject id.</param>
        /// <returns>Status of delete operation.</returns>
        public static bool Delete(int CategoryID)
        {
            Languages            langID   = SiteSettings.GetCurrentLanguage();
            ItemCategoriesEntity category = GetObject(CategoryID, langID, SitesHandler.GetOwnerIDAsGuid());
            bool status = ItemCategoriesSqlDataPrvider.Instance.Delete(CategoryID);

            if (status)
            {
                //-------------------------------------
                //delete category folder
                //-------------------------------------
                string folder             = DCSiteUrls.GetPath_ItemCategoriesDirectory(category.OwnerName, category.ModuleTypeID, category.CategoryID);
                string folderPhysicalPath = DCServer.MapPath(folder);
                if (Directory.Exists(folderPhysicalPath))
                {
                    DirectoryInfo dir = new DirectoryInfo(folderPhysicalPath);
                    DcDirectoryManager.DeletDirectory(dir);
                }
                //-------------------------------------
            }
            return(status);
        }