當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。