/// <summary> /// ��ȡһ��Inviteeʵ�� /// </summary> /// <param name="id">Invitee Id</param> /// <returns></returns> public static Invitee Get(int id) { Invitee inv = new Invitee(); return inv; }
private static List<Invitee> List(int uid, short type, short status, Pager pager) { /* [dbo].[INV_InviteeList] @uid int=0, @type smallint=-1, @status smallint=-1, @pageindex int=1, @pagesize int=20, @sort int=0 */ //[Id],[UserId],[Type],[Email],[CompanyName],[Name],[Gender],[Title],[Phone], //[InviteDate],[InviteMessage],[VisitDate],[Status] List<Invitee> list = new List<Invitee>(); using (SqlDataReader reader = Database.ExecuteReader(CommandType.StoredProcedure, "INV_InviteeList", new SqlParameter[] { Database.MakeInParam("@uid",SqlDbType.Int,uid), Database.MakeInParam("@type",SqlDbType.SmallInt,type), Database.MakeInParam("@status",SqlDbType.SmallInt,status), Database.MakeInParam("@pageindex",SqlDbType.Int,pager.PageIndex), Database.MakeInParam("@pagesize",SqlDbType.Int,pager.PageSize), Database.MakeInParam("@sort",SqlDbType.Int,pager.SortNum) })) { if (reader.Read()) { pager.RecordCount = reader.GetInt32(0); if (reader.NextResult()) { Invitee obj; while (reader.Read()) { obj = new Invitee(); obj.id = reader.GetInt32(0); obj.userId = reader.GetInt32(1); obj.type = ((InviteeType)(reader.GetInt16(2))); obj.email = reader.GetString(3); obj.companyName = reader.GetString(4); obj.name = reader.GetString(5); obj.gender = reader.GetString(6); obj.title = reader.GetString(7); obj.phone = reader.GetString(8); obj.inviteDate = reader.GetDateTime(9); obj.message = reader.GetString(10); obj.visitDate = reader.GetDateTime(11); obj.status = ((InviteeStatus)(reader.GetInt16(12))); list.Add(obj); } } } reader.Close(); } return list; }
/// <summary> /// �����ʼ����� /// </summary> private void DoSendInvite() { string _email = request.Form["inviteeEmail"] == null ? "" : request.Form["inviteeEmail"].Trim(); if (!Util.IsValidEmail(_email)) { Html.Append("1"); return; } if (Invitee.IsExistEmail(_email)) { Html.Append("2"); return; } string _comName = request.Form["inviteeCompanyName"] == null ? "" : request.Form["inviteeCompanyName"].Trim(); string _comUserName = request.Form["inviteeName"] == null ? "" : request.Form["inviteeName"].Trim(); string _userName = request.Form["inviteUser"] == null ? "" : request.Form["inviteUser"].Trim(); if (String.IsNullOrEmpty(_comName) || String.IsNullOrEmpty(_comUserName) || String.IsNullOrEmpty(_userName)) { Html.Append("3"); return; } int _userId = UserCookieInfo.Get().Id; InviteeType _type = (InviteeType)(Convert.ToInt16(request.Form["inviteeType"])); Invitee inv = new Invitee(_userId, _type); inv.Email = _email; inv.CompanyName = _comName; inv.Name = _comUserName; inv.Title = request.Form["inviteeTitle"] == null ? "" : request.Form["inviteeTitle"].Trim(); inv.Gender = request.Form["inviteeGender"] == null ? "����" : request.Form["inviteeGender"].Trim(); inv.Phone = request.Form["inviteePhone"] == null ? "" : request.Form["inviteePhone"].Trim(); inv.Message = request.Form["inviteeMessage"] == null ? "" : request.Form["inviteeMessage"].Trim(); int _invId=inv.Save(); if (_invId > 0) { SmtpMail sm = MailInstance; sm.Subject = _userName+" ����������ͱȱ���վ��"; sm.AddRecipient(new string[] { _email }); string chkSum = User.GetUserIdChkSum(_userId); string body = MailBody(inv.Type == InviteeType.Supplier ? MailBody1 : MailBody2); string url = inv.Type == InviteeType.Supplier ? "http://invite.kebibi.com/entries/supplier.aspx?u=" + _userId.ToString() + "&v=" + _invId.ToString() + "&c=" + chkSum : "http://invite.kebibi.com/entries/buyer.aspx?u=" + _userId.ToString() + "&v=" + _invId.ToString() + "&c=" + chkSum; sm.Body = String.Format(body, "", _userName, inv.Name, inv.Gender, inv.CompanyName, inv.Message, url); if (sm.Send()) { Html.Append("0"); return; } } Html.Append("99"); }