TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
vutharadi prathyusha
NA
18
26.5k
does not implement interface member
Aug 28 2015 3:07 AM
Hi,
This is code i'm using .where i made mistake i didn't understand will you any one help me where i made a mistake here.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Moyogift.Entities;
using MySql.Data.MySqlClient;
using System.Data;
namespace Moyogift.Repository
{
public class MoyoRepository : IMoyoRepository
{
MySqlConnection conn;
MySqlCommand command;
public bool SaveMagazine(Magazine magazine)
{
using (RepositoryManager manager = new RepositoryManager())
{
#region -- open connection --
conn = manager.GetConnection();
conn.Open();
command = manager.GetCommand();
command.CommandText = "SaveMagazine";
#endregion
#region -- prepare parameters --
MySqlParameter[] paramsArray = new MySqlParameter[12];
MySqlParameter param0 = new MySqlParameter();
param0.DbType = DbType.Int32;
param0.ParameterName = "OrderId";
param0.Direction = ParameterDirection.Input;
param0.Value = magazine.OrderId;
paramsArray[0] = param0;
MySqlParameter param1 = new MySqlParameter();
param1.DbType = DbType.Int32;
param1.ParameterName = "PackageId";
param1.Direction = ParameterDirection.Input;
param1.Value = magazine.PackageId;
paramsArray[1] = param1;
MySqlParameter param2 = new MySqlParameter();
param2.DbType = DbType.String;
param2.ParameterName = "MagazineGuid";
param2.Direction = ParameterDirection.Input;
param2.Value = magazine.MagazineGuid;
paramsArray[2] = param2;
MySqlParameter param3 = new MySqlParameter();
param3.DbType = DbType.String;
param3.ParameterName = "UxRecipientFirstName";
param3.Direction = ParameterDirection.Input;
param3.Value = magazine.RecipientFirstName;
paramsArray[3] = param3;
MySqlParameter param4 = new MySqlParameter();
param4.DbType = DbType.String;
param4.ParameterName = "UxRecipientLastName";
param4.Direction = ParameterDirection.Input;
param4.Value = magazine.RecipientLastName;
paramsArray[4] = param4;
MySqlParameter param5 = new MySqlParameter();
param5.DbType = DbType.String;
param5.ParameterName = "UxRecipientGender";
param5.Direction = ParameterDirection.Input;
param5.Value = magazine.RecipientGender;
paramsArray[5] = param5;
MySqlParameter param6 = new MySqlParameter();
param6.DbType = DbType.String;
param6.ParameterName = "UxHostName";
param6.Direction = ParameterDirection.Input;
param6.Value = magazine.HostName;
paramsArray[6] = param6;
MySqlParameter param7 = new MySqlParameter();
param7.DbType = DbType.String;
param7.ParameterName = "UxHostEmail";
param7.Direction = ParameterDirection.Input;
param7.Value = magazine.HostEmail;
paramsArray[7] = param7;
MySqlParameter param8 = new MySqlParameter();
param8.DbType = DbType.String;
param8.ParameterName = "UxSpecialOccasion";
param8.Direction = ParameterDirection.Input;
param8.Value = magazine.SpecialOccasion;
paramsArray[8] = param8;
MySqlParameter param9 = new MySqlParameter();
param9.DbType = DbType.String;
param9.ParameterName = "UxHostMessage";
param9.Direction = ParameterDirection.Input;
param9.Value = magazine.HostMessage;
paramsArray[9] = param9;
MySqlParameter param10 = new MySqlParameter();
param10.DbType = DbType.DateTime;
param10.ParameterName = "UxDeliveryDate";
param10.Direction = ParameterDirection.Input;
param10.Value = magazine.DeliveryDate;
paramsArray[10] = param10;
StringBuilder contributorXML = new StringBuilder(string.Empty);
contributorXML.Append("<root>");
foreach (Contributor contributor in magazine.Contributors)
{
contributorXML.Append(string.Format("<contributor name={0} email={1} guid={2} id={3} />", contributor.Name, contributor.Email, string.IsNullOrEmpty(contributor.ContributorGuid) ? Convert.ToString(Guid.NewGuid()) : contributor.ContributorGuid, contributor.ContributorId));
}
contributorXML.Append("</root>");
MySqlParameter param11 = new MySqlParameter();
param11.DbType = DbType.String;
param11.ParameterName = "ContributorXml";
param11.Direction = ParameterDirection.Input;
param11.Value = contributorXML;
paramsArray[11] = param11;
command.Parameters.AddRange(paramsArray);
#endregion
#region -- execute --
command.ExecuteNonQuery();
//#region -- execute --
// DataSet dataset = new DataSet();
// MySqlDataAdapter adapter = new MySqlDataAdapter();
//adapter.Fill(dataset);
//#endregion
// #region -- strong type resultset --
//updatedMagazine = new Magazine()
//{
// Id = Convert.ToInt32(dataset.Tables[0].Rows[0]["MagazineId"]),
// OrderId = Convert.ToInt32(dataset.Tables[0].Rows[0]["OrderId"]),
// PackageId = Convert.ToInt32(dataset.Tables[0].Rows[0]["PackageId"]),
// RecipientFirstName = dataset.Tables[0].Rows[0]["RecipientFirstName"].ToString(),
// RecipientLastName = dataset.Tables[0].Rows[0]["RecipientLastName"].ToString(),
// RecipientGender = dataset.Tables[0].Rows[0]["RecipientGender"].ToString(),
// SpecialOccasion = dataset.Tables[0].Rows[0]["SpecialOccasion"].ToString(),
// HostEmail = dataset.Tables[0].Rows[0]["HostEmail"].ToString(),
// HostMessage = dataset.Tables[0].Rows[0]["HostMessage"].ToString(),
// HostName = dataset.Tables[0].Rows[0]["HostName"].ToString(),
// MagazineGuid = dataset.Tables[0].Rows[0]["MagazineGuid"].ToString(),
// DeliveryDate = dataset.Tables[0].Rows[0]["DeliveryDate"].ToString()
//};
// var contributors = dataset.Tables[1].AsEnumerable().Select(row => new Contributor()
// {
// ContributorGuid = row.Field<string>("ContributorGuid"),
// Email = row.Field<string>("ContributorEmail"),
// MagazineId = Convert.ToInt32(dataset.Tables[0].Rows[0]["MagazineId"]),
// ContributorId = Convert.ToInt32(row.Field<string>("ContributorId")),
// Name = row.Field<string>("ContributorName")
// });
// updatedMagazine.Contributors = contributors.ToList();
//#endregion
//}
//return updatedMagazine;
#endregion
}
return true;
}
public Contributor GetContributor(string guid)
{
Contributor contributor = new Contributor();
contributor.ContributorNotes = new ContributorNotes();
contributor.ContributorNotes.ContributorImages = new List<ContributorImages>();
using (RepositoryManager manager = new RepositoryManager())
{
#region -- open connection --
conn = manager.GetConnection();
conn.Open();
command = manager.GetCommand();
command.CommandText = "GetContributor";
#endregion
#region -- prepare parameters --
MySqlParameter[] paramsArray = new MySqlParameter[1];
MySqlParameter param0 = new MySqlParameter();
param0.DbType = DbType.String;
param0.ParameterName = "UxContributorGuid";
param0.Direction = ParameterDirection.Input;
param0.Value = guid;
paramsArray[0] = param0;
command.Parameters.AddRange(paramsArray);
#endregion
#region -- execute --
DataSet dataset = new DataSet();
MySqlDataAdapter adapter = new MySqlDataAdapter(command);
adapter.Fill(dataset);
#endregion
#region -- strong type resultset --
if (dataset.Tables.Count > 0 && dataset.Tables[0].Rows.Count > 0)
{
if (dataset.Tables[0].Rows[0][0].ToString() != "-1")
{
contributor.ContributorId = Convert.ToInt32(dataset.Tables[0].Rows[0]["ContributorId"]);
contributor.ContributorGuid = dataset.Tables[0].Rows[0]["ContributorGuid"].ToString();
contributor.MagazineId = Convert.ToInt32(dataset.Tables[0].Rows[0]["MagazineId"]);
contributor.Email = dataset.Tables[0].Rows[0]["ContributorEmail"].ToString();
contributor.Name = dataset.Tables[0].Rows[0]["ContributorName"].ToString();
contributor.FormStatus = Convert.ToInt32(dataset.Tables[0].Rows[0]["NotesStatus"]) == 0 ? FormStatusEnum.Draft
: Convert.ToInt32(dataset.Tables[0].Rows[0]["NotesStatus"]) == 1 ? FormStatusEnum.Saved
: FormStatusEnum.Published;
};
contributor.ContributorNotes = new ContributorNotes()
{
Content = dataset.Tables[0].Rows[0]["Content"].ToString()
};
var images = dataset.Tables[1].AsEnumerable().Select(row => new ContributorImages()
{
PlaceholderId = row.Field<string>("PlaceholderId"),
OriginalName = row.Field<string>("OriginalName"),
ComputedName = row.Field<string>("ComputedName")
});
contributor.ContributorNotes.ContributorImages = images.ToList();
}
else
{
contributor = new Contributor()
{
ContributorId = -1
};
}
#endregion
}
return contributor;
}
public Magazine GetMagazine(string magazineGuid)
{
Magazine magazine;
using (RepositoryManager manager = new RepositoryManager())
{
#region -- open connection --
conn = manager.GetConnection();
conn.Open();
command = manager.GetCommand();
command.CommandText = "GetMagazine";
#endregion
#region -- prepare parameters --
MySqlParameter[] paramsArray = new MySqlParameter[1];
MySqlParameter param0 = new MySqlParameter();
param0.DbType = DbType.String;
param0.ParameterName = "UxMagazineGuid";
param0.Direction = ParameterDirection.Input;
param0.Value = magazineGuid;
paramsArray[0] = param0;
command.Parameters.AddRange(paramsArray);
#endregion
#region -- execute --
DataSet dataset = new DataSet();
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.Fill(dataset);
#endregion
#region -- strong type resultset --
if (dataset.Tables.Count > 0)
{
magazine = new Magazine()
{
MagazineGuid = dataset.Tables[0].Rows[0]["MagazineGuid"].ToString(),
HostEmail = dataset.Tables[0].Rows[0]["HostEmail"].ToString(),
DeliveryDate = dataset.Tables[0].Rows[0]["DeliveryDate"].ToString(),
HostMessage = dataset.Tables[0].Rows[0]["HostMessage"].ToString(),
HostName = dataset.Tables[0].Rows[0]["HostName"].ToString(),
Id = Convert.ToInt32(dataset.Tables[0].Rows[0]["MagazineId"]),
RecipientFirstName = dataset.Tables[0].Rows[0]["RecipientFirstName"].ToString(),
RecipientLastName = dataset.Tables[0].Rows[0]["RecipientLastName"].ToString(),
RecipientGender = dataset.Tables[0].Rows[0]["RecipientGender"].ToString(),
SpecialOccasion = dataset.Tables[0].Rows[0]["SpecialOccasion"].ToString(),
FormStatus = Convert.ToInt32(dataset.Tables[0].Rows[0]["NotesStatus"]) == 0 ? FormStatusEnum.Draft
: Convert.ToInt32(dataset.Tables[0].Rows[0]["NotesStatus"]) == 1 ? FormStatusEnum.Saved
: FormStatusEnum.Published
};
var contributors = dataset.Tables[1].AsEnumerable().Select(row => new Contributor()
{
ContributorGuid = row.Field<string>("ContributorGuid"),
ContributorId = row.Field<int>("ContributorId"),
Email = row.Field<string>("ContributorEmail"),
FormStatus = row.Field<int>("NotesStatus") == 0 ? FormStatusEnum.Draft
: Convert.ToInt32(dataset.Tables[0].Rows[0]["NotesStatus"]) == 1 ? FormStatusEnum.Saved
: FormStatusEnum.Published,
Name = row.Field<string>("ContributorName")
});
magazine.Contributors = contributors.ToList();
}
else
{
magazine = new Magazine()
{
Id = -1
};
}
#endregion
}
return magazine;
}
public bool SaveContributorNotes(ContributorNotes notes)
{
using (RepositoryManager manager = new RepositoryManager())
{
conn = manager.GetConnection();
conn.Open();
command = manager.GetCommand();
command.CommandText = "SaveContributorNotes";
MySqlParameter[] paramsArray = new MySqlParameter[5];
MySqlParameter param1 = new MySqlParameter();
param1.DbType = DbType.Int32;
param1.ParameterName = "UxMagazineId";
param1.Direction = ParameterDirection.Input;
param1.Value = notes.MagazineId;
paramsArray[0] = param1;
MySqlParameter param2 = new MySqlParameter();
param2.DbType = DbType.Int32;
param2.ParameterName = "UxContributorId";
param2.Direction = ParameterDirection.Input;
param2.Value = notes.ContributorId;
paramsArray[1] = param2;
MySqlParameter param3 = new MySqlParameter();
param3.DbType = DbType.Int32;
param3.ParameterName = "UxTemplateId";
param3.Direction = ParameterDirection.Input;
param3.Value = notes.TemplateId;
paramsArray[2] = param3;
MySqlParameter param4 = new MySqlParameter();
param4.DbType = DbType.String;
param4.ParameterName = "Content";
param4.Direction = ParameterDirection.Input;
param4.Value = notes.Content;
paramsArray[3] = param4;
command.Parameters.AddRange(paramsArray);
command.ExecuteNonQuery();
}
return true;
}
public bool SaveContributorImage(ContributorImages image)
{
using (RepositoryManager manager = new RepositoryManager())
{
conn = manager.GetConnection();
conn.Open();
command = manager.GetCommand();
command.CommandText = "SaveContributorImage";
MySqlParameter[] paramsArray = new MySqlParameter[5];
MySqlParameter param0 = new MySqlParameter();
param0.DbType = DbType.Int32;
param0.ParameterName = "UxMagazineId";
param0.Direction = ParameterDirection.Input;
param0.Value = image.MagazineId;
paramsArray[0] = param0;
MySqlParameter param1 = new MySqlParameter();
param1.DbType = DbType.Int32;
param1.ParameterName = "UxContributorId";
param1.Direction = ParameterDirection.Input;
param1.Value = image.ContributorId;
paramsArray[1] = param1;
MySqlParameter param2 = new MySqlParameter();
param2.DbType = DbType.Int32;
param2.ParameterName = "UxTemplateId";
param2.Direction = ParameterDirection.Input;
param2.Value = image.TemplateId;
paramsArray[2] = param2;
MySqlParameter param3 = new MySqlParameter();
param3.DbType = DbType.String;
param3.ParameterName = "OriginalName";
param3.Direction = ParameterDirection.Input;
param3.Value = image.OriginalName;
paramsArray[3] = param3;
MySqlParameter param4 = new MySqlParameter();
param4.DbType = DbType.String;
param4.ParameterName = "ComputedName";
param4.Direction = ParameterDirection.Input;
param4.Value = image.ComputedName;
paramsArray[4] = param4;
MySqlParameter param5 = new MySqlParameter();
param5.DbType = DbType.String;
param5.ParameterName = "PlaceholderId";
param5.Direction = ParameterDirection.Input;
param5.Value = image.PlaceholderId;
paramsArray[5] = param5;
MySqlParameter param6 = new MySqlParameter();
param6.DbType = DbType.Int32;
param6.ParameterName = "Size";
param6.Direction = ParameterDirection.Input;
param6.Value = image.Size;
paramsArray[6] = param6;
MySqlParameter param7 = new MySqlParameter();
param7.DbType = DbType.String;
param7.ParameterName = "ActionType";
param7.Direction = ParameterDirection.Input;
param7.Value = image.ImageType == ImageTypeEnum.New ? 0 : 1;
paramsArray[7] = param7;
command.Parameters.AddRange(paramsArray);
command.ExecuteNonQuery();
}
return true;
}
}
}
This is the error i'm getting.
Error 1 'Moyogift.Repository.MoyoRepository' does not implement interface member 'Moyogift.Repository.IMoyoRepository.SaveMagazine(Moyogift.Entities.Magazine)'. 'Moyogift.Repository.MoyoRepository.SaveMagazine(Moyogift.Entities.Magazine)' cannot implement 'Moyogift.Repository.IMoyoRepository.SaveMagazine(Moyogift.Entities.Magazine)' because it does not have the matching return type of 'Moyogift.Entities.Magazine'. F:\Projects\MoyoGift\Source\Dev\Moyogift\Moyogift.Repository\MoyoRepository.cs 11 18 Moyogift.Repository
Thanks,
Prathyusha.
Reply
Answers (
1
)
Asp.net Web Application
Change background image in classic ASP page dynamically