|
Create a base-class called "Person" and derive both classes from it
|
|
|
|
|
If I write
Person xpoPerson = DeepCopy(akdPerson);
but if I write
AkdPerson xpoPerson = DeepCopy(akdPerson);
not work. And I dont want to any drive metod, because these classes autogenerated. And contain different attributes, like [Key] for OR/M, [DataContract] for WCF etc...
Any idea??
|
|
|
|
|
Yup, use reflection to determine what properties to copy
I are Troll
|
|
|
|
|
How can I following class for my class;
I GET ERROR
public object Copy(Type source, object sourceToCopy, Type destination)
{
XmlSerializer serializer = new XmlSerializer(source);
MemoryStream memoryStream = new MemoryStream();
XmlSerializerNamespaces nameSpacesList = new XmlSerializerNamespaces();
nameSpacesList.Add("", "");
serializer.Serialize(memoryStream, sourceToCopy, nameSpacesList);
byte[] byteArr = memoryStream.ToArray();
ASCIIEncoding encoder = new ASCIIEncoding();
string xmlString = encoder.GetString(byteArr);
ASCIIEncoding newEncoder = new ASCIIEncoding();
byte[] newByteArr = newEncoder.GetBytes(xmlString);
MemoryStream newMemoryStream = new MemoryStream(newByteArr);
XmlSerializer deSer = new XmlSerializer(destination);
object deserializedObject = deSer.Deserialize(newMemoryStream);
return deserializedObject;
}
|
|
|
|
|
Are you just trying things randomly until one works?
|
|
|
|
|
There is a more fundamental question here; why are you trying to "copy" one of these things to another?
If both Person classes have the same properties, they should probably derive from the same class or interface, meaning any reference to the concrete XPOPerson or AkdPerson is irrelevant.
What is it you are trying to achive? That would enable us to get a better answer for you.
|
|
|
|
|
Yeah, some base class is a good idea. Or consider writing converters -- look into the implicit and explicit operators.
|
|
|
|
|
When i send mail above error occurred.
would anyone say:
code is below:
MailAddress SendFrom = new MailAddress("test@nibssolutions.net");
MailAddress SendTo = new MailAddress("rudro_aiub@yahoo.com");
MailMessage myMessage = new MailMessage(SendFrom, SendTo);
myMessage.Subject = "Subject";
myMessage.Body = "Body";
SmtpClient _smtpClient = new SmtpClient("mail.nibssolutions.net", 587);
_smtpClient.EnableSsl = true;
_smtpClient.Credentials = new System.Net.NetworkCredential("test@nibssolutions.net", "********");
_smtpClient.Send(myMessage);
//}
MessageBox.Show("Mail Sent...");
|
|
|
|
|
i download insecure pop3 mail. But i can not download secure mail like gmail.
would you help me?
Thanks in advance
Shafik
|
|
|
|
|
khosnur wrote: i can not download secure mail like gmail.
Without a better description of your problem it's impossible to offer any advice. What exactly do you mean by this? Is it something to do with your internet connection, its speed, your PC, ... ?
|
|
|
|
|
thanks for ur reply.
i would like to tell u that i can download programmatically(C#) in secure po3 mail. but when i download secure pop3 mail like when i download gmail's mail then i can not would u help me how? i am developing a software like ms outlook
|
|
|
|
|
khosnur wrote: when i download secure pop3 mail like when i download gmail's mail then i can not
What does this mean? You may as well say "when I try to drive my car it won't work"!
|
|
|
|
|
See this[^] or this[^].
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
thank u very much for ur reply.
first link : they use a third party library but they dont upload but in code they call the method.
2nd link: they also use third party dll but the wanna sell.
i searching not that kind stupid help.
would tell me any idea? i can download insecure pop mail.but i can not download secure pop mail like gmail's mail.
plz help me.
thanks in advance
|
|
|
|
|
khosnur wrote: i searching not that kind stupid help
Then take pains to phrase your question correctly. Read this[^].
1. Use google. There are plenty of very useful results over there.
2. What have you tried so far?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi,
how to retreive both read & unread emails and attachments using c# from pop3,smtp server.
Thanks
modified on Sunday, September 13, 2009 6:24 AM
|
|
|
|
|
Here[^] is a good starting point.
|
|
|
|
|
Hi,
Is it possible to load data from excel spreadsheet to sql server using c#
without giving names in column header
for example:The Spreadsheet looks like below(No Header Names)
A B C
================================
Mark Asst.Professor 25
Thomas SoftwareProfessional 30
Assiging Column Header values to sql server table called employeefields .
A = Name
B = Designation
C = Age
There will be table called Employees which contains columns such as Name,Designation,Age
Based on the fields chosen in Employeefields the records must be inserted in the Employees table in sqlserver
modified on Sunday, September 13, 2009 6:22 AM
|
|
|
|
|
You can create OleDB connection to the excel sheet. Make sure to have HDR=No; set in the connection string. Then you can insert the data in SQL table using insert statement.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I have an application which involves creating a set of randomly generated numbers that are included in the document to be printed.
Prior to printing I am displaying the document(s) in a PrintPreview form constructed with a PrintPreviewControl.
There is a button on the form which calls up a printer dialog and the document is then printed on ok click on the printer dialog after pages to print selection etc.
The problem I am having is that, to display the document in the PrintPreview form the random numbers are generated in the calling form and the printDoc_PrintPage function then formats the document using the random numbers that have been put in an array.
This is fine.
But when I click to print the document, the printDoc_PrintPage function is called again to generate the document for the printer but the array of random numbers is now cleared and so an error is thrown.
I could put the generation of the random numbers within the the printDoc_PrintPage function, but the output would then be different between the printPreview display and the printed paper document.
I don't want to have to pass the array back and forth between the forms.
The printPreview form is used for assorted documents in various places in the application and should be kept generic and should only need a printDocument.
Does anyone have any suggestions as to how I might get around this problem please?
I would think many people would like to have a 'completed' document to pass around but it seems that the only option is to create the document on the fly for each call to print.
I can't see how you can achieve this without persisting the document to a file.
I might be missing something simple here or misunderstanding how to use these components but I can't find any examples of similar use.
Thanks
|
|
|
|
|
You don't have a whole lot of choices:
1) Pre-generate the random numbers and pass the array through - which you don't want to do (why not?)
2) Use a common seed for your random number generator, so it gives the same random sequence each time.
3) Persist the document to a stream of some sort (memory or file).
Why would you want to print random numbers?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks for your (very fast) reply.
The random numbers are for bingo cards, so the document contains many sets of them for which I had to seed it to make sure they were different.
It doesn't seem right to me that you should have to pass the data to generte the document back and forth to a printPreview form.
I suppose I'll have to go and have a think about what to persist and where.
Cheers
|
|
|
|
|
I see. Then what I would do is construct a card class, and pass the random data to it as the constructor. (The default construcutor could generate this from a random seed as well.) Since the data is only ever relevant to the card, I would then pass the card(s) I wanted to print to the print and / or print preview. A document would then consist of as many cards as would fit on a sheet.
You aren't then passing the data to generate the document back and forth, you are passing the document.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Yes, that is basically what I am doing.
I have been being a dozy twonk and I have now spotted my mistake.
I have a reset form that is clearing down the list after the printPreview form is loaded.
(I'm abit over tired that's my excuse)
I'll just have to rethink when and where to do the resetting from.
Well thanks for helping me focus.
|
|
|
|
|
Hey ppls I was finalizing my POS system for Cafteria and Restaurant. But I dont get the Idea of VOID order ............ can any body tell me how to add this function to my system(just the idea).
Thank you
|
|
|
|