/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); parameters["title"] = Title; parameters["album_id"] = AlbumID.ToString(); if (GroupID > 0) { parameters["group_id"] = GroupID.ToString(); } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); parameters["audio_ids"] = String.Join(",", AudioIDs); if (AlbumID != 0) { parameters["album_id"] = AlbumID.ToString(); } if (GroupID > 0) { parameters["group_id"] = GroupID.ToString(); } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (GroupID > 0) { parameters["group_id"] = GroupID.ToString(); } parameters["album_id"] = AlbumID.ToString(); parameters["title"] = Title; if (Privacy != VKAlbumPrivacy.AllUsers) { parameters["privacy"] = ((byte)Privacy).ToString(); } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (OwnerID != 0) { parameters["owner_id"] = OwnerID.ToString(); } if (AlbumID != 0) { parameters["album_id"] = AlbumID.ToString(); } if (Audios != null && Audios.Count != 0) { parameters["audio_ids"] = String.Join(",", Audios); } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (!String.IsNullOrWhiteSpace(Name)) { parameters["name"] = Name; } else { parameters["name"] = "No name"; } if (!String.IsNullOrWhiteSpace(Description)) { parameters["description"] = Description; } if (IsPrivate != VKBoolean.False) { parameters["is_private"] = "1"; } if (Wallpost != VKBoolean.False) { parameters["wallpost"] = "1"; } if (!String.IsNullOrWhiteSpace(Link)) { parameters["link"] = Link; } if (GroupID != 0) { parameters["group_id"] = GroupID.ToString(); } if (AlbumID != 0) { parameters["album_id"] = AlbumID.ToString(); } if (Repeat != VKBoolean.False) { parameters["repeat"] = "1"; } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (OwnerID != 0) { parameters["owner_id"] = OwnerID.ToString(); } parameters["album_id"] = AlbumID.ToString(); if (Before != 0) { parameters["before"] = Before.ToString(); } if (After != 0) { parameters["after"] = After.ToString(); } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (TargetID != 0) { parameters["target_id"] = TargetID.ToString(); } if (IsSingle) { parameters["album_id"] = AlbumID.ToString(); } else { parameters["album_ids"] = string.Join(",", AlbumIDs); } parameters["video_id"] = VideoID.ToString(); parameters["owner_id"] = OwnerID.ToString(); return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (OwnerID != 0) { parameters["owner_id"] = OwnerID.ToString(); } if (AlbumID != 0) { parameters["album_id"] = AlbumID.ToString(); } if (Photos != null && Photos.Count != 0) { parameters["photo_ids"] = String.Join(",", Photos); } if (Reverse == VKBoolean.True) { parameters["rev"] = "1"; } if (FeedType.HasValue) { switch (FeedType.Value) { case VKPhotoFeedType.Photo: parameters["feed_type"] = "photo"; break; case VKPhotoFeedType.PhotoTag: parameters["feed_type"] = "photo_tag"; break; } } if (Feed != 0) { parameters["feed"] = Feed.ToString(); } return(parameters); }
/// <summary> /// Возвращает коллекцию параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); parameters["album_id"] = AlbumID.ToString(); if (!String.IsNullOrWhiteSpace(Title)) { parameters["title"] = Title; } if (!String.IsNullOrWhiteSpace(Description)) { parameters["description"] = Description; } if (OwnerID != 0) { parameters["owner_id"] = OwnerID.ToString(); } if (UploadByAdminsOnly != VKBoolean.False) { parameters["upload_by_admins_only"] = "1"; } if (CommentsDisabled != VKBoolean.False) { parameters["comments_disabled"] = "1"; } if (Privacy != VKAlbumPrivacy.AllUsers) { parameters["privacy"] = ((byte)Privacy).ToString(); } if (CommentPrivacy != VKAlbumPrivacy.AllUsers) { parameters["comment_privacy"] = ((byte)CommentPrivacy).ToString(); } return(parameters); }
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { try { // Get the UserId of the just-added user MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName); Guid newUserId = (Guid)newUser.ProviderUserKey; // Insert a new record into UserProfiles string connectionString = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql = @"INSERT INTO UserProfiles(UserId, FirstName, MiddleName, LastName,FullName, E_mail, UserName, Gender, ProfilePicture, BackgroundPicture,CoverPicture,Day,Month,Year) VALUES(@UserId, @FirstName,@MiddleName,@LastName,@FullName,@E_mail,@UserName, @Gender, (SELECT * FROM OPENROWSET(BULK N'" + System.AppDomain.CurrentDomain.BaseDirectory + "images\\default-profile-photo.jpg', SINGLE_BLOB) AS image), (SELECT * FROM OPENROWSET(BULK N'" + System.AppDomain.CurrentDomain.BaseDirectory + "images\\default-background-photo.jpeg', SINGLE_BLOB) AS image),(SELECT * FROM OPENROWSET(BULK N'" + System.AppDomain.CurrentDomain.BaseDirectory + "images\\basic-cover.jpeg', SINGLE_BLOB) AS image),@Day,@Month,@Year)"; using (SqlConnection myConnection = new SqlConnection(connectionString)) { myConnection.Open(); SqlCommand myCommand = new SqlCommand(insertSql, myConnection); myCommand.Parameters.AddWithValue("@UserId", newUserId); myCommand.Parameters.AddWithValue("@FirstName", ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("FirstName")).Text); myCommand.Parameters.AddWithValue("@MiddleName", ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("MiddleName")).Text); myCommand.Parameters.AddWithValue("@LastName", ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("LastName")).Text); fullname = ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("FirstName")).Text + " " + ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("MiddleName")).Text + " " + ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("LastName")).Text; myCommand.Parameters.AddWithValue("@FullName", fullname); myCommand.Parameters.AddWithValue("@E_mail", ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Email")).Text); myCommand.Parameters.AddWithValue("@UserName", ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName")).Text); myCommand.Parameters.AddWithValue("@Gender", ((RadioButtonList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("rblGender")).SelectedValue); string txtday = ((DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Day")).SelectedValue; string txtmonth = ((DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Month")).SelectedValue; string txtyear = ((DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Year")).SelectedValue; if (txtday == "Day") { myCommand.Parameters.AddWithValue("@Day", DBNull.Value); } else { myCommand.Parameters.AddWithValue("@Day", ((DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Day")).SelectedValue); } if (txtmonth == "Month") { myCommand.Parameters.AddWithValue("@Month", DBNull.Value); } else { myCommand.Parameters.AddWithValue("@Month", ((DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Month")).SelectedValue); } if (txtyear == "Year") { myCommand.Parameters.AddWithValue("@Year", DBNull.Value); } else { myCommand.Parameters.AddWithValue("@Year", ((DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Year")).SelectedValue); } myCommand.ExecuteNonQuery(); myConnection.Close(); } string connectionString2 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql2 = @"INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection2 = new SqlConnection(connectionString2)) { myConnection2.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql2, myConnection2); myCommand2.Parameters.AddWithValue("@Name", "ProfilePictures"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection2.Close(); } object post__id = null; object cover__id = null; object AlbumID; object AlbumIDC; string connectionString3 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string selectSql = "SELECT ID FROM PhotoAlbums WHERE UserId=@UserId AND Name=@Name"; using (SqlConnection myConnection2 = new SqlConnection(connectionString3)) { myConnection2.Open(); SqlCommand myCommand2 = new SqlCommand(selectSql, myConnection2); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.Parameters.AddWithValue("@Name", "ProfilePictures"); AlbumID = myCommand2.ExecuteScalar(); myConnection2.Close(); } string insertSql22 = "INSERT INTO PhotoStore(ID,UserId,PostUserId,UserName,UserFullName,ContentType,Description,PostType) VALUES(@ID,@UserId,@PostUserId,@UserName,@UserFullName,@ContentType,@Description,@PostType)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString3)) { myConnection3.Open(); SqlCommand myCommand3 = new SqlCommand(insertSql22, myConnection3); myCommand3.Parameters.AddWithValue("@ID", new Guid(AlbumID.ToString())); myCommand3.Parameters.AddWithValue("@UserId", newUserId); myCommand3.Parameters.AddWithValue("@PostUserId", newUserId); myCommand3.Parameters.AddWithValue("@UserName", User.Identity.Name); myCommand3.Parameters.AddWithValue("@UserFullName", fullname); myCommand3.Parameters.AddWithValue("@Description", "Default Profile Photo"); myCommand3.Parameters.AddWithValue("@ContentType", "image"); myCommand3.Parameters.AddWithValue("@PostType", "profile"); myCommand3.ExecuteNonQuery(); string selectSql2 = "select [PhotoID] from [PhotoStore] where ([UserId]=@UserId and ID=@ID) order by [Date] desc"; SqlCommand myCommand4 = new SqlCommand(selectSql2, myConnection3); myCommand4.Parameters.AddWithValue("@UserId", newUserId); myCommand4.Parameters.AddWithValue("@ID", new Guid(AlbumID.ToString())); post__id = myCommand4.ExecuteScalar(); myConnection3.Close(); } try { string connectionString21 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string updateSql = "UPDATE PhotoStore SET ImageUrl = @ImageUrl WHERE PhotoID = @PhotoID"; using (SqlConnection myConnection3 = new SqlConnection(connectionString21)) { myConnection3.Open(); SqlCommand myCommand3 = new SqlCommand(updateSql, myConnection3); myCommand3.Parameters.AddWithValue("@PhotoID", post__id); myCommand3.Parameters.AddWithValue("@ImageUrl", "~/images/default-profile-photo.jpg"); myCommand3.ExecuteNonQuery(); myConnection3.Close(); } string updateSql2 = "UPDATE UserProfiles SET PhotoID = @PhotoID WHERE UserId = @UserId"; using (SqlConnection myConnection3 = new SqlConnection(connectionString21)) { myConnection3.Open(); SqlCommand myCommand3 = new SqlCommand(updateSql2, myConnection3); myCommand3.Parameters.AddWithValue("@PhotoID", post__id); myCommand3.Parameters.AddWithValue("@UserId", newUserId); myCommand3.ExecuteNonQuery(); myConnection3.Close(); } } catch { } string connectionString33 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql3 = @"INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString33)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql3, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "CoverPhotos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string selectSql22 = "SELECT ID FROM PhotoAlbums WHERE UserId=@UserId AND Name=@Name"; using (SqlConnection myConnection2 = new SqlConnection(connectionString3)) { myConnection2.Open(); SqlCommand myCommand2 = new SqlCommand(selectSql22, myConnection2); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.Parameters.AddWithValue("@Name", "CoverPhotos"); AlbumIDC = myCommand2.ExecuteScalar(); myConnection2.Close(); } string insertSql222 = "INSERT INTO PhotoStore(ID,UserId,PostUserId,UserName,UserFullName,ContentType,Description,PostType) VALUES(@ID,@UserId,@PostUserId,@UserName,@UserFullName,@ContentType,@Description,@PostType)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString3)) { myConnection3.Open(); SqlCommand myCommand3 = new SqlCommand(insertSql222, myConnection3); myCommand3.Parameters.AddWithValue("@ID", new Guid(AlbumIDC.ToString())); myCommand3.Parameters.AddWithValue("@UserId", newUserId); myCommand3.Parameters.AddWithValue("@PostUserId", newUserId); myCommand3.Parameters.AddWithValue("@UserName", User.Identity.Name); myCommand3.Parameters.AddWithValue("@UserFullName", fullname); myCommand3.Parameters.AddWithValue("@Description", "Default Cover Photo"); myCommand3.Parameters.AddWithValue("@ContentType", "image"); myCommand3.Parameters.AddWithValue("@PostType", "profile"); myCommand3.ExecuteNonQuery(); string selectSql2 = "select [PhotoID] from [PhotoStore] where ([UserId]=@UserId and ID=@ID) order by [Date] desc"; SqlCommand myCommand4 = new SqlCommand(selectSql2, myConnection3); myCommand4.Parameters.AddWithValue("@UserId", newUserId); myCommand4.Parameters.AddWithValue("@ID", new Guid(AlbumIDC.ToString())); cover__id = myCommand4.ExecuteScalar(); myConnection3.Close(); } try { string connectionString21 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string updateSql = "UPDATE PhotoStore SET ImageUrl = @ImageUrl WHERE PhotoID = @PhotoID"; using (SqlConnection myConnection3 = new SqlConnection(connectionString21)) { myConnection3.Open(); SqlCommand myCommand3 = new SqlCommand(updateSql, myConnection3); myCommand3.Parameters.AddWithValue("@PhotoID", cover__id); myCommand3.Parameters.AddWithValue("@ImageUrl", "~/images/basic-cover.jpeg"); myCommand3.ExecuteNonQuery(); myConnection3.Close(); } string updateSql2 = "UPDATE UserProfiles SET CoverID = @CoverID WHERE UserId = @UserId"; using (SqlConnection myConnection3 = new SqlConnection(connectionString21)) { myConnection3.Open(); SqlCommand myCommand3 = new SqlCommand(updateSql2, myConnection3); myCommand3.Parameters.AddWithValue("@CoverID", cover__id); myCommand3.Parameters.AddWithValue("@UserId", newUserId); myCommand3.ExecuteNonQuery(); myConnection3.Close(); } } catch { } string connectionString4 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql4 = @"INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString2)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql4, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "BackgroundPhotos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string connectionString5 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql5 = @"INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString5)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql5, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "RacePhotos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string connectionString6 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql6 = @"INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString6)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql6, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "CovertPhotos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string connectionString7 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql7 = @"INSERT INTO PhotoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString7)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql7, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "PostPhotos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string connectionString8 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql8 = @"INSERT INTO VideoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString8)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql8, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "PostVideos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string connectionString9 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql9 = @"INSERT INTO VideoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString9)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql9, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "RaceVideos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } string connectionString10 = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ConnectionString; string insertSql10 = @"INSERT INTO VideoAlbums(Name, UserId) VALUES(@Name, @UserId)"; using (SqlConnection myConnection3 = new SqlConnection(connectionString10)) { myConnection3.Open(); SqlCommand myCommand2 = new SqlCommand(insertSql10, myConnection3); myCommand2.Parameters.AddWithValue("@Name", "CovertVideos"); myCommand2.Parameters.AddWithValue("@UserId", newUserId); myCommand2.ExecuteNonQuery(); myConnection3.Close(); } Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/profile"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/covers"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/backgrounds"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/posts"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/race"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/photos/covert"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/videos/posts"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/videos/race"); Directory.CreateDirectory(Server.MapPath("~") + "/uploads/" + CreateUserWizard1.UserName + "/videos/covert"); } catch (Exception ex) { Membership.DeleteUser(CreateUserWizard1.UserName); Context.Items.Add("ErrorMessage", ex.Message); } //string insertSql2 = "UPDATE UserProfiles SET ProfilePicture = SELECT BulkColumn FROM Openrowset( Bulk '" + System.AppDomain.CurrentDomain.BaseDirectory + "images\\default-profile-photo.jpg', Single_Blob) as image"; //using (SqlConnection myConnection = new SqlConnection(connectionString)) //{ // myConnection.Open(); // SqlCommand myCommand = new SqlCommand(insertSql2, myConnection); // myCommand.ExecuteNonQuery(); // myConnection.Close(); //} }