当前位置: 首页>>代码示例>>C#>>正文


C# Member.Save方法代码示例

本文整理汇总了C#中Member.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Member.Save方法的具体用法?C# Member.Save怎么用?C# Member.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Member的用法示例。


在下文中一共展示了Member.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestDataModel

 public void TestDataModel()
 {
   var service = new Service() { Name = "Massage", Description = "Relaxing" };//
   service.Save();
   var member = new Member() { FirstName = "Brad", LastName = "Pitt" };//
   member.Save();
   //var member = biz.Member.Collection[3];//
   var s = member.Services[20];
   s.Name = "Companionship2";
   member.FirstName = "Christopher";
   member.Services.AddRange(biz.Service.Collection);
   member.Save();
 }
开发者ID:toddmo,项目名称:male.services,代码行数:13,代码来源:EntityFrameworkTests.cs

示例2: OnRecievedData

        // (4) Send The Recieved Data to All Clients in The Room
        private static void OnRecievedData(IAsyncResult ar)
        {
            SocketCoderClient client = (SocketCoderClient)ar.AsyncState;
            byte[] aryRet = client.GetRecievedData(ar);

            if (aryRet.Length < 1)
            {
                // client.Sock.RemoteEndPoint - "has left the room"
                client.ReadOnlySocket.Shutdown(SocketShutdown.Both);
                client.ReadOnlySocket.Close();
            //    ClientsList.Remove(client);
                return;
            }

            try
            {
                MemoryStream msgStream = new MemoryStream();
                ClientCommand msgCommand = new ClientCommand();
                msgStream.Write(aryRet, 0, aryRet.Length);
                BinaryFormatter deserializer = new BinaryFormatter();
                msgStream.Position = 0;
                msgCommand = (ClientCommand)deserializer.Deserialize(msgStream);
                switch (msgCommand.MessageType)
                {
                    case ClientCommand.msgType.JoinRoom:
                        ArrayList RoomMembers;
                        if (Clients.ContainsKey(msgCommand.ChatRoomID))
                        {
                            RoomMembers = Clients[msgCommand.ChatRoomID];
                            client.username = msgCommand.Sender;
                            RoomMembers.Add(client);
                            Clients[msgCommand.ChatRoomID] = RoomMembers;
                        }
                        else
                        {
                            RoomMembers = new ArrayList();
                            client.username = msgCommand.Sender;
                            RoomMembers.Add(client);
                            Clients.Add(msgCommand.ChatRoomID, RoomMembers);
                        }
                        try
                        {
                            Member member = new Member();
                            member.AddNew();
                            member.ChatRoomID = msgCommand.ChatRoomID;
                            member.MemberID = msgCommand.Sender;
                            member.Save();
                        }
                        catch (Exception ex)
                        {

                        }

                        ArrayList Members1 = Clients[msgCommand.ChatRoomID];
                        for (int i = 0; i < Members1.Count; i++)
                        {
                            SocketCoderClient Current = (SocketCoderClient)Members1[i];
                            Current.ReadOnlySocket.Send(aryRet);
                        }
                        //OnLogText(null, new EventArgs(), "user : " + msgCommand.Sender + " has joined room : " + msgCommand.ChatRoomID.ToString());
                        break;
                    case ClientCommand.msgType.LeaveRoom:
                        try
                        {
                            Member memberToLeave = new Member();
                            memberToLeave.LoadByPrimaryKey(msgCommand.Sender, msgCommand.ChatRoomID);
                            memberToLeave.MarkAsDeleted();
                            memberToLeave.Save();
                        }
                        catch (Exception ex)
                        {

                        }
                        ArrayList Members2 = Clients[msgCommand.ChatRoomID];
                        for (int i = 0; i < Members2.Count; i++)
                        {
                            SocketCoderClient Current = (SocketCoderClient)Members2[i];
                            if (Current.username != msgCommand.Sender)
                                Current.ReadOnlySocket.Send(aryRet);
                        }

                        ArrayList MemberToRemove = Clients[msgCommand.ChatRoomID];
                        for (int i = 0; i < MemberToRemove.Count; i++)
                        {
                            SocketCoderClient Current = (SocketCoderClient)MemberToRemove[i];
                            if (Current.username != msgCommand.Sender)
                                continue;
                            else
                            {
                                MemberToRemove.Remove(Current);
                                Current.ReadOnlySocket.Shutdown(SocketShutdown.Both);
                                // prevent setup recieve call back for removed client
                                return;
                               // break;
                            }
                        }
                        break;
                    case ClientCommand.msgType.Message:
                        ArrayList Members = Clients[msgCommand.ChatRoomID];
//.........这里部分代码省略.........
开发者ID:menasbeshay,项目名称:ivalley-svn,代码行数:101,代码来源:SocketCoderTextServer.cs

示例3: SetRegisterFields

        private void SetRegisterFields(TemplateEngine te)
        {
            te.Put(TagFields.PageTitle, "注册");

            if (Request.IsPost())
            {
                var member = new Member();
                member.RealName = Request.Get<string>("realName");
                member.Mobile = Request.Get<string>("userMobile");
                member.Password = Request.Get<string>("password").ToMd5();
                member.RegisterIP = Request.GetIPAddress();
                var errors = member.Validate();
                var password = Request.Get<string>("password");
                var password1 = Request.Get<string>("password1");
                if (string.IsNullOrEmpty(password))
                    errors.Add("设置密码不能为空!");
                if (string.IsNullOrEmpty(password1))
                    errors.Add("确认密码不能为空!");
                if (!string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(password1) && password != password1)
                    errors.Add("两次密码不一致!");

                if (errors.Count > 0)
                {
                    te.Put(TagFields.Errors, GetErrorsHtml(errors));
                }
                else
                {
                    member.Save();
                }
            }
        }
开发者ID:known,项目名称:Known,代码行数:31,代码来源:default.aspx.cs


注:本文中的Member.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。