Exemple #1
0
            //HtmlAnchor aLinkControlPanel;
            //HtmlAnchor aLinkUsersSites;
            //HtmlAnchor aLinkUsersFiles;
            //HtmlAnchor aLinkUsersPhotos;
            //HtmlAnchor aLinkUsersVideos;
            //-----------------------------------------------------------

            #region ---------------Page_Load---------------
            //-----------------------------------------------
            //CatchConPage_Loadtrols
            //-----------------------------------------------
            protected void Page_Load(object sender, EventArgs e)
            {
                //-------------------------------------------------
                //Prepaare user control
                CatchControls();
                Prepare();
                //-------------------------------------------------
                if (this.Page.User != null && this.Page.User.Identity.IsAuthenticated)
                {
                    string username = this.Page.User.Identity.Name;
                    lblUserName.Text = username;
                    MembershipUser  user     = Membership.GetUser(this.Page.User.Identity.Name);
                    UsersDataEntity userData = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, Guid.Empty);
                    //aLinkMainPage.HRef = userData.ProfilePageID;xxxxxxxx
                    //aLinkControlPanel.HRef = "/Adminsub/default.aspx";
                    //aLinkUsersSites.HRef = "/" + username + "/SubSite/Items/UsersSites/default.aspx";
                    //aLinkUsersVideos.HRef = "/" + username + "/SubSite/Items/UsersVideos/default.aspx";
                    //aLinkUsersPhotos.HRef = "/" + username + "/SubSite/Items/UsersPhotos/default.aspx";
                    //aLinkUsersFiles.HRef = "/" + username + "/SubSite/Items/UsersFiles/default.aspx";
                    //------------------------
                    if (Roles.IsUserInRole(ZecurityManager.UserName, DCRoles.SiteOverallAdminsRoles) || Roles.IsUserInRole(ZecurityManager.UserName, DCRoles.SiteSubAdminsRoles))
                    {
                        //aLinkControlPanel.HRef = "/Admincp/default.aspx";
                        //liLinkMainPage.Visible = false;
                        //liProfile.Visible = false;
                        //liLinkUsersSites.Visible = false;
                        //liLinkUsersFiles.Visible = false;
                        //liLinkUsersPhotos.Visible = false;
                        //liLinkUsersVideos.Visible = false;
                    }
                }
            }
Exemple #2
0
    //--------------------------------------------------------
    #endregion

    protected void dgUsersData_EditCommand(object source, DataGridCommandEventArgs e)
    {
        ImageButton     lbtnUserActivation = (ImageButton)e.Item.FindControl("lbtnUserActivation");
        Guid            userID             = (Guid)dgUsersData.DataKeys[e.Item.ItemIndex];
        MembershipUser  user            = Membership.GetUser(userID);
        UsersDataEntity UsersDataObject = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, OwnerID);

        if (user.IsApproved)
        {
            user.IsApproved = false;
            Membership.UpdateUser(user);
            lblResult.CssClass          = "operation_error";
            lblResult.Text              = Resources.AdminText.ActivationCanceled;
            lbtnUserActivation.ImageUrl = "/Content/images/Boolean/false.gif";
        }
        else
        {
            user.IsApproved = true;
            Membership.UpdateUser(user);
            //------------------------------------------------------------------------
            //Create Sub Site if this user has it-------------------
            UsersDataFactory.ConfigureSubSiteIfExist(UsersDataObject);
            //AddUserRelatedPages
            SubSiteHandler.AddUserRelatedPages(UsersDataObject);
            //------------------------------------------------------------------------
            lblResult.CssClass          = "operation_done";
            lblResult.Text              = Resources.AdminText.ActivationDone;
            lbtnUserActivation.ImageUrl = "/Content/images/Boolean/True.gif";
        }
    }
Exemple #3
0
    //-----------------------------------------------
    #endregion

    #region --------------LoadData--------------
    //---------------------------------------------------------
    //LoadData
    //---------------------------------------------------------
    private void LoadData()
    {
        pager.PageSize = SiteSettings.Site_AdminPageSize;
        int totalRecords = 0;
        //--------------------------------------------------------------------
        Languages langID = Languages.Unknowen;

        if (SiteSettings.Languages_HasMultiLanguages)
        {
            langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue);
        }
        //--------------------------------------------------------------------
        int categoryID = -1;

        if (currentModule.CategoryLevel != 0)
        {
            categoryID = Convert.ToInt32(ddlCategoryID.SelectedValue);
        }
        //--------------------------------------------------------------------
        List <UsersDataEntity> usersDataList;

        usersDataList = UsersDataFactory.GetAll(ModuleTypeID, categoryID, langID, "", UserRole, pager.CurrentPage, pager.PageSize, out totalRecords, OwnerID, false);


        if (usersDataList != null && usersDataList.Count > 0)
        {
            dgUsersData.DataSource   = usersDataList;
            dgUsersData.DataKeyField = "UserId";
            dgUsersData.AllowPaging  = false;
            pager.Visible            = true;
            pager.TotalRecords       = totalRecords;
            dgUsersData.DataBind();
            dgUsersData.Visible = true;
            dgUsersData.Columns[dgUsersData.Columns.Count - 2].Visible = ViewUpdate;
            //-------------------------------------------------------------------------------
            //Security Premession
            //--------------------------
            //Check Delete permission
            if (!ZecurityManager.UserCanExecuteCommand(CommandName.Delete))
            {
                dgUsersData.Columns[dgUsersData.Columns.Count - 1].Visible = false;
            }
            //-------------------------------------------------------------------------------
        }
        else
        {
            dgUsersData.Visible = false;
            pager.Visible       = false;
            lblResult.CssClass  = "operation_error";
            lblResult.Text      = Resources.AdminText.ThereIsNoData;
        }
    }
        public void InitializeTest()
        {
            _mockUsersDBSet = new Mock <DbSet <Users> >();
            _mockUsersDBSet.SetSource(UsersDataFactory.GetUsers());

            var contextMock = new AppreciationContext();

            contextMock.Users = _mockUsersDBSet.Object;

            var unitOfWork = new UnitOfWork(contextMock);
            var repository = new UsersRepository(unitOfWork);


            _userService = new UsersService(repository);
        }
