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


C# venuesEntities.AddTotbl_guest_message方法代码示例

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


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

示例1: SaveGuestMessage

        public static string SaveGuestMessage(string mInfo)
        {
            string returnStr = "";

            JObject objVenue = JObject.Parse(mInfo);
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    int guestId = 0;
                    tbl_guest_message tbt = new tbl_guest_message();
                    if (objVenue["GuestID"].ToString() == "")
                    {
                        tbt.GuestID = 0;
                    }
                    else
                    {
                        tbt.GuestID = int.Parse(objVenue["GuestID"].ToString());
                        guestId = int.Parse(objVenue["GuestID"].ToString());
                    }
                    tbt.MessageTime = DateTime.Now;
                    //tbt.MessageContent = objVenue["MessageContent"].ToString();
                    //tbt.MessageTitle = objVenue["MessageTitle"].ToString();
                    tbt.VenueID = int.Parse(objVenue["VenueID"].ToString());

                    tbt.EventName = objVenue["EventName"].ToString();
                    tbt.EventType = objVenue["EventType"].ToString();
                    tbt.EstimatedAttendees = objVenue["EstimatedAttendees"].ToString();
                    tbt.EventStartDate = objVenue["EventStartDate"].ToString();
                    tbt.EventEndDate = objVenue["EventEndDate"].ToString();
                    tbt.Eventrequirements = objVenue["Eventrequirements"].ToString();
                    tbt.FirstName = objVenue["FirstName"].ToString();
                    tbt.LastName = objVenue["LastName"].ToString();
                    tbt.EmailAddress = objVenue["EmailAddress"].ToString();
                    tbt.Phone = objVenue["Phone"].ToString();
                    tbt.Organization = objVenue["Organization"].ToString();
                    tbt.OrganizationType = objVenue["OrganizationType"].ToString();

                    db.AddTotbl_guest_message(tbt);

                    string guestName = "";
                    string guestEmail = "";
                    //if (guestId == 0)
                    //{
                        guestName = objVenue["FirstName"].ToString() + " " + objVenue["LastName"].ToString();
                        guestEmail = objVenue["EmailAddress"].ToString();
                    //}
                    //else
                    //{
                    //    string guestInfo = GetGuestByGuestID(guestId);
                    //    JObject guestObj = JObject.Parse(guestInfo);
                    //     guestName = guestObj["GuestName"].ToString();
                    //     guestEmail = guestObj["GuestEmail"].ToString();
                    //}
                    string venueInfo = VenuesManager.GetVenuesByVenueId(int.Parse(objVenue["VenueID"].ToString()), "");
                     JArray arrVenue = JArray.Parse(venueInfo);

                    string venueEmail="";
                    string venueManager="";
                    string veneName="";
                    string SMTPHost = "smtp.163.com";
                    string SMTPuser = "[email protected]";
                    string SMTPpass = "142807";
                    foreach (JObject venueObj in arrVenue)
                    {
                        venueEmail = venueObj["Email"].ToString();
                        venueManager = venueObj["VenueManager"].ToString();
                        veneName= venueObj["VenueName"].ToString();
                    }
                    string fromEmailName = SMTPuser.Substring(0, SMTPuser.LastIndexOf("@"));
                    string toEmailName=venueEmail.Substring(0,venueEmail.LastIndexOf("@"));
                    string contentStr = guestName + "游客(" + guestEmail + ")给您留言了!\r\n" + "EventName:" + objVenue["EventName"].ToString() + "\r\n EventType:" + objVenue["EventType"].ToString() + "\r\n EstimatedAttendees:" +
                       objVenue["EstimatedAttendees"].ToString() + "\r\n EventStartDate:" + objVenue["EventStartDate"].ToString() + "\r\n EventEndDate:" + objVenue["EventEndDate"].ToString()
                       + "\r\n EventRequirements:" + objVenue["Eventrequirements"].ToString() + "\r\n FirstName:" + objVenue["FirstName"].ToString() + "\r\n LastName" + objVenue["LastName"].ToString()
                       + "\r\n EmailAddress:" + objVenue["EmailAddress"].ToString() + "\r\n Phone:" + objVenue["Phone"].ToString() + "\r\n Organization:" + objVenue["Organization"].ToString()
                       + "\r\n OrganizationType:" + objVenue["OrganizationType"].ToString();
                    //string guestMessageContnet = guestName + "游客(" + guestEmail + ")给您留言了!" + objVenue["MessageContent"].ToString();
                   // string fileAddress = "D:\\游客留言发送邮件.txt";
                    string fileAddress = "";
                    sendmail(SMTPuser, fromEmailName, venueEmail, toEmailName, "游客留言", contentStr, fileAddress, SMTPHost, SMTPuser, SMTPpass);
                    //sendmail(SMTPuser, fromEmailName, venueEmail, toEmailName, objVenue["MessageTitle"].ToString(), guestMessageContnet, fileAddress, SMTPHost, SMTPuser, SMTPpass);

                    if (db.SaveChanges() != 0)
                    {
                        returnStr = KeyManager.RetrunSucceed;
                    }
                    else
                    {
                        returnStr = KeyManager.RetrunUnSucceed;
                    }

                }
            }
            catch (Exception e)
            {
                returnStr = e.Message;
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_VisitorManager, "游客用户留言,mInfo=" + mInfo + ";错误信息:" + e.Message, null);
            }

            return returnStr;
//.........这里部分代码省略.........
开发者ID:zyyecho,项目名称:venues,代码行数:101,代码来源:GuestManager.cs


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