//-------------------------------------------------------- #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"; } }
//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; } } }
//----------------------------------------------- #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; } } }
//-------------------------------------------------------- #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; } }
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; } } } }
//----------------------------------------------- #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"); } }
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; } } }
//-------------------------------------------------------- #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"); } } }
//----------------------------------------------- #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; } }