Exemple #5
0
 //-----------------------------------------------
 #endregion
 public void LoadData()
 {
     if (HttpContext.Current.User.Identity.IsAuthenticated)
     {
         MembershipUser  user     = Membership.GetUser(this.Page.User.Identity.Name);
         UsersDataEntity userData = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, OwnerID);
         if (userData != null)
         {
             txtName.Text   = userData.Name;
             txtEMail.Text  = userData.Email;
             txtTel.Text    = userData.Tel;
             txtMobile.Text = userData.Mobile;
             //txtAddress.Text = userData.Address;
         }
     }
 }
            //-----------------------------------------------------------


            #region --------------LoadData--------------
            //---------------------------------------------------------
            //LoadData
            //---------------------------------------------------------
            private void LoadData()
            {
                //--------------------------------------------------------------------
                Languages langID = SiteSettings.GetCurrentLanguage();
                //--------------------------------------------------------------------
                //List<UsersDataEntity> usersDataList = UsersDataFactory.GetAll(ModuleTypeID, categoryID, langID, "", UserRole, pager.CurrentPage, pager.PageSize, out totalRecords, OwnerID, true, keywords);
                int totalRecords = 0;
                List <UsersDataEntity> usersDataList = UsersDataFactory.GetAll(ModuleTypeID, CategoryID, langID, "", UserRole, -1, -1, out totalRecords, OwnerID, true, "");
                Repeater r = (Repeater)this.FindControl(TemplateID);

                if (usersDataList != null && usersDataList.Count > 0)
                {
                    r.DataSource = usersDataList;
                    r.DataBind();
                }
            }
Exemple #7
0
    //-----------------------------------------------
    #endregion

    #region ---------------Load_ddlUsers---------------
    //-----------------------------------------------
    //Load_ddlUsers
    //-----------------------------------------------
    private void Load_ddlUsers()
    {
        List <UsersDataEntity> usersDataList;

        usersDataList = UsersDataFactory.GetAll(601, -1, Languages.Unknowen, OwnerID, false);
        if (usersDataList.Count > 0)
        {
            ddlUsers.DataTextField  = "Name";
            ddlUsers.DataValueField = "UserID";
            ddlUsers.DataSource     = usersDataList;
            ddlUsers.DataBind();
            ddlUsers.Items.Insert(0, new ListItem(Resources.AdminText.Choose, ""));
        }
        else
        {
            ddlUsers.Items.Insert(0, new ListItem(Resources.AdminText.ThereIsNoData, ""));
        }
    }
Exemple #8
0
    //--------------------------------------------------------
    #endregion

    #region --------------dgUsersData_DeleteCommand--------------
    //---------------------------------------------------------
    //dgUsersData_DeleteCommand
    //---------------------------------------------------------
    protected void dgUsersData_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        //-------------------------------------------------------------------------------

        Guid            userID          = (Guid)dgUsersData.DataKeys[e.Item.ItemIndex];
        UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject(userID, OwnerID);

        if (UsersDataFactory.Delete(userID))
        {
            //------------------------------------------------
            //RegisterInMailList
            if ((currentModule.MailListAutomaticRegistration || (usersDataObject.HasEmailService)) && !string.IsNullOrEmpty(usersDataObject.Email))
            {
                UsersDataFactory.UnRegisterInMailList(usersDataObject);
            }
            //------------------------------------------------
            //------------------------------------------------
            //RegisterInSms
            if ((currentModule.SmsAutomaticRegistration || (usersDataObject.HasSmsService)) && !string.IsNullOrEmpty(usersDataObject.Mobile))
            {
                UsersDataFactory.UnRegisterInSms(usersDataObject);
            }
            //------------------------------------------------
            lblResult.CssClass = "operation_done";
            lblResult.Text     = Resources.AdminText.DeletingOprationDone;
            //if one item in datagrid
            if (dgUsersData.Items.Count == 1)
            {
                --pager.CurrentPage;
            }
            LoadData();

            /*
             * UserControl Users1 = (UserControl)this.Page.FindControl("Users1");
             * Label lblUserCounts = (Label)Users1.FindControl("lblUserCounts");
             * lblUserCounts.Text = UsersDataFactory.GetCount().ToString();*/
        }
        else
        {
            lblResult.CssClass = "operation_error";
            lblResult.Text     = Resources.AdminText.DeletingOprationFaild;
        }
    }
Exemple #9
0
            //-----------------------------------------------
            #endregion

            #region --------------LoadData--------------
            //---------------------------------------------------------
            //LoadData
            //---------------------------------------------------------
            private void LoadData()
            {
                Languages langID = SiteSettings.GetCurrentLanguage();
                //--------------------------------------------------------------------
                //--------------------------------------------------------------------
                List <UsersDataEntity> usersDataList;

                usersDataList = UsersDataFactory.GetLast(ModuleTypeID, CategoryID, langID, ConditionStatement, UserRole, OwnerID, ItemsCount);

                if (usersDataList != null && usersDataList.Count > 0)
                {
                    rList.DataSource = usersDataList;
                    rList.DataBind();
                    rList.Visible = true;
                }
                else
                {
                    this.Visible = false;
                }
            }
            //-----------------------------------------------------------



            #region --------------LoadData--------------
            //---------------------------------------------------------
            //LoadData
            //---------------------------------------------------------
            private void LoadData()
            {
                pager.PageSize = currentModule.PageItemCount_UserDefault;
                //--------------------------------------------------------------------
                Languages langID = SiteSettings.GetCurrentLanguage();
                //--------------------------------------------------------------------
                int categoryID = -1;

                if (currentModule.CategoryLevel != 0)
                {
                    categoryID = Convert.ToInt32(Request.QueryString["id"]);
                }
                //--------------------------------------------------------------------
                string keywords = "";

                if (trSearch.Visible)
                {
                    keywords = txtSearch.Text;
                }
                //--------------------------------------------------------------------
                List <UsersDataEntity> usersDataList = UsersDataFactory.GetAll(ModuleTypeID, categoryID, langID, "", UserRole, pager.CurrentPage, pager.PageSize, out totalRecords, OwnerID, true, keywords);

                Control  c;
                DataList dl;
                Repeater r;

                c = this.FindControl(TemplateID);
                if (c is DataList)
                {
                    dl = (DataList)c;
                    LoadDataList(dl, usersDataList);
                }
                else
                {
                    r = (Repeater)c;
                    LoadRepeater(r, usersDataList);
                }
            }
Exemple #11
0
    protected void btnDeletePhoto_Click(object sender, EventArgs e)
    {
        if (MoversFW.Components.UrlManager.ChechIsValidParameter("id"))
        {
            Guid            userid          = new Guid(Request.QueryString["id"]);
            UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject(userid, OwnerID);
            if (usersDataObject != null)
            {
                //Photo-----------------------------
                if (!string.IsNullOrEmpty(usersDataObject.PhotoExtension))
                {
                    //Delete old original photo
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID, usersDataObject.UserProfileID)) + usersDataObject.Photo);
                    //Delete old Thumbnails
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID, usersDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(usersDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID, usersDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(usersDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
                }
                //------------------------------------------------

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

                usersDataObject.PhotoExtension = "";
                bool status = UsersDataFactory.Update(usersDataObject);
                if (status)
                {
                    lblResult.CssClass = "lblResult_Done";
                    lblResult.Text     = Resources.AdminText.DeletingOprationDone;
                }

                else
                {
                    lblResult.CssClass = "lblResult_Faild";
                    lblResult.Text     = Resources.AdminText.DeletingOprationFaild;
                }
            }
        }
    }
Exemple #12
0
    //-----------------------------------------------
    #endregion

    #region ---------------LoadData---------------
    //-----------------------------------------------
    //LoadData
    //-----------------------------------------------
    protected void LoadData()
    {
        if (MoversFW.Components.UrlManager.ChechIsValidParameter("UserId"))
        {
            Guid            userid          = new Guid(Request.QueryString["UserId"]);
            MembershipUser  user            = Membership.GetUser(userid);
            UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject((Guid)user.ProviderUserKey, OwnerID);
            if (usersDataObject != null)
            {
                lblName.Text   = usersDataObject.Name;
                lblTel.Text    = usersDataObject.Tel;
                lblMobile.Text = usersDataObject.Mobile;
            }
            else
            {
                Response.Redirect("default.aspx");
            }
        }
        else
        {
            Response.Redirect("default.aspx");
        }
    }
Exemple #13
0
    //-----------------------------------------------
    #endregion

    #region ---------------Export---------------
    //-----------------------------------------------
    //Export
    //-----------------------------------------------
    private void Export()
    {
        int       catID  = Convert.ToInt32(Request.QueryString["id"]);
        Languages langID = (Languages)Convert.ToInt32(Request.QueryString["lang"]);
        List <UsersDataEntity> usersDataList = UsersDataFactory.GetAll(CurrentUsersModule.ModuleTypeID, catID, langID, OwnerID, false);

        if (usersDataList != null && usersDataList.Count > 0)
        {
            dgUsers.DataSource   = usersDataList;
            dgUsers.DataKeyField = "UserProfileID";
            dgUsers.DataBind();
            dgUsers.Visible = true;
            //-----------------------------------
            Response.Clear();
            //Response.HeaderEncoding = Encoding.GetEncoding("Windows-1256");
            Response.AddHeader("content-disposition", "attachment;filename=SiteUsers.xls");
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            // Response.Charset = "utf-8";
            Response.Charset = "utf-8";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = "application/vnd.ms-excel";
            System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);
            dgUsers.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();
            dgUsers.Visible = false;
            //-----------------------------------
        }
        else
        {
            dgUsers.Visible    = false;
            lblResult.CssClass = "operation_error";
            lblResult.Text     = Resources.AdminText.ThereIsNoData;
        }
    }
Exemple #14
0
    //-----------------------------------------------
    #endregion
    //-------------------------------------------------------
    #region ---------------btnSave_Click---------------
    //-----------------------------------------------
    //btnSave_Click
    //-----------------------------------------------
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }
        #region Uploaded photo file checks
        if (fuPhoto.HasFile)
        {
            if (!MoversFW.Photos.CheckIsImage(fuPhoto.PostedFile))
            {
                General.MakeAlertError(lblResult, Resources.AdminText.InvalidPhotoFile);
                return;
            }

            /*
             * //Check suported extention
             * if (!SiteSettings.CheckUploadedFileExtension(uploadedPhotoExtension, currentModule.PhotoAvailableExtension))
             * {
             *
             *  General.MakeAlertError(lblResult, Resources.AdminText.NotSuportedFileExtention + currentModule.PhotoAvailableExtension);
             *  return;
             * }*/
            //Check max length
            if (!SiteSettings.CheckUploadedFileLength(fuPhoto.PostedFile.ContentLength, currentModule.PhotoMaxSize))
            {
                General.MakeAlertError(lblResult, Resources.AdminText.UploadedFileGreaterThanMaxLength + currentModule.PhotoMaxSize);
                return;
            }
            //--------------------------------------------------------------------
        }
        #endregion
        //------------------------------------------------------------------------------------
        string username = txtUserName.Text;
        string pass     = txtPassword.Text;
        MembershipCreateStatus createUserStatus;
        MembershipUser         user;
        UsersDataEntity        usersDataObject = null;
        //------------------------------------------------------------------------------------
        user = Membership.CreateUser(username, pass, txtEmail.Text, null, null, ValidateUser, out createUserStatus);
        switch (createUserStatus)
        {
        case MembershipCreateStatus.Success:
            try
            {
                //---------------------------------------------------------------
                Roles.AddUserToRole(user.UserName, currentModule.UserRole);
                //---------------------------------------------------------------
                //IsConsultant
                //-------------------------
                if (cbIsConsultant.Checked)
                {
                    Roles.AddUserToRole(user.UserName, DCRoles.ConsultantsRoles);
                }
                //---------------------------------------------------------------
                bool status = CreateUserProfile(user, out usersDataObject);
                if (status)
                {
                    //------------------------------------------------------------------------
                    if (usersDataObject.IsApproved)
                    {
                        //Create Sub Site if this user has it-------------------
                        UsersDataFactory.ConfigureSubSiteIfExist(user);
                        //AddUserRelatedPages
                        SubSiteHandler.AddUserRelatedPages(usersDataObject);
                    }
                    //------------------------------------------------------------------------
                    SaveFiles(usersDataObject);
                    //------------------------------------------------------------------------
                    //RegisterInMailList
                    usersDataObject.Email = user.Email;
                    if ((currentModule.MailListAutomaticRegistration || (usersDataObject.HasEmailService)) && !string.IsNullOrEmpty(usersDataObject.Email))
                    {
                        UsersDataFactory.RegisterInMailList(usersDataObject);
                    }
                    //------------------------------------------------------------------------
                    //RegisterInSms
                    if ((currentModule.SmsAutomaticRegistration || (usersDataObject.HasSmsService)) && !string.IsNullOrEmpty(usersDataObject.Mobile))
                    {
                        UsersDataFactory.RegisterInSms(usersDataObject);
                    }
                    //------------------------------------------------------------------------
                    if (SendMailToUser)
                    {
                        SendMail(user, usersDataObject, username, pass);
                    }
                    //------------------------------------------------------------------------
                    General.MakeAlertSucess(lblResult, Resources.AdminText.AddingOperationDone);
                    tblControls.Visible = false;
                    //------------------------------------------------------------------------
                    ClearControls();
                    //------------------------------------------------------------------------
                }
                else
                {
                    Membership.DeleteUser(user.UserName);

                    General.MakeAlertError(lblResult, Resources.AdminText.AddingOperationFaild);
                }
            }
            catch (Exception ex)
            {
                Membership.DeleteUser(user.UserName);
                throw ex;
            }
            break;

        case MembershipCreateStatus.DuplicateEmail:
            General.MakeAlertError(lblResult, Resources.MemberShip.DuplicateEmail);
            break;

        case MembershipCreateStatus.DuplicateProviderUserKey:
            General.MakeAlertError(lblResult, Resources.MemberShip.AccountSuccessfullyFailed);
            break;

        case MembershipCreateStatus.DuplicateUserName:
            General.MakeAlertError(lblResult, Resources.MemberShip.DuplicateUserName);
            break;

        case MembershipCreateStatus.InvalidAnswer:
            General.MakeAlertError(lblResult, Resources.MemberShip.InvalidAnswer);
            break;

        case MembershipCreateStatus.InvalidEmail:
            General.MakeAlertError(lblResult, Resources.MemberShip.InvalidEmail);
            break;

        case MembershipCreateStatus.InvalidPassword:
            General.MakeAlertError(lblResult, Resources.MemberShip.InvalidPassword);
            break;

        case MembershipCreateStatus.InvalidProviderUserKey:
            General.MakeAlertError(lblResult, Resources.MemberShip.AccountSuccessfullyFailed);
            break;

        case MembershipCreateStatus.InvalidQuestion:
            General.MakeAlertError(lblResult, Resources.MemberShip.InvalidQuestion);
            break;

        case MembershipCreateStatus.InvalidUserName:
            General.MakeAlertError(lblResult, Resources.MemberShip.InvalidUserName);
            break;

        case MembershipCreateStatus.ProviderError:
            General.MakeAlertError(lblResult, Resources.MemberShip.AccountSuccessfullyFailed);
            break;

        case MembershipCreateStatus.UserRejected:
            General.MakeAlertError(lblResult, Resources.MemberShip.UserRejected);
            break;

        default:
            lblResult.Text = "";
            break;
        }
    }
Exemple #15
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
 }
Exemple #16
0
    //-----------------------------------------------
    #endregion
    //-------------------------------------------------------
    #region ---------------CreateUserProfile---------------
    //-----------------------------------------------
    //CreateUserProfile
    //-----------------------------------------------
    protected bool CreateUserProfile(MembershipUser user, out UsersDataEntity usersDataObject)
    {
        usersDataObject = new UsersDataEntity();
        string uploadedPhotoExtension = Path.GetExtension(fuPhoto.FileName);

        usersDataObject.UserId = (Guid)user.ProviderUserKey;
        usersDataObject.Name   = txtName.Text;
        if (currentModule.CategoryLevel != 0)
        {
            usersDataObject.CategoryID = Convert.ToInt32(ddlCategoryID.SelectedValue);
        }
        if (trEmpNo.Visible && !string.IsNullOrEmpty(txtEmpNo.Text))
        {
            usersDataObject.EmpNo = Convert.ToInt32(txtEmpNo.Text);
        }
        //------------------------------------------------------------
        if (trAgeRang.Visible)
        {
            usersDataObject.AgeRang = Convert.ToInt32(ddlAgeRang.SelectedValue);
        }
        if (trGender.Visible)
        {
            usersDataObject.Gender = (Gender)Convert.ToInt32(ddlGender.SelectedValue);
        }
        if (trBirthDate.Visible)
        {
            usersDataObject.BirthDate = ucDateBirthDate.Date.ToShortDateString();
        }
        if (trSocialStatus.Visible)
        {
            usersDataObject.SocialStatus = Convert.ToInt32(ddlSocialStatus.SelectedValue);
        }
        if (trEducationLevel.Visible)
        {
            usersDataObject.EducationLevel = Convert.ToInt32(ddlEducationLevel.SelectedValue);
        }
        if (trCountryID.Visible)
        {
            usersDataObject.CountryID = Convert.ToInt32(ddlSystemCountries.SelectedValue);
        }
        if (trCityID.Visible)
        {
            usersDataObject.CityID = Convert.ToInt32(ddlCities.SelectedValue);
        }
        //------------------------------------------------------------
        usersDataObject.UserCityName    = txtUserCityName.Text;
        usersDataObject.Tel             = txtTel.Text;
        usersDataObject.Mobile          = txtMobile.Text;
        usersDataObject.HasSmsService   = cbHasSmsService.Checked;
        usersDataObject.HasEmailService = cbHasEmailService.Checked;
        //------------------------------------------------------------
        usersDataObject.Fax     = txtFax.Text;
        usersDataObject.MailBox = txtMailBox.Text;
        usersDataObject.ZipCode = txtZipCode.Text;
        if (trJobID.Visible && !string.IsNullOrEmpty(txtJobID.Text))
        {
            usersDataObject.JobID = Convert.ToInt32(txtJobID.Text);
        }
        usersDataObject.JobText        = txtJobText.Text;
        usersDataObject.Url            = txtUrl.Text;
        usersDataObject.PhotoExtension = uploadedPhotoExtension;
        //------------------------------------------------------------
        usersDataObject.Company = txtCompany.Text;
        if (trActivitiesID.Visible)
        {
            usersDataObject.ActivitiesID = Convert.ToInt32(ddlActivitiesID.SelectedValue);
        }
        //------------------------------------------------------------
        usersDataObject.LangID = (Languages)SiteSettings.Languages_DefaultLanguageID;
        //*--------------------------------------------------------
        //ExtraData
        usersDataObject.ExtraData = txtDetails.Text;
        //*--------------------------------------------------------
        usersDataObject.ModuleTypeID = currentModule.ModuleTypeID;
        //*--------------------------------------------------------
        //usersDataObject.KeyWordsAr = txtMetaKeyWordsAr.Text;
        //usersDataObject.ShortDescriptionAr = txtShortDescriptionAr.Text;
        //*--------------------------------------------------------
        usersDataObject.OwnerID     = OwnerID;
        usersDataObject.UserType    = currentModule.UserType;
        usersDataObject.SubSiteType = currentModule.SubSiteType;
        //*--------------------------------------------------------
        //if (currentModule.HasProfilePage)
        //{
        //    SubSiteHandler.AddProfilePageDetails(usersDataObject);
        //}
        //*--------------------------------------------------------
        if (UsersDataFactory.IsSubSubSiteOwner(currentModule.UserType))
        {
            usersDataObject.OwnerName = user.UserName;
            //usersDataObject.SiteStaticPages = SubSiteHandler.GetSubSitPagesIDsString(currentModule.SubSiteType);
        }
        //*--------------------------------------------------------
        usersDataObject.UserName = user.UserName;
        //*--------------------------------------------------------
        return(UsersDataFactory.Create(user, usersDataObject));
        //*--------------------------------------------------------
    }
Exemple #17
0
    //--------------------------------------------------------
    #endregion

    #region ---------------LoadData---------------
    //-----------------------------------------------
    //LoadData
    //-----------------------------------------------
    protected void LoadData()
    {
        if (MoversFW.Components.UrlManager.ChechIsValidParameter("id"))
        {
            Guid            userid          = new Guid(Request.QueryString["id"]);
            UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject(userid, OwnerID);
            if (usersDataObject != null)
            {
                //----------------------------------------------------------------------
                if (currentModule.HasName)
                {
                    txtName.Text = usersDataObject.Name;
                }
                //----------------------------------------------------------------------
                txtEmail.Text = usersDataObject.Email;
                //----------------------------------------------------------------------
                if (currentModule.CategoryLevel != 0)
                {
                    ddlCategoryID.SelectedValue = usersDataObject.CategoryID.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasEmpNo)
                {
                    txtEmpNo.Text = usersDataObject.EmpNo.ToString();
                }
                //----------------------------------------------------------------------
                #region ----------Photo----------
                //-------------------------------------------
                //Photo
                //-------------------------------------------
                if (currentModule.HasPhotoExtension && !string.IsNullOrEmpty(usersDataObject.PhotoExtension))
                {
                    imgPhoto.ImageUrl = UsersDataFactory.GetUserPhotoThumbnail(usersDataObject.UserProfileID, usersDataObject.PhotoExtension, 100, 100, usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID);
                    ancor.HRef        = UsersDataFactory.GetUserPhotoBigThumbnail(usersDataObject.UserProfileID, usersDataObject.PhotoExtension, usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID);
                    //imgPhoto.AlternateText = itemsObject.Title;
                }
                else
                {
                    trPhotoPreview.Visible = false;
                }
                //------------------------------------------
                //------------------------------------------
                #endregion
                //------------------------------------------------------------
                if (currentModule.HasAgeRang)
                {
                    ddlAgeRang.SelectedValue = usersDataObject.AgeRang.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasGender)
                {
                    ddlGender.SelectedValue = ((int)usersDataObject.Gender).ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasBirthDate)
                {
                    ucDateBirthDate.Date = Convert.ToDateTime(usersDataObject.BirthDate);
                }
                //----------------------------------------------------------------------
                if (currentModule.HasSocialStatus)
                {
                    ddlSocialStatus.SelectedValue = usersDataObject.SocialStatus.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasEducationLevel)
                {
                    ddlEducationLevel.SelectedValue = usersDataObject.EducationLevel.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasCountryID)
                {
                    ddlSystemCountries.SelectedValue = usersDataObject.CountryID.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasCityID)
                {
                    ddlCities.SelectedValue = usersDataObject.CityID.ToString();
                }
                //------------------------------------------------------------
                if (currentModule.HasUserCityName)
                {
                    txtUserCityName.Text = usersDataObject.UserCityName.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasTel)
                {
                    txtTel.Text = usersDataObject.Tel;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasMobile)
                {
                    txtMobile.Text = usersDataObject.Mobile;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasHasSmsService)
                {
                    cbHasSmsService.Checked = usersDataObject.HasSmsService;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasHasEmailService)
                {
                    cbHasEmailService.Checked = usersDataObject.HasEmailService;
                }
                //------------------------------------------------------------
                if (currentModule.HasFax)
                {
                    txtFax.Text = usersDataObject.Fax;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasMailBox)
                {
                    txtMailBox.Text = usersDataObject.MailBox;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasZipCode)
                {
                    txtZipCode.Text = usersDataObject.ZipCode;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasJobID)
                {
                    txtJobID.Text = usersDataObject.JobID.ToString();
                }
                //----------------------------------------------------------------------
                if (currentModule.HasJobText)
                {
                    txtJobText.Text = usersDataObject.JobText;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasUrl)
                {
                    txtUrl.Text = usersDataObject.Url;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasCompany)
                {
                    txtCompany.Text = usersDataObject.Company;
                }
                //----------------------------------------------------------------------
                if (currentModule.HasActivitiesID)
                {
                    ddlActivitiesID.SelectedValue = usersDataObject.ActivitiesID.ToString();
                }
                //----------------------------------------------------------------------
                //*--------------------------------------------------------

                txtDetails.Text = usersDataObject.ExtraData;
                //*--------------------------------------------------------
                //----------------------------------------------------------------------
                txtMetaKeyWordsAr.Text     = usersDataObject.KeyWordsAr;
                txtShortDescriptionAr.Text = usersDataObject.ShortDescriptionAr;
                //----------------------------------------------------------------------
                //----------------------------------------------------------------------
                //IsConsultant
                //-------------------------
                cbIsConsultant.Checked = Roles.IsUserInRole(usersDataObject.UserName, DCRoles.ConsultantsRoles);
                //----------------------------------------------------------------------
            }
            else
            {
                //Response.Redirect("default.aspx");
                Response.Redirect("../" + currentModule.Identifire + "/default.aspx");
            }
        }
    }
Exemple #18
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
    }
Exemple #19
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (MoversFW.Components.UrlManager.ChechIsValidParameter("id"))
        {
            Guid            userid          = new Guid(Request.QueryString["id"]);
            UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject(userid, OwnerID);

            oldPhotoExtension = usersDataObject.PhotoExtension;
            string uploadedPhotoExtension = Path.GetExtension(fuPhoto.FileName);

            oldEmail  = usersDataObject.Email;
            oldMobile = usersDataObject.Mobile;
            #region Uploaded photo file checks
            if (fuPhoto.HasFile)
            {
                if (!MoversFW.Photos.CheckIsImage(fuPhoto.PostedFile))
                {
                    lblResult.CssClass = "lblResult_Faild";
                    lblResult.Text     = Resources.AdminText.InvalidPhotoFile;
                    return;
                }

                /*
                 * //Check suported extention
                 * if (!SiteSettings.CheckUploadedFileExtension(uploadedPhotoExtension, currentModule.PhotoAvailableExtension))
                 * {
                 *  lblResult.CssClass = "lblResult_Faild";
                 *  lblResult.Text = Resources.AdminText.NotSuportedFileExtention + currentModule.PhotoAvailableExtension;
                 *  return;
                 * }*/
                //Check max length
                if (!SiteSettings.CheckUploadedFileLength(fuPhoto.PostedFile.ContentLength, currentModule.PhotoMaxSize))
                {
                    lblResult.CssClass = "lblResult_Faild";
                    lblResult.Text     = Resources.AdminText.UploadedFileGreaterThanMaxLength + currentModule.PhotoMaxSize;
                    return;
                }
                //--------------------------------------------------------------------
            }
            #endregion

            usersDataObject.Name = txtName.Text;
            if (currentModule.CategoryLevel != 0)
            {
                usersDataObject.CategoryID = Convert.ToInt32(ddlCategoryID.SelectedValue);
            }
            if (trEmpNo.Visible && !string.IsNullOrEmpty(txtEmpNo.Text))
            {
                usersDataObject.EmpNo = Convert.ToInt32(txtEmpNo.Text);
            }
            //------------------------------------------------------------
            if (trAgeRang.Visible)
            {
                usersDataObject.AgeRang = Convert.ToInt32(ddlAgeRang.SelectedValue);
            }
            if (trGender.Visible)
            {
                usersDataObject.Gender = (Gender)Convert.ToInt32(ddlGender.SelectedValue);
            }
            if (trBirthDate.Visible)
            {
                usersDataObject.BirthDate = ucDateBirthDate.Date.ToShortDateString();
            }
            if (trSocialStatus.Visible)
            {
                usersDataObject.SocialStatus = Convert.ToInt32(ddlSocialStatus.SelectedValue);
            }
            if (trEducationLevel.Visible)
            {
                usersDataObject.EducationLevel = Convert.ToInt32(ddlEducationLevel.SelectedValue);
            }
            if (trCountryID.Visible)
            {
                usersDataObject.CountryID = Convert.ToInt32(ddlSystemCountries.SelectedValue);
            }
            if (trCityID.Visible)
            {
                usersDataObject.CityID = Convert.ToInt32(ddlCities.SelectedValue);
            }
            //------------------------------------------------------------
            usersDataObject.UserCityName    = txtUserCityName.Text;
            usersDataObject.Tel             = txtTel.Text;
            usersDataObject.Mobile          = txtMobile.Text;
            usersDataObject.HasSmsService   = cbHasSmsService.Checked;
            usersDataObject.HasEmailService = cbHasEmailService.Checked;
            //------------------------------------------------------------
            usersDataObject.Fax     = txtFax.Text;
            usersDataObject.MailBox = txtMailBox.Text;
            usersDataObject.ZipCode = txtZipCode.Text;
            if (trJobID.Visible && !string.IsNullOrEmpty(txtJobID.Text))
            {
                usersDataObject.JobID = Convert.ToInt32(txtJobID.Text);
            }
            usersDataObject.JobText = txtJobText.Text;
            usersDataObject.Url     = txtUrl.Text;
            //------------------------------------------------------------
            usersDataObject.Company = txtCompany.Text;
            if (trActivitiesID.Visible)
            {
                usersDataObject.ActivitiesID = Convert.ToInt32(ddlActivitiesID.SelectedValue);
            }
            //------------------------------------------------------------
            //*--------------------------------------------------------
            //ExtraData
            usersDataObject.ExtraData = txtDetails.Text;
            //*--------------------------------------------------------
            //Photo
            if (fuPhoto.HasFile)
            {
                usersDataObject.PhotoExtension = uploadedPhotoExtension;
            }
            else
            {
                usersDataObject.PhotoExtension = oldPhotoExtension;
            }
            //----------------------------------------------------------------------
            usersDataObject.KeyWordsAr         = txtMetaKeyWordsAr.Text;
            usersDataObject.ShortDescriptionAr = txtShortDescriptionAr.Text;
            //----------------------------------------------------------------------
            bool status = UsersDataFactory.Update(usersDataObject);
            if (status)
            {
                //---------------------------------------------------------------
                //IsConsultant
                //-------------------------
                bool isConsultant = Roles.IsUserInRole(usersDataObject.UserName, DCRoles.ConsultantsRoles);
                if (isConsultant && !cbIsConsultant.Checked)
                {
                    Roles.RemoveUserFromRole(usersDataObject.UserName, DCRoles.ConsultantsRoles);
                }
                else if (!isConsultant && cbIsConsultant.Checked)
                {
                    Roles.AddUserToRole(usersDataObject.UserName, DCRoles.ConsultantsRoles);
                }
                //---------------------------------------------------------------
                SaveFiles(usersDataObject);
                //RegisterInMailList--------------------------------------------------------------//
                if (currentModule.MailListAutomaticRegistration || usersDataObject.HasEmailService)
                {
                    UsersDataFactory.UpdateMailListEmail(oldEmail, usersDataObject);
                }
                //--------------------------------------------------------------------------------//
                //RegisterInSms--------------------------------------------------------------//
                if (currentModule.SmsAutomaticRegistration || usersDataObject.HasSmsService)
                {
                    UsersDataFactory.UpdateSmsMobileNo(oldMobile, usersDataObject);
                }
                //--------------------------------------------------------------------------------//
                Response.Redirect("../" + currentModule.Identifire + "/default.aspx");
            }
            else
            {
                lblResult.CssClass = "operation_error";
                lblResult.Text     = Resources.AdminText.UpdatingOperationFaild;
            }
        }
    }
Exemple #20
0
    //-----------------------------------------------
    #endregion

    #region ---------------btnSave_Click---------------
    //-----------------------------------------------
    //btnSave_Click
    //-----------------------------------------------
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid || (currentModule.HasItemDate && !ucItemDate.IsValid) || (currentModule.HasItemEndDate && !ucItemEndDate.IsValid))
        {
            return;
        }
        //--------------------------------------------------
        ItemsEntity itemsObject = new ItemsEntity();

        //--------------------------------------------------
        #region Item Files properties

        // uploaded files extenssions
        string uploadedPhotoExtension  = Path.GetExtension(fuPhoto.FileName);
        string uploadedFileExtension   = Path.GetExtension(fuFile.FileName);
        string uploadedVideoExtension  = Path.GetExtension(fuVideo.FileName);
        string uploadedAudioExtension  = Path.GetExtension(fuAudio.FileName);
        string uploadedPhoto2Extension = Path.GetExtension(fuPhoto2.FileName);
        //---------------------------------------------------------------------
        #region Uploaded Files checks
        #region Uploaded photo file checks
        if (fuPhoto.HasFile)
        {
            if (!MoversFW.Photos.CheckIsImage(fuPhoto.PostedFile))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.InvalidPhotoFile;
                return;
            }

            /*
             * //Check suported extention
             * if (!SiteSettings.CheckUploadedFileExtension(uploadedPhotoExtension, currentModule.PhotoAvailableExtension))
             * {
             *  lblResult.CssClass = "lblResult_Faild";
             *  lblResult.Text = Resources.AdminText.NotSuportedFileExtention + currentModule.PhotoAvailableExtension;
             *  return;
             * }*/
            //Check max length
            if (!SiteSettings.CheckUploadedFileLength(fuPhoto.PostedFile.ContentLength, currentModule.PhotoMaxSize))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.UploadedFileGreaterThanMaxLength + currentModule.PhotoMaxSize;
                return;
            }
            //--------------------------------------------------------------------
        }
        #endregion
        #region Uploaded file checks
        //File
        if (fuFile.HasFile)
        {/*
          * //Check suported extention
          * if (!SiteSettings.CheckUploadedFileExtension(uploadedFileExtension, currentModule.FileAvailableExtension))
          * {
          *     lblResult.CssClass = "lblResult_Faild";
          *     lblResult.Text = Resources.AdminText.NotSuportedFileExtention + currentModule.FileAvailableExtension;
          *     return;
          * }*/
            //Check max length
            if (!SiteSettings.CheckUploadedFileLength(fuFile.PostedFile.ContentLength, currentModule.FileMaxSize))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.UploadedFileGreaterThanMaxLength + currentModule.FileMaxSize;
                return;
            }
        }
        //-----------------------------------------------------------------
        #endregion
        #region Uploaded video file checks
        //Video
        if (fuVideo.HasFile)
        {/*
          * //Check suported extention
          * if (!SiteSettings.CheckUploadedFileExtension(uploadedVideoExtension, currentModule.VideoAvailableExtension))
          * {
          *     lblResult.CssClass = "lblResult_Faild";
          *     lblResult.Text = Resources.AdminText.NotSuportedVideoExtention + currentModule.VideoAvailableExtension;
          *     return;
          * }*/
            //Check max length
            if (!SiteSettings.CheckUploadedFileLength(fuVideo.PostedFile.ContentLength, currentModule.VideoMaxSize))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.UploadedVideoGreaterThanMaxLength + currentModule.VideoMaxSize;
                return;
            }
        }
        //-----------------------------------------------------------------
        #endregion
        #region Uploaded audio file checks
        //Audio
        if (fuAudio.HasFile)
        {/*
          * //Check suported extention
          * if (!SiteSettings.CheckUploadedFileExtension(uploadedAudioExtension, currentModule.AudioAvailableExtension))
          * {
          *     lblResult.CssClass = "lblResult_Faild";
          *     lblResult.Text = Resources.AdminText.NotSuportedAudioExtention + currentModule.VideoAvailableExtension;
          *     return;
          * }*/
            //Check max length
            if (!SiteSettings.CheckUploadedFileLength(fuAudio.PostedFile.ContentLength, currentModule.AudioMaxSize))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.UploadedAudioGreaterThanMaxLength + currentModule.AudioMaxSize;
                return;
            }
        }
        //-----------------------------------------------------------------
        #endregion
        #region Uploaded photo2 file checks
        //-----------------------------------------------------------------
        //Photo2
        if (fuPhoto2.HasFile)
        {
            if (!MoversFW.Photos.CheckIsImage(fuPhoto2.PostedFile))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.InvalidPhotoFile;
                return;
            }/*
              * //Check suported extention
              * if (!SiteSettings.CheckUploadedFileExtension(uploadedPhoto2Extension, currentModule.Photo2AvailableExtension))
              * {
              * lblResult.CssClass = "lblResult_Faild";
              * lblResult.Text = Resources.AdminText.NotSuportedFileExtention + currentModule.Photo2AvailableExtension;
              * return;
              * }*/
            //Check max length
            if (!SiteSettings.CheckUploadedFileLength(fuPhoto2.PostedFile.ContentLength, currentModule.Photo2MaxSize))
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.UploadedFileGreaterThanMaxLength + currentModule.Photo2MaxSize;
                return;
            }
            //--------------------------------------------------------------------
        }
        //-----------------------------------------------------------------
        #endregion
        #endregion



        #region Set properties
        //items files
        itemsObject.PhotoExtension  = uploadedPhotoExtension;
        itemsObject.FileExtension   = uploadedFileExtension;
        itemsObject.VideoExtension  = uploadedVideoExtension;
        itemsObject.AudioExtension  = uploadedAudioExtension;
        itemsObject.Photo2Extension = uploadedPhoto2Extension;
        //------------------------------------------------------
        #endregion
        #endregion

        //itemsObject.Title = txtTitle.Text;
        if (trCategoryID.Visible)
        {
            itemsObject.CategoryID = Convert.ToInt32(ddlItemCategories.SelectedValue);
        }
        //itemsObject.ShortDescription = txtShortDescription.Text;
        //itemsObject.Description = txtDetails.Value;
        itemsObject.Email = txtEmail.Text;

        // itemsObject.AuthorName = txtAuthorName.Text;
        if (currentModule.HasPriority && Sender == UsersTypes.Admin)
        {
            itemsObject.Priority = Convert.ToInt32(ddlPriority.SelectedValue);
        }
        itemsObject.Url = txtUrl.Text;
        if (currentModule.HasHeight)
        {
            itemsObject.Height = Convert.ToInt32(txtHeight.Text);
        }
        if (currentModule.HasWidth)
        {
            itemsObject.Width = Convert.ToInt32(txtWidth.Text);
        }
        //if (currentModule.HasItemDate && !string.IsNullOrEmpty(txtItemDate.Text)) itemsObject.ItemDate = Convert.ToDateTime(txtItemDate.Text);
        if (currentModule.HasItemDate && ucItemDate.Date != DateTime.MinValue)
        {
            itemsObject.ItemDate = ucItemDate.Date;
        }
        //-----------------------------------
        //ItemEndDate
        //if (currentModule.HasItemEndDate && !string.IsNullOrEmpty(txtItemEndDate.Text)) itemsObject.ItemEndDate = Convert.ToDateTime(txtItemEndDate.Text);
        if (currentModule.HasItemEndDate && ucItemEndDate.Date != DateTime.MinValue)
        {
            itemsObject.ItemEndDate = ucItemEndDate.Date;
        }

        //itemsObject.Address = txtAddress.Text;
        itemsObject.MailBox = txtMailBox.Text;
        itemsObject.ZipCode = txtZipCode.Text;
        itemsObject.Tels    = txtTels.Text;
        itemsObject.Fax     = txtFax.Text;
        itemsObject.Mobile  = txtMobile.Text;
        //-------------------------------------------------------------------------------------------
        itemsObject.IsMain        = CbIsMain.Checked;
        itemsObject.SpecialOption = cbSpecialOption.Checked;
        itemsObject.ModuleTypeID  = ModuleTypeID;
        //-----------------------------------
        itemsObject.YoutubeCode = txtYoutubeCode.Text;
        //---------------------------------------------------------------------------------------------------------
        if (currentModule.HasGoogleLatitude)
        {
            itemsObject.GoogleLatitude = Convert.ToDouble(txtGoogleLatitude.Text);
        }
        //---------------------------------------------------------------------------------------------------------
        if (currentModule.HasGoogleLongitude)
        {
            itemsObject.GoogleLongitude = Convert.ToDouble(txtGoogleLongitude.Text);
        }
        //---------------------------------------------------------------------------------------------------------
        itemsObject.Price            = txtPrice.Text;
        itemsObject.OnlyForRegisered = cbOnlyForRegisered.Checked;
        //---------------------------------------------------------------------------------------------------------
        //Files publishing
        itemsObject.PublishPhoto  = cbPublishPhoto.Checked;
        itemsObject.PublishPhoto2 = cbPublishPhoto2.Checked;
        itemsObject.PublishFile   = cbPublishFile.Checked;
        itemsObject.PublishAudio  = cbPublishAudio.Checked;
        itemsObject.PublishVideo  = cbPublishVideo.Checked;
        itemsObject.PublishYoutbe = cbPublishYoutbe.Checked;
        //---------------------------------------------------------------------------------------------------------
        if (currentModule.HasAuthorID)
        {
            int authorID = Convert.ToInt32(ddlAuthorID.SelectedValue);
            itemsObject.AuthorID = authorID;
            if (authorID > 0)
            {
                itemsObject.AuthorName = ddlAuthorID.SelectedItem.Text;
                selectedAuthor         = ItemsFactory.GetObject(authorID, Languages.Unknowen, UsersTypes.Admin, OwnerID);
            }
        }
        //-------------------------------------------------------------------------------------------
        //Check is  available
        // logic of is available "if the module hasn't IsAvailable -> then  All items ara vailable "
        if (currentModule.HasIsAvailable && Sender == UsersTypes.Admin)
        {
            itemsObject.IsAvailable = cbIsAvailable.Checked;
        }
        else if (Sender == UsersTypes.User)
        {
            itemsObject.IsAvailable = false;
        }
        else
        {
            itemsObject.IsAvailable = true;
        }
        //-------------------------------------------------------------------------------------------
        itemsObject.Icon = txtIconControl.Text;

        //-----------------------------------------------
        //Visitors Participations
        //----------------------------
        if (Sender == UsersTypes.User || Sender == UsersTypes.SuperUser)
        {
            //----------------------------------------------------------------------------------------
            if (this.Page.User != null && this.Page.User.Identity.IsAuthenticated && !UsersDataFactory.IsCurrentUserTheAdmin())
            {
                MembershipUser user   = Membership.GetUser(this.Page.User.Identity.Name);
                Guid           userID = new Guid(user.ProviderUserKey.ToString());
                itemsObject.UserId = userID;
                UsersDataEntity userData = UsersDataFactory.GetUsersDataObject(userID, OwnerID);
                itemsObject.SenderName  = userData.Name;
                itemsObject.SenderEMail = user.Email;
            }
            else
            {
                itemsObject.SenderName  = txtSenderName.Text;
                itemsObject.SenderEMail = txtSenderEMail.Text;
            }
            //----------------------------------------------------------------------------------------
            //HasSenderCountryID
            if (currentModule.HasSenderCountryID)
            {
                itemsObject.SenderCountryID = Convert.ToInt32(ddlSenderCountry.SelectedValue);
            }
            //----------------------------------------------------------------------------------------
            itemsObject.IsVisitorsParticipations = true;
        }
        //----------------------------------------------------------------------------------------
        if (OwnerID != null)
        {
            itemsObject.OwnerID = (Guid)OwnerID;
        }
        //-------------------------------------------------------------------------------------------
        if (currentModule.HasType)
        {
            itemsObject.Type = Convert.ToInt32(ddlType.SelectedValue);
        }
        //-------------------------------------------------------------------------------------------

        //Details -----------------------
        AddDetails(itemsObject);
        //----------------------------------------------------------------------------------------
        if (itemsObject.Details.Count == 0)
        {
            if (SiteSettings.Languages_HasArabicLanguages)
            {
                ItemsDetailsEntity arabicDetails = new ItemsDetailsEntity();
                arabicDetails.LangID = Languages.Ar;
                itemsObject.Details[Languages.Ar] = arabicDetails;
            }
            if (SiteSettings.Languages_HasEnglishLanguages)
            {
                ItemsDetailsEntity englishDetails = new ItemsDetailsEntity();
                englishDetails.LangID             = Languages.En;
                itemsObject.Details[Languages.En] = englishDetails;
            }
        }
        //----------------------------------------------------------------------------------------

        //ItemsDetailsEntity d = itemsObject.Details[Languages.Ar];
        //if(selectedAuthor!=n)
        //-------------------------------
        ExecuteCommandStatus status = ItemsFactory.Create(itemsObject, currentModule);
        if (status == ExecuteCommandStatus.Done)
        {
            SaveFiles(itemsObject);
            //------------------------------------------------------------------------
            //RegisterInMailList
            if (currentModule.MailListAutomaticRegistration && !string.IsNullOrEmpty(itemsObject.Email))
            {
                ItemsFactory.RegisterInMailList(itemsObject);
            }
            //------------------------------------------------------------------------
            //RegisterInSms
            if (currentModule.SmsAutomaticRegistration && !string.IsNullOrEmpty(itemsObject.Mobile))
            {
                ItemsFactory.RegisterInSms(itemsObject);
            }
            //------------------------------------------------------------------------
            lblResult.CssClass = "lblResult_Done";
            lblResult.Text     = Resources.AdminText.AddingOperationDone;
            ClearControls();
        }
        else if (status == ExecuteCommandStatus.AllreadyExists)
        {
            lblResult.CssClass = "lblResult_Faild";
            lblResult.Text     = Resources.AdminText.DuplicateItem;
        }
        else
        {
            lblResult.CssClass = "lblResult_Faild";
            lblResult.Text     = Resources.AdminText.AddingOperationFaild;
        }
    }