Click here to Skip to main content
15,894,825 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get assembly name that called class library Pin
Chesnokov Yuriy26-Jan-11 1:36
professionalChesnokov Yuriy26-Jan-11 1:36 
GeneralRe: Get assembly name that called class library Pin
Henry Minute26-Jan-11 2:07
Henry Minute26-Jan-11 2:07 
AnswerRe: Get assembly name that called class library Pin
Chesnokov Yuriy26-Jan-11 2:25
professionalChesnokov Yuriy26-Jan-11 2:25 
QuestionMulti-language installer in Visual Studio Deployment and Setup project Pin
linuxfedora25-Jan-11 23:23
linuxfedora25-Jan-11 23:23 
AnswerRe: Multi-language installer in Visual Studio Deployment and Setup project Pin
Pete O'Hanlon26-Jan-11 1:11
mvePete O'Hanlon26-Jan-11 1:11 
QuestionExcel Cell Copy - Update Formulas Pin
gmhanna25-Jan-11 16:35
gmhanna25-Jan-11 16:35 
AnswerRe: Excel Cell Copy - Update Formulas Pin
Dan Mos25-Jan-11 22:08
Dan Mos25-Jan-11 22:08 
QuestionLINQ and Multithreading : insert not work [modified] Pin
NoName_ark25-Jan-11 8:31
NoName_ark25-Jan-11 8:31 
Hi to all developers.

I try to program something like Yahoo messenger ( school project).

I write tow program, Server and Client. when a client request new account, server receive the command and made new user object but it won't add new user to database. in server every socket process within a thread.

I debug line by line, everything is OK ( I think ..! )
I also try update my DB via Stored procedure, but no luck Frown | :(
for more details take a look at my code.

any help appreciate.

User table:

http://i52.tinypic.com/2hyvskn.jpg

private void CommandReceived(object sender, CommandEventArgs e)
        {
            
            switch (e.Command.CommandType)
            {
                case CommandsType.NewUser:
                    {
                        int ret = CreateNewUser(e.Command.SenderUsername, e.Command.MetaData);
                        Command cmd = new Command(CommandsType.NewUser, "server", e.Command.SenderUsername, ret.ToString());
                        SendCommandToTarget(cmd);
                        UpdateConsole("new client registration ", "", IPAddress.None, 0);

                        break;
                    }
            }
      }


private int CreateNewUser(string u, string pne)
        {
            try
            {
                RMData db = new RMData();
                string username = u;
                string password = pne.Split(new char[] { ':' })[0];
                string email = pne.Split(new char[] { ':' })[1];
                Users user = db.Users.SingleOrDefault(usr => usr.Username == username);
                if (user != null)
                    return 1;
                user = db.Users.SingleOrDefault(usr => usr.Email == email);
                if (user != null)
                    return 2;
                user = new Users();
                user.Username = username;
                user.AddedDate = DateTime.Now;
                user.Email = email;
                user.Password = password;
                db.Users.InsertOnSubmit(user);
                
                return 0;
            }
            catch (Exception ex)
            {
                return 3;
            }
        }


whole project:

http://www.mediafire.com/?bf5e5d6lqoolbbs

Password is: 123
N
o
N
ame

modified on Tuesday, January 25, 2011 5:16 PM

AnswerRe: LINQ and Multithreading : insert not work Pin
Luc Pattyn25-Jan-11 10:24
sitebuilderLuc Pattyn25-Jan-11 10:24 
GeneralRe: LINQ and Multithreading : insert not work Pin
NoName_ark25-Jan-11 11:09
NoName_ark25-Jan-11 11:09 
AnswerRe: LINQ and Multithreading : insert not work Pin
Luc Pattyn25-Jan-11 11:22
sitebuilderLuc Pattyn25-Jan-11 11:22 
GeneralRe: LINQ and Multithreading : insert not work Pin
NoName_ark25-Jan-11 11:48
NoName_ark25-Jan-11 11:48 
AnswerRe: LINQ and Multithreading : insert not work Pin
NoName_ark25-Jan-11 12:28
NoName_ark25-Jan-11 12:28 
GeneralRe: LINQ and Multithreading : insert not work Pin
Pete O'Hanlon26-Jan-11 1:09
mvePete O'Hanlon26-Jan-11 1:09 
QuestionNeed help in c# simulation Pin
james aaron fanlo25-Jan-11 7:53
james aaron fanlo25-Jan-11 7:53 
AnswerRe: Need help in c# simulation Pin
Eddy Vluggen25-Jan-11 8:07
professionalEddy Vluggen25-Jan-11 8:07 
GeneralRe: Need help in c# simulation Pin
james aaron fanlo25-Jan-11 15:40
james aaron fanlo25-Jan-11 15:40 
GeneralRe: Need help in c# simulation Pin
Richard MacCutchan25-Jan-11 20:58
mveRichard MacCutchan25-Jan-11 20:58 
GeneralRe: Need help in c# simulation Pin
Eddy Vluggen26-Jan-11 0:21
professionalEddy Vluggen26-Jan-11 0:21 
QuestionGridView, Trying to get some columns editable, and some columns readonly. Pin
wizardzz25-Jan-11 7:39
wizardzz25-Jan-11 7:39 
AnswerRe: GridView, Trying to get some columns editable, and some columns readonly. Pin
Eddy Vluggen25-Jan-11 8:02
professionalEddy Vluggen25-Jan-11 8:02 
GeneralRe: GridView, Trying to get some columns editable, and some columns readonly. Pin
wizardzz25-Jan-11 8:07
wizardzz25-Jan-11 8:07 
GeneralRe: GridView, Trying to get some columns editable, and some columns readonly. Pin
Eddy Vluggen25-Jan-11 8:10
professionalEddy Vluggen25-Jan-11 8:10 
GeneralRe: GridView, Trying to get some columns editable, and some columns readonly. Pin
wizardzz25-Jan-11 11:52
wizardzz25-Jan-11 11:52 
GeneralRe: GridView, Trying to get some columns editable, and some columns readonly. Pin
Eddy Vluggen26-Jan-11 0:24
professionalEddy Vluggen26-Jan-11 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.