當前位置: 首頁>>代碼示例>>C#>>正文


C# venuesEntities.AddTotbl_guest方法代碼示例

本文整理匯總了C#中WebService.venuesEntities.AddTotbl_guest方法的典型用法代碼示例。如果您正苦於以下問題:C# venuesEntities.AddTotbl_guest方法的具體用法?C# venuesEntities.AddTotbl_guest怎麽用?C# venuesEntities.AddTotbl_guest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WebService.venuesEntities的用法示例。


在下文中一共展示了venuesEntities.AddTotbl_guest方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RegisterGuest

        public static string RegisterGuest(string mInfo)
        {
            string returnStr = "";
            JObject objVenue = JObject.Parse(mInfo);
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    string guestName = objVenue["GuestName"].ToString();
                    Boolean ishasUser = false;

                    string strSql = string.Format("SELECT tg.GuestName FROM tbl_guest AS tg WHERE tg.GuestName='{0}'", guestName);
                    ObjectQuery<DbDataRecord> results = db.CreateQuery<DbDataRecord>(strSql);
                    foreach (var ks in results)
                    {
                        ishasUser = true;
                    }
                    if (!ishasUser)
                    {
                        tbl_guest tbt = new tbl_guest();
                        tbt.GuestContact = objVenue["GuestContact"].ToString();
                        tbt.GuestCreateTime = DateTime.Now;
                        tbt.GuestEmail = objVenue["GuestEmail"].ToString();
                        tbt.GuestIP = objVenue["GuestIP"].ToString();
                        tbt.GuestName = objVenue["GuestName"].ToString();
                        tbt.GuestPassword =GeneralFuction.MD5Encrypt(objVenue["GuestPassword"].ToString());
                        tbt.GuestRemark = objVenue["GuestRemark"].ToString();
                        tbt.Region = objVenue["Region"].ToString();
                        tbt.Sector = objVenue["Sector"].ToString();

                        db.AddTotbl_guest(tbt);

                        if (db.SaveChanges() != 0)
                        {
                            returnStr = KeyManager.RetrunSucceed;
                        }
                        else
                        {
                            returnStr = KeyManager.RetrunUnSucceed;
                        }
                    }
                    else
                    {
                        returnStr = "不成功,已有名稱為“" + guestName + "”的用戶。";
                    }
                }
            }
            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,代碼行數:55,代碼來源:GuestManager.cs


注:本文中的WebService.venuesEntities.AddTotbl_guest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。