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


C# venuesEntities.AttachTo方法代碼示例

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


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

示例1: DeleteResourceByVenueID

        public static string DeleteResourceByVenueID(int veneuID, string loginUserInfo)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    if (veneuID != 0)
                    {
                        ObjectQuery<tbl_file> tva = db.tbl_file.Where("[email protected]", new ObjectParameter("v", veneuID));

                        ObjectResult<tbl_file> results = tva.Execute(MergeOption.NoTracking);

                        foreach (tbl_file item in results)
                        {
                            db.AttachTo("tbl_file", item);
                            db.DeleteObject(item);
                        };
                        if (db.SaveChanges() != 0)
                        {
                            returnStr = KeyManager.RetrunSucceed;
                            LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_VenusManager, "根據場所id刪除資源記錄成功,veneuID=" + veneuID, loginUserInfo);
                        }
                        else
                            returnStr = KeyManager.RetrunUnSucceed;
                    }
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_VenusManager, "根據場所id刪除資源記錄,veneuID=" + veneuID + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:34,代碼來源:ResourceManager.cs

示例2: DeletePageModuleAttributeByPageAndModuleID

        public static String DeletePageModuleAttributeByPageAndModuleID(int mId, string loginUserInfo,int pageID)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    ObjectQuery<tbl_page_module_attribute> tva = db.tbl_page_module_attribute.Where("[email protected] AND [email protected]", new ObjectParameter("v", mId), new ObjectParameter("u", pageID));

                    ObjectResult<tbl_page_module_attribute> results = tva.Execute(MergeOption.NoTracking);

                    foreach (tbl_page_module_attribute item in results)
                    {
                        db.AttachTo("tbl_page_module_attribute", item);
                        db.DeleteObject(item);
                    };
                    if (db.SaveChanges() != 0)
                        returnStr = KeyManager.RetrunSucceed;
                    else
                        returnStr = KeyManager.RetrunUnSucceed;
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_PagesManager, "根據moduleId和pageID刪除頁麵模塊其他屬性,moduleId=" + mId + ",pageID="+pageID+";錯誤信息:" + e.Message, loginUserInfo);
            }
            LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_PagesManager, "根據moduleId和pageID刪除頁麵模塊其他屬性,moduleId=" + mId + ",pageID=" + pageID, loginUserInfo);
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:29,代碼來源:PageModuleAttributeManager.cs

示例3: DeletePageContentByPageID

        public static string DeletePageContentByPageID(int pageID,string loginUserInfo)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    ObjectQuery<tbl_page_content> tva = db.tbl_page_content.Where("[email protected]", new ObjectParameter("v", pageID));

                    ObjectResult<tbl_page_content> results = tva.Execute(MergeOption.NoTracking);

                    foreach (tbl_page_content item in results)
                    {
                        db.AttachTo("tbl_page_content", item);
                        db.DeleteObject(item);
                    };
                    if (db.SaveChanges() != 0)
                    {
                        returnStr = "成功!";
                        LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_PagesManager, "刪除頁麵內容成功,pageID=" + pageID, loginUserInfo);
                    }
                    else
                        returnStr = "不成功!";
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_PagesManager, "刪除頁麵內容,pageID=" + pageID + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:31,代碼來源:PageContentManager.cs

示例4: DeleteVenueAttributeByVenueId

        /// <summary>
        /// 刪除指定用戶
        /// </summary>
        /// <param name="UserId">用戶ID</param>
        /// <returns></returns>
        public static String DeleteVenueAttributeByVenueId(int venueId, string loginUserInfo)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    //string strSql = string.Format(" SELECT vatt.ID FROM tbl_venue_attribute AS vatt where vatt.VenueID={0}", venueId);
                    //  ObjectQuery<DbDataRecord> kss=  db.CreateQuery<DbDataRecord>(strSql);
                    //  foreach (var ks in kss)
                    //  {
                    //      int cVenueAttId = int.Parse(ks["ID"].ToString());
                    //      tbl_venue_attribute su = db.tbl_venue_attribute.First<tbl_venue_attribute>(a => a.ID.Equals(cVenueAttId));
                    //      db.DeleteObject(su);
                    //  }
                    //if (db.SaveChanges() != 0)
                    //    returnStr = "成功!";
                    //else
                    //    returnStr = "不成功!";
                    ObjectQuery<tbl_venue_attribute> tva = db.tbl_venue_attribute.Where("[email protected]", new ObjectParameter("v", venueId));

                    ObjectResult<tbl_venue_attribute> results = tva.Execute(MergeOption.NoTracking);

                    foreach (tbl_venue_attribute item in results)
                    {
                        db.AttachTo("tbl_venue_attribute", item);
                        db.DeleteObject(item);
                    };
                    if (db.SaveChanges() != 0 )
                        returnStr= "成功!";
                    else
                        returnStr = "不成功!";
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_VenusManager, "根據場所id刪除場所的其他屬性,venueId=" + venueId + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_VenusManager, "根據場所id刪除場所的其他屬性,venueId=" + venueId, loginUserInfo);
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:46,代碼來源:VenueAttributeManager.cs

示例5: DeleteModuleByTemplateID

        public static String DeleteModuleByTemplateID(int TemplateID, string loginUserInfo)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    ObjectQuery<tbl_module> tva = db.tbl_module.Where("[email protected]", new ObjectParameter("v", TemplateID));

                    ObjectResult<tbl_module> results = tva.Execute(MergeOption.NoTracking);

                    foreach (tbl_module item in results)
                    {
                        db.AttachTo("tbl_module", item);
                        db.DeleteObject(item);

                        //刪除模塊關聯的其他屬性信息
                        DeleteModuleAttributeByModuleID(item.ID, loginUserInfo);

                    };
                    if (db.SaveChanges() != 0)
                        returnStr = KeyManager.RetrunSucceed;
                    else
                        returnStr =KeyManager.RetrunUnSucceed;
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_ModulesManager, "根據TemplateID刪除模塊所屬改模板的模塊信息,TemplateID=" + TemplateID + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_ModulesManager, "根據TemplateID刪除模塊所屬改模板的模塊信息,TemplateID=" + TemplateID, loginUserInfo);
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:33,代碼來源:ModuleManager.cs

示例6: SavePage

        public static string SavePage(string mInfo, string loginUserInfo,int pageState)
        {
            string returnStr = "";
            JObject objInfo = JObject.Parse(mInfo);
            JObject objUser = JObject.Parse(loginUserInfo);
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    int templateID = int.Parse(objInfo["TemplateID"].ToString());
                    int venueID = int.Parse(objInfo["VenueID"].ToString());
                    //如果該場所已有該免費模板生成的免費首頁,則先刪除,然後重新生成
                    if (templateID == KeyManager.HomePage_Default_Template )
                    {
                        //string esql = "";
                        ObjectQuery<tbl_page> tva = db.tbl_page.Where("[email protected] AND [email protected] AND [email protected]", new ObjectParameter("v", templateID), new ObjectParameter("u", venueID), new ObjectParameter("y",  objInfo["PageName"].ToString()));
                      //  ObjectQuery<tbl_page> tva = db.CreateQuery<tbl_page>(esql);

                       ObjectResult<tbl_page> results = tva.Execute(MergeOption.NoTracking);

                       foreach (tbl_page item in results)
                        {
                            db.AttachTo("tbl_page", item);
                            db.DeleteObject(item);
                        };
                        if (db.SaveChanges() != 0)
                            returnStr = "成功!";
                        else
                            returnStr = "不成功!";
                    }

                    int curNewSeq = GetMaxSequence();
                    tbl_page tbt = new tbl_page();
                    tbt.PageDescription = objInfo["PageDescription"].ToString();
                    tbt.PageCreateTime = DateTime.Now;
                    tbt.PageModifyTime = DateTime.Now;
                    tbt.PageName = objInfo["PageName"].ToString();
                    tbt.PagePublish = KeyManager.PagePublish_Not;
                    tbt.PageState = pageState;
                    tbt.TemplateID = int.Parse(objInfo["TemplateID"].ToString());
                    tbt.VenueID = int.Parse(objInfo["VenueID"].ToString());

                    //tbt.VenueID = int.Parse(objUser["curUserID"].ToString());
                    //tbt.UserVenueTypeID = objUser["UserTypeParentId"].ToString();
                    tbt.PageTypeID =int.Parse(objInfo["PageTypeID"].ToString());
                    tbt.Sequence = curNewSeq + 1;
                    string pageContentInfo = objInfo["pageContentInfo"].ToString();

                    string moduleInfo = objInfo["pageModuleAttributeInfo"].ToString();
                    db.AddTotbl_page(tbt);

                    if (db.SaveChanges() != 0)
                    {
                        string strSql = "SELECT MAX(s.ID) as max FROM tbl_page AS s";
                        int newPageID = 0;
                        ObjectQuery<DbDataRecord> resultm = db.CreateQuery<DbDataRecord>(strSql);
                        foreach (var item in resultm)
                        {
                            newPageID = int.Parse(item["max"].ToString());
                        }
                        if (pageContentInfo != "[]")
                        {
                            returnStr = KeyManager.RetrunSucceed;

                            JArray arrPageContent = JArray.Parse(objInfo["pageContentInfo"].ToString());
                            foreach (JObject objPageContent in arrPageContent)
                            {
                                returnStr = PageContentManager.SavePageContent(newPageID, templateID, objPageContent.ToString(), loginUserInfo);
                            }
                        }
                        if (moduleInfo != "[]")
                        {
                            returnStr = KeyManager.RetrunSucceed;

                            JArray arrModules = JArray.Parse(objInfo["pageModuleAttributeInfo"].ToString());
                            foreach (JObject objModule in arrModules)
                            {
                                returnStr = PageModuleAttributeManager.AddPageModuleAttribute(objModule.ToString(), loginUserInfo, newPageID, templateID);
                            }
                        }
                        returnStr = KeyManager.RetrunSucceed;
                    }
                    else
                    {
                        returnStr = KeyManager.RetrunUnSucceed;
                    }
                }
            }
            catch (Exception e)
            {
                returnStr = e.Message;
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_PagesManager, "新增頁麵,mInfo=" + mInfo + ";錯誤信息:" + e.Message, loginUserInfo);
            }

            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:96,代碼來源:PageManager.cs

示例7: DeleteVenuePagesByVenueId

        /// <summary>
        /// 刪除場所頁麵關聯關係
        /// </summary>
        /// <returns></returns>
        public static String DeleteVenuePagesByVenueId(int venueId, string loginUserInfo)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    ObjectQuery<tbl_venue_pages> tva = db.tbl_venue_pages.Where("[email protected]", new ObjectParameter("v", venueId));

                    ObjectResult<tbl_venue_pages> results = tva.Execute(MergeOption.NoTracking);

                    foreach (tbl_venue_pages item in results)
                    {
                        db.AttachTo("tbl_venue_pages", item);
                        db.DeleteObject(item);
                    };
                    if (db.SaveChanges() != 0)
                        returnStr = "成功!";
                    else
                        returnStr = "不成功!";
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_VenusManager, "根據場所id刪除場所頁麵關聯關係,venueId=" + venueId + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_VenusManager, "根據場所id刪除場所頁麵關聯關係,venueId=" + venueId, loginUserInfo);
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:33,代碼來源:VenuePageRelationsManager.cs

示例8: SetSalePagePublish

        public static string SetSalePagePublish(int pageID, int publishPublishID)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    if (pageID != 0)
                    {
                        ObjectQuery<tbl_sales> tva = db.tbl_sales.Where("[email protected]", new ObjectParameter("v", pageID));

                        ObjectResult<tbl_sales> results = tva.Execute(MergeOption.NoTracking);

                        foreach (tbl_sales item in results)
                        {
                            db.AttachTo("tbl_sales", item);
                            item.SalesPublishID = publishPublishID;
                        };

                        returnStr = KeyManager.RetrunSucceed;
                    }

                    else
                    {
                        returnStr = KeyManager.RetrunUnSucceed;
                    }
                }
            }
            catch (Exception e)
            {
                returnStr = e.Message;
                //LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_PagesManager, "設置促銷頁麵發布狀態,pageID=" + pageID + "publishPublishID=" + publishPublishID + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:35,代碼來源:SalesPageManager.cs

示例9: DeleteThemeSalesBySaleId

        public static String DeleteThemeSalesBySaleId(int saleId, string loginUserInfo)
        {
            string returnStr = "";
            try
            {
                using (venuesEntities db = new venuesEntities())
                {
                    ObjectQuery<tbl_theme_salespage> tva = db.tbl_theme_salespage.Where("[email protected]", new ObjectParameter("v", saleId));

                    ObjectResult<tbl_theme_salespage> results = tva.Execute(MergeOption.NoTracking);

                    foreach (tbl_theme_salespage item in results)
                    {
                        db.AttachTo("tbl_theme_salespage", item);
                        db.DeleteObject(item);
                    };
                    if (db.SaveChanges() != 0)
                        returnStr = "成功!";
                    else
                        returnStr = "成功!";
                }
            }
            catch (Exception e)
            {
                LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_SalesManager, "根據主題id刪除該主題與促銷頁麵的關聯關係,saleId=" + saleId + ";錯誤信息:" + e.Message, loginUserInfo);
            }
            LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_SalesManager, "根據主題id刪除該主題與促銷頁麵的關聯關係,saleId=" + saleId, loginUserInfo);
            return returnStr;
        }
開發者ID:zyyecho,項目名稱:venues,代碼行數:29,代碼來源:ThemeSalesManager.cs


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