public void RunCaseStepTest() { IAction action = new CaseAdapter(); var client = new ActionProvider(action); client.RunCaseStep(); }
/// <summary> /// Occurs when the page is being loaded. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains no event data.</param> protected void Page_Load(object sender, EventArgs e) { Micajah.Common.Pages.MasterPage.CreatePageHeader(this.Page, false, true); AutoGeneratedButtonsField.InsertButtonSeparator(ButtonsSeparator); if (!this.IsPostBack) { Micajah.Common.Pages.MasterPage.SetPageTitle(this.Page, ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery))); this.LoadResources(); this.ValidateResetPasswordRequest(); } if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern) { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnModernStyleSheet, true))); MagicForm.ApplyStyle(FormTable); PasswordCompareValidator.Attributes["controltovalidate2"] = ConfirmPasswordTextBox.ClientID; MainContainer.Style[HtmlTextWriterStyle.Height] = "320px"; MainContainer.Style[HtmlTextWriterStyle.MarginTop] = "-160px"; } else { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnStyleSheet, true))); } }
public override void Execute(BoardMove move) { var piece = BoardState.GetItem(move.From).Item as PawnEntity; piece.TwoStep = true; ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move); }
static void CheckBug() { List <IProduct> books = new List <IProduct>(); PaperBook TolkienPaperBook1 = new PaperBook("Silmarillion", "Tolkien", 500); books.Add(TolkienPaperBook1); PaperBook TolkienPaperBook2 = new PaperBook("Hobbit", "Tolkien", 300); books.Add(TolkienPaperBook2); PaperBook ZelaznyPaperBook1 = new PaperBook("Nine Princes in Amber", "Zelazny", 400); books.Add(ZelaznyPaperBook1); DeliveryCalculator calculator = new DeliveryCalculator(); ActionProvider provider = new ActionProvider(); ShoppingCart cart = new ShoppingCart(calculator, provider); List <IPromo> listOfPromos = new List <IPromo> { }; IPromo promo1 = new PercentDiscountPromo(20); listOfPromos.Add(promo1); IPromo promo2 = new FreeBookPromo(ZelaznyPaperBook1); listOfPromos.Add(promo2); decimal finalPrice = cart.GetTotalPrice(books, listOfPromos); Console.WriteLine(finalPrice); }
/// <summary> /// Occurs when the page is being loaded. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains no event data.</param> protected void Page_Load(object sender, EventArgs e) { Micajah.Common.Pages.MasterPage.CreatePageHeader(this.Page, false, true); AutoGeneratedButtonsField.InsertButtonSeparator(ButtonsSeparator); if (!IsPostBack) { Micajah.Common.Pages.MasterPage.SetPageTitle(this.Page, ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery))); LoadResources(); string loginName = Request.QueryString["l"]; if (!string.IsNullOrEmpty(loginName)) { LoginTextBox.Text = loginName; } LoginTextBox.Focus(); ResultTable.Visible = false; } if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern) { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnModernStyleSheet, true))); MagicForm.ApplyStyle(FormTable); MagicForm.ApplyStyle(ResultTable); } else { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnStyleSheet, true))); } }
/// <summary> /// Generates the bread crumbs. /// </summary> /// <param name="action">The action.</param> /// <param name="addHomepageAction">A value indicating the homepage's action will be added to the collection.</param> public void Generate(Action action, bool addHomepageAction) { this.Clear(); UserContext user = UserContext.Current; IList actionIdList = null; bool isFrameworkAdmin = false; bool isAuthenticated = false; if (user != null) { actionIdList = user.ActionIdList; isAuthenticated = true; isFrameworkAdmin = (user.IsFrameworkAdministrator && (user.OrganizationId == Guid.Empty)); } Action item = action; while (item != null && item.ActionId != ActionProvider.PagesAndControlsActionId && item.ActionId != ActionProvider.GlobalNavigationLinksActionId) { if ((!item.GroupInDetailMenu) && (ActionProvider.ShowAction(item, actionIdList, isFrameworkAdmin, isAuthenticated))) { Insert(0, item); } item = item.ParentAction; } if (addHomepageAction) { this.AddHomePageAction(); } }
private void Tree_DataBind() { List <string> list = new List <string>(); foreach (RadTreeNode node in Tree.GetAllNodes()) { if (node.Expanded) { list.Add(node.Value); } } ConfigurationDataSet.ActionDataTable table = ActionProvider.GetActionsTree() as ConfigurationDataSet.ActionDataTable; table.DefaultView.Sort = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2}", table.ParentActionIdColumn.ColumnName, table.OrderNumberColumn.ColumnName, table.NameColumn.ColumnName); Tree.DataSource = table; Tree.DataBind(); foreach (RadTreeNode node in Tree.GetAllNodes()) { if (list.Contains(node.Value)) { node.Expanded = true; } } }
public static void SetActionProvider(this IMenuItem menuItem, ActionProvider actionProvider) { #if API8SUPPORT MenuItemCompat.SetActionProvider(menuItem, actionProvider); #else menuItem.SetActionProvider(actionProvider); #endif }
// 批量处理 public int Batch(string pIDList, ActionProvider pActionProvider) { SqlParameter[] parameters = SqlHelper.GetCachedParameters("Ziuziu.DBLayer.Area.Batch"); if (parameters == null) { parameters = new SqlParameter[] { new SqlParameter("@TableName", SqlDbType.NVarChar, 30), new SqlParameter("@Column", SqlDbType.NVarChar, 50), new SqlParameter("@ColumnValue", SqlDbType.NVarChar, 50), new SqlParameter("@PrimaryKey", SqlDbType.NVarChar, 50), new SqlParameter("@PrimaryValueList", SqlDbType.NVarChar, 500)//此处可以批多个以,隔开 }; SqlHelper.CacheParameters("Ziuziu.DBLayer.Area.Batch", parameters); } parameters[0].Value = tableName; switch (pActionProvider) { case ActionProvider.Delete: // 删除 parameters[1].Value = "IsDelete"; parameters[2].Value = 1; break; default: return(-101); //parameters[2].Value = string.Empty; //break; } parameters[3].Value = "ID"; parameters[4].Value = pIDList; try { using (SqlConnection SqlConn = new SqlConnection(SqlHelper.ConnectionStringMain)) { SqlConn.Open(); int Result = SqlHelper.ExecuteNonQuery(SqlConn, CommandType.StoredProcedure, "Batch", parameters); if (Result == 0) { return(0); } else if (Result == -1) { return(0); } else { return(-30); } } } catch (Exception ex) { //MyErrorXml.WiterErrorToXml(ex); return(-31); } }
// �������� public int Batch(string pIDList, ActionProvider pActionProvider) { SqlParameter[] parameters = SqlHelper.GetCachedParameters("Ziuziu.DBLayer.Area.Batch"); if (parameters == null) { parameters = new SqlParameter[]{ new SqlParameter("@TableName", SqlDbType.NVarChar, 30), new SqlParameter("@Column", SqlDbType.NVarChar, 50), new SqlParameter("@ColumnValue", SqlDbType.NVarChar, 50), new SqlParameter("@PrimaryKey", SqlDbType.NVarChar, 50), new SqlParameter("@PrimaryValueList", SqlDbType.NVarChar, 500)//�˴������������,��� }; SqlHelper.CacheParameters("Ziuziu.DBLayer.Area.Batch", parameters); } parameters[0].Value = tableName; switch (pActionProvider) { case ActionProvider.Delete:// ɾ�� parameters[1].Value = "IsDelete"; parameters[2].Value = 1; break; default: return -101; //parameters[2].Value = string.Empty; //break; } parameters[3].Value = "ID"; parameters[4].Value = pIDList; try { using (SqlConnection SqlConn = new SqlConnection(SqlHelper.ConnectionStringMain)) { SqlConn.Open(); int Result = SqlHelper.ExecuteNonQuery(SqlConn, CommandType.StoredProcedure, "Batch", parameters); if (Result == 0) { return 0; } else if (Result == -1) { return 0; } else { return -30; } } } catch (Exception ex) { //MyErrorXml.WiterErrorToXml(ex); return -31; } }
// 保存地区信息 public int Save(Ziuziu.Model.Area pArea, ActionProvider pActionProvider) { SqlParameter[] parameters = SqlHelper.GetCachedParameters("Ziuziu.DBLayer.Area.Save"); if (parameters == null) { parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@AreaName", SqlDbType.NVarChar, 50), new SqlParameter("@AreaCode", SqlDbType.NVarChar, 50), new SqlParameter("@Flag", SqlDbType.Bit, 1), new SqlParameter("@ShortName", SqlDbType.NVarChar, 50), new SqlParameter("@aProvider", SqlDbType.Int, 4), new SqlParameter("@ReturnValue", SqlDbType.Int) }; parameters[6].Direction = ParameterDirection.ReturnValue; SqlHelper.CacheParameters("Ziuziu.DBLayer.Area.Save", parameters); } parameters[0].Value = pArea.ID; parameters[1].Value = pArea.AreaName; parameters[2].Value = pArea.AreaCode; parameters[3].Value = pArea.Flag; parameters[4].Value = pArea.ShortName; parameters[5].Value = (int)pActionProvider; try { using (SqlConnection sqlConn = new SqlConnection(SqlHelper.ConnectionStringMain)) { sqlConn.Open(); SqlHelper.ExecuteNonQuery(sqlConn, CommandType.StoredProcedure, "Area_InsertUpdate", parameters); int Result = int.Parse(parameters[6].Value.ToString()); switch (Result) { case 0: return(int.Parse(parameters[0].Value.ToString())); case -300: return(-11); default: return(-30); } } } catch (Exception ex) { //MyErrorXml.WiterErrorToXml(ex); return(-31); } }
private void Atv_DataBind(Guid groupId, Guid instanceId) { Guid roleId = GroupProvider.GetGroupInstanceRole(UserContext.Current.OrganizationId, groupId, instanceId); m_ActionIdList = GroupProvider.GetActionIdList(groupId, instanceId, roleId); m_StartActionId = RoleProvider.GetStartActionId(roleId); Atv.DataSource = ActionProvider.GetActionsTree(); Atv.DataBind(); }
public PlayerActor(World world, AnimationProvider animations, SystemAnimationProvider sysanimations, ActionProvider actions) : base(world, animations, sysanimations, actions) { ImmuneGravity = false; DefaultGravity = 1.0f; Priority = 100; CollisionEnabled = true; }
public override void Execute(BoardMove move) { if (BoardState.IsEmpty(move.To)) { ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move); } else { ActionProvider.Create((int)DefaultActions.TakeOnly, BoardState).Execute(move); } }
public BulletActor(World world, AnimationProvider animations, SystemAnimationProvider sysanimations, ActionProvider actions) : base(world, animations, sysanimations, actions) { ImmuneGravity = true; IsInAir = true; DefaultGravity = 0.0f; Priority = 300; CollisionEnabled = false; }
/// <summary> /// We initialize the class operations based on sites and browser used. /// </summary> /// <param name="sites"></param> /// <param name="browser"></param> /// <returns></returns> protected IBaseOperation InitializeOperation(string sites, string browser) { IWebDriver driver = Current(browser, sites); IActionProvider action = new ActionProvider(driver); IBaseElement element = sites.In("template1".GetValue()) ? new TemplateOneElement() as IBaseElement : new TemplateTwoElement() as IBaseElement; driver.Manage().Window.Maximize(); return(new Operation(driver, action, element)); }
/// <summary> /// 更新信息 /// </summary> public void Update(Article pArticleFullInfo, ActionProvider pActionProvider) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Article set "); strSql.Append("Title=@Title,"); strSql.Append("Content=@Content,"); strSql.Append("AddDate=@AddDate,"); strSql.Append("IP=@IP,"); strSql.Append("UserID=@UserID,"); strSql.Append("ClassID=@ClassID,"); strSql.Append("Summary=@Summary,"); strSql.Append("TotalHits=@TotalHits,"); strSql.Append("IsDraft=@IsDraft,"); strSql.Append("UpdateDate=@UpdateDate,"); strSql.Append("IsCheck=@IsCheck,"); strSql.Append("IsDelete=@IsDelete,"); strSql.Append("IsCommon=@IsCommon"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@Content", SqlDbType.Text), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@IP", SqlDbType.NVarChar, 50), new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@ClassID", SqlDbType.Int, 4), new SqlParameter("@Summary", SqlDbType.NVarChar, 500), new SqlParameter("@TotalHits", SqlDbType.Int, 4), new SqlParameter("@IsDraft", SqlDbType.Bit, 1), new SqlParameter("@UpdateDate", SqlDbType.DateTime), new SqlParameter("@IsCheck", SqlDbType.Bit, 1), new SqlParameter("@IsDelete", SqlDbType.Bit, 1), new SqlParameter("@IsCommon", SqlDbType.Int, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.Title; parameters[2].Value = model.Content; parameters[3].Value = model.AddDate; parameters[4].Value = model.IP; parameters[5].Value = model.UserID; parameters[6].Value = model.ClassID; parameters[7].Value = model.Summary; parameters[8].Value = model.TotalHits; parameters[9].Value = model.IsDraft; parameters[10].Value = model.UpdateDate; parameters[11].Value = model.IsCheck; parameters[12].Value = model.IsDelete; parameters[13].Value = model.IsCommon; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
public override void Execute(BoardMove move) { var takenItem = BoardState.GetItem(move.To); if (takenItem == null) { throw new Exception("No piece found for TakeOnly action"); } BoardState.Remove(move.To); ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move); }
private void EditForm_ChangeType(ActionType type, Guid actionId) { EditForm.Fields[2].Visible = true; // NavigateUrl EditForm.Fields[3].Visible = true; // OrderNumber EditForm.Fields[4].Visible = true; // AuthenticationRequired CheckBoxField checkBoxField = EditForm.Fields[5] as CheckBoxField; // InstanceRequired if (checkBoxField != null) { checkBoxField.Visible = FrameworkConfiguration.Current.WebApplication.EnableMultipleInstances; } EditForm.Fields[6].Visible = true; // Visible EditForm.Fields[7].Visible = false; // AlternativeParents EditForm_SetSubmenuFieldsVisible(false); EditForm_SetDetailMenuFieldsVisible(false); AlternativeParentsTree.Visible = false; AlternativeParentsTree.DataSource = null; switch (type) { case ActionType.GlobalNavigationLink: EditForm.Fields[5].Visible = false; // InstanceRequired break; case ActionType.Control: EditForm.Fields[2].Visible = false; // NavigateUrl EditForm.Fields[3].Visible = false; // OrderNumber EditForm.Fields[4].Visible = false; // AuthenticationRequired EditForm.Fields[5].Visible = false; // InstanceRequired EditForm.Fields[6].Visible = false; // Visible break; case ActionType.Page: // AlternativeParents m_AlternativeParentActionsIdList = ActionProvider.GetAlternativeParentActionsIdList(actionId); if ((m_AlternativeParentActionsIdList != null) && (m_AlternativeParentActionsIdList.Count > 0)) { EditForm.Fields[7].Visible = true; // AlternativeParents AlternativeParentsTree_DataBind(actionId); } else { EditForm.Fields[7].Visible = false; // AlternativeParents } EditForm_SetSubmenuFieldsVisible(true); EditForm_SetDetailMenuFieldsVisible(true); break; } }
public void ProcessRequest(HttpContext context) { IProtocolMessage request = m_Provider.ReadRequest(); UnauthorizedTokenRequest requestToken = null; UserAuthorizationRequest requestAuth = null; AuthorizedTokenRequest requestAccessToken; if ((requestToken = request as UnauthorizedTokenRequest) != null) { UnauthorizedTokenResponse response = m_Provider.PrepareUnauthorizedTokenMessage(requestToken); m_Provider.Channel.Send(response); } else if ((requestAuth = request as UserAuthorizationRequest) != null) { string token = ((ITokenContainingMessage)requestAuth).Token; ((TokenProvider)m_Provider.TokenManager).UpdatePendingUserAuthorizationRequest(token, requestAuth); TokenProvider.SetTokenCookie(token); if (context == null) { throw new ArgumentNullException("context"); } context.Response.Redirect(ActionProvider.FindAction(ActionProvider.OAuthPageActionId).AbsoluteNavigateUrl); } else if ((requestAccessToken = request as AuthorizedTokenRequest) != null) { AuthorizedTokenResponse response = m_Provider.PrepareAccessTokenMessage(requestAccessToken); OAuthDataSet.OAuthTokenRow row = (OAuthDataSet.OAuthTokenRow)m_Provider.TokenManager.GetAccessToken(response.AccessToken); response.ExtraData.Add(new KeyValuePair <string, string>("api_token", LoginProvider.Current.GetToken(row.LoginId))); if (!row.IsOrganizationIdNull()) { response.ExtraData.Add(new KeyValuePair <string, string>("org", OrganizationProvider.GetOrganization(row.OrganizationId).PseudoId)); if (!row.IsInstanceIdNull()) { response.ExtraData.Add(new KeyValuePair <string, string>("dept", InstanceProvider.GetInstance(row.InstanceId, row.OrganizationId).PseudoId)); } } m_Provider.Channel.Send(response); } else { throw new InvalidOperationException(); } }
public override void Execute(BoardMove move) { if (BoardState.IsEmpty(move.From)) { return; } var piece = BoardState.GetItem(move.From).Item; var passedPieceLoc = move.To.MoveBack((Colours)piece.Owner); BoardState.Remove(passedPieceLoc); ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move); }
/// <summary> /// 添加信息 /// </summary> public int Add(Article pArticleFullInfo, ActionProvider pActionProvider) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Article("); strSql.Append("Title,Content,AddDate,IP,UserID,ClassID,Summary,TotalHits,IsDraft,UpdateDate,IsCheck,IsDelete,IsCommon)"); strSql.Append(" values ("); strSql.Append("@Title,@Content,@AddDate,@IP,@UserID,@ClassID,@Summary,@TotalHits,@IsDraft,@UpdateDate,@IsCheck,@IsDelete,@IsCommon)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@Content", SqlDbType.Text), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@IP", SqlDbType.NVarChar, 50), new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@ClassID", SqlDbType.Int, 4), new SqlParameter("@Summary", SqlDbType.NVarChar, 500), new SqlParameter("@TotalHits", SqlDbType.Int, 4), new SqlParameter("@IsDraft", SqlDbType.Bit, 1), new SqlParameter("@UpdateDate", SqlDbType.DateTime), new SqlParameter("@IsCheck", SqlDbType.Bit, 1), new SqlParameter("@IsDelete", SqlDbType.Bit, 1), new SqlParameter("@IsCommon", SqlDbType.Int, 4) }; parameters[0].Value = model.Title; parameters[1].Value = model.Content; parameters[2].Value = model.AddDate; parameters[3].Value = model.IP; parameters[4].Value = model.UserID; parameters[5].Value = model.ClassID; parameters[6].Value = model.Summary; parameters[7].Value = model.TotalHits; parameters[8].Value = model.IsDraft; parameters[9].Value = model.UpdateDate; parameters[10].Value = model.IsCheck; parameters[11].Value = model.IsDelete; parameters[12].Value = model.IsCommon; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
private void BuildMenus() { ActionCollection allItems = (this.DataSource as ActionCollection); if (allItems == null) { if ((this.ParentAction == null) || (this.ParentAction.ActionType != ActionType.Page)) { return; } allItems = m_ParentAction.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); bool flag = false; if (MasterPage != null) { flag = (MasterPage.IsHomepage && ((!MasterPage.VisibleMainMenu) || allItems.Count == 0)); } if (flag || (this.VisibleSiblingItems.HasValue && this.VisibleSiblingItems.Value)) { ActionCollection siblingActions = new ActionCollection(); foreach (Micajah.Common.Bll.Action item in ActionProvider.PagesAndControls.GetAvailableSiblingActions(m_ParentAction)) { if (ActionProvider.ShowAction(item, m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated)) { siblingActions.Add(item); } } allItems.AddRange(siblingActions); } } if (allItems != null) { foreach (Micajah.Common.Bll.Action item in allItems) { if (item.ShowInDetailMenu) { m_PrimaryMenuItems.Add(item); } else { m_OtherMenuItems.Add(item); } } } }
/// <summary> /// �����Ϣ /// </summary> public int Add(Article pArticleFullInfo, ActionProvider pActionProvider) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Article("); strSql.Append("Title,Content,AddDate,IP,UserID,ClassID,Summary,TotalHits,IsDraft,UpdateDate,IsCheck,IsDelete,IsCommon)"); strSql.Append(" values ("); strSql.Append("@Title,@Content,@AddDate,@IP,@UserID,@ClassID,@Summary,@TotalHits,@IsDraft,@UpdateDate,@IsCheck,@IsDelete,@IsCommon)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Title", SqlDbType.NVarChar,100), new SqlParameter("@Content", SqlDbType.Text), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@IP", SqlDbType.NVarChar,50), new SqlParameter("@UserID", SqlDbType.Int,4), new SqlParameter("@ClassID", SqlDbType.Int,4), new SqlParameter("@Summary", SqlDbType.NVarChar,500), new SqlParameter("@TotalHits", SqlDbType.Int,4), new SqlParameter("@IsDraft", SqlDbType.Bit,1), new SqlParameter("@UpdateDate", SqlDbType.DateTime), new SqlParameter("@IsCheck", SqlDbType.Bit,1), new SqlParameter("@IsDelete", SqlDbType.Bit,1), new SqlParameter("@IsCommon", SqlDbType.Int,4)}; parameters[0].Value = model.Title; parameters[1].Value = model.Content; parameters[2].Value = model.AddDate; parameters[3].Value = model.IP; parameters[4].Value = model.UserID; parameters[5].Value = model.ClassID; parameters[6].Value = model.Summary; parameters[7].Value = model.TotalHits; parameters[8].Value = model.IsDraft; parameters[9].Value = model.UpdateDate; parameters[10].Value = model.IsCheck; parameters[11].Value = model.IsDelete; parameters[12].Value = model.IsCommon; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return 1; } else { return Convert.ToInt32(obj); } }
public AEMG SetupMainWindow() { //reset working directory Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //set culture Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); var dataIO = new DataIO(); var autoMapper = new SimpleAutoMapper(); var messageBox = new MessageBoxService(); var repository = new AERepository(); var mtpManager = new MTPManager(); var saverepo = new AESavedSetupRepository(); var actionProvider = new ActionProvider(autoMapper, messageBox); var aeActionFactory = new AEActionFactory(actionProvider); var DependencyDict = new Dictionary <Type, object>() { { typeof(SimpleAutoMapper), autoMapper }, { typeof(MessageBoxService), messageBox }, { typeof(ViewModelClipboard), new ViewModelClipboard() }, }; var viewModelFactory = new ViewModelFactory(DependencyDict); var appSettingVM = new ApplicationSettingViewModel(actionProvider, viewModelFactory); SetupWindowInit(appSettingVM, out IWindowInitlizer windowinit); (new ScriptGenerateBootstrap()).SetUp(out IActionToScriptFactory actionToScriptFactory, out IEmulatorToScriptFactory emulatorToScriptFactory); var scriptApply = new ScriptApplyBootStrap(messageBox, mtpManager).GetScriptApplyFactory(); var scanner = new MacroScanner(dataIO, aeActionFactory); var macroManager = new AEMacroManager(scanner); var macroManagerVM = new AEMacroManagerViewModel(scanner, messageBox, macroManager, windowinit); var aESettingVM = new AESettingViewModel(new AESetting(), mtpManager); var aeScriptGenerator = new AEScriptGenerator(scriptApply, aESettingVM, messageBox, autoMapper, emulatorToScriptFactory, actionToScriptFactory, dataIO, actionProvider); var autoUpdater = new AutoUpdater(messageBox); var actionList = new AEActionListViewModel(macroManager, repository, messageBox); var savemanager = new AEMacroSaveManagerViewModel(saverepo, macroManager); return(new AEMG { DataContext = new AEMGViewModel(macroManagerVM, actionList, aESettingVM, aeScriptGenerator, messageBox, autoUpdater, savemanager, macroManager) }); }
/// <summary> /// Adds the Home page action. /// </summary> private void AddHomePageAction() { if (this.Count == 0) { return; } Action homeItem = null; Action firstItem = this[0]; UserContext user = UserContext.Current; if (user != null) { homeItem = ActionProvider.FindAction(user.StartPageUrl); } else { homeItem = ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl("~/default.aspx")); if (homeItem != null) { if (homeItem.AuthenticationRequired) { homeItem = null; } } } if (Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern) { if (homeItem != null) { if ((homeItem != null) && (firstItem.ActionId == homeItem.ActionId)) { base.Remove(firstItem); } } } else { if ((homeItem != null) && (firstItem.ActionId != homeItem.ActionId)) { base.Insert(0, homeItem.Clone()); } } }
/// <summary> /// Occurs when the page is being loaded. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains no event data.</param> protected void Page_Load(object sender, EventArgs e) { Micajah.Common.Pages.MasterPage.CreatePageHeader(this.Page, false, false); Micajah.Common.Pages.MasterPage.SetPageTitle(this.Page, ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery))); this.LoadResources(); if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == Pages.MasterPageTheme.Modern) { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnModernStyleSheet, true))); MagicForm.ApplyStyle(FormTable); } else { this.Page.Header.Controls.Add(Support.CreateStyleSheetLink(ResourceProvider.GetResourceUrl(ResourceProvider.LogOnStyleSheet, true))); } }
/// <summary> /// Raises when a security module has established the identity of the user. /// </summary> /// <param name="sender">The sourceRow of the event.</param> /// <param name="e">An EventArgs that contains the event data.</param> protected virtual void Application_AuthenticateRequest(object sender, EventArgs e) { string pageUrl = Request.AppRelativeCurrentExecutionFilePath; if (ResourceProvider.IsResourceUrl(pageUrl)) { Context.SkipAuthorization = true; } else if (ActionProvider.IsPublicPage(pageUrl)) { if ((!FrameworkConfiguration.Current.WebApplication.Password.EnablePasswordRetrieval) && (string.Compare(pageUrl, ResourceProvider.PasswordRecoveryPageVirtualPath, StringComparison.OrdinalIgnoreCase) == 0)) { throw new HttpException(404, Resources.Error_404); } else { Micajah.Common.Bll.Action action = ActionProvider.FindAction(CustomUrlProvider.CreateApplicationAbsoluteUrl(Request.Url.PathAndQuery)); if (action != null) { Context.SkipAuthorization = (!action.AuthenticationRequired); } else { Context.SkipAuthorization = true; } switch (FrameworkConfiguration.Current.WebApplication.AuthenticationMode) { case AuthenticationMode.Forms: HttpCookie authCookie = Context.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie == null) { FormsIdentity id = new FormsIdentity(new FormsAuthenticationTicket(string.Empty, false, FrameworkConfiguration.Current.WebApplication.Login.Timeout)); GenericPrincipal principal = new GenericPrincipal(id, null); Context.User = principal; } break; } } } }
/// <summary>Creates a new command ready to be registered in a <see cref="CommandLine"/>.</summary> /// <param name="name">Unique name of the command, used summon the command.</param> /// <param name="actionProvider">Function that returns the </param> /// <param name="briefHelp"></param> /// <param name="detailedHelp"></param> /// <param name="maxArgs">Ignored if <paramref name="nArgs"/> is given</param> /// <param name="minArgs">Ignored if <paramref name="nArgs"/> is given</param> /// <param name="nArgs">Number of argguments required by the command</param> /// <param name="requiredTrigger"></param> public Command(string name, ActionProvider actionProvider, string briefHelp, string detailedHelp = null, int maxArgs = int.MaxValue, int minArgs = 0, int nArgs = -1, CommandTrigger requiredTrigger = CommandTrigger.User) { this.Name = name; this.provider = actionProvider; this.BriefHelp = briefHelp; if (detailedHelp != null) { this.help = detailedHelp.Split(new char[] { '\n' }).ToList(); } if (nArgs >= 0) { this.MaxArgs = this.MinArgs = nArgs; } else { this.MaxArgs = maxArgs; this.MinArgs = minArgs; } this.RequiredTrigger = requiredTrigger; }
public override void Execute(BoardMove move) { BoardMove kingMove, rookMove; if (move.From.X < move.To.X) // King Side { kingMove = new BoardMove(move.From, $"G{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly); rookMove = new BoardMove($"H{move.From.Y}".ToBoardLocation(), $"F{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly); } else { kingMove = new BoardMove(move.From, $"C{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly); rookMove = new BoardMove($"A{move.From.Y}".ToBoardLocation(), $"D{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly); } var moveOnly = ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState); moveOnly.Execute(kingMove); moveOnly.Execute(rookMove); }
public Actor(World theWorld, AnimationProvider animations, SystemAnimationProvider sysanimations, ActionProvider actions) { this.World = theWorld; this.Animations = animations; this.SystemAnimations = sysanimations; this.Actions = actions; this.ScaleX = 1; this.ScaleY = 1; this.Alpha = 1.0f; this.Red = 1.0f; this.Green = 1.0f; this.Blue = 1.0f; this.ImmuneGravity = true; this.IsInAir = true; }
protected void LdapGroupMappingsLink_Init(object sender, EventArgs e) { HyperLink lnk = sender as HyperLink; if (lnk != null) { Micajah.Common.Bll.Action action = ActionProvider.FindAction(ActionProvider.LdapGroupMappingsPageActionId); if (action != null) { if (action.AccessDenied()) { lnk.Visible = false; } else { lnk.Text = action.Name; lnk.NavigateUrl = action.AbsoluteNavigateUrl; } } } }
// ���������Ϣ public int Save(Ziuziu.Model.Area pArea, ActionProvider pActionProvider) { SqlParameter[] parameters = SqlHelper.GetCachedParameters("Ziuziu.DBLayer.Area.Save"); if (parameters == null) { parameters = new SqlParameter[]{ new SqlParameter("@ID", SqlDbType.Int,4), new SqlParameter("@AreaName", SqlDbType.NVarChar,50), new SqlParameter("@AreaCode", SqlDbType.NVarChar,50), new SqlParameter("@Flag", SqlDbType.Bit,1), new SqlParameter("@ShortName", SqlDbType.NVarChar,50), new SqlParameter("@aProvider", SqlDbType.Int,4), new SqlParameter("@ReturnValue",SqlDbType.Int)}; parameters[6].Direction = ParameterDirection.ReturnValue; SqlHelper.CacheParameters("Ziuziu.DBLayer.Area.Save", parameters); } parameters[0].Value = pArea.ID; parameters[1].Value = pArea.AreaName; parameters[2].Value = pArea.AreaCode; parameters[3].Value = pArea.Flag; parameters[4].Value = pArea.ShortName; parameters[5].Value = (int)pActionProvider; try { using (SqlConnection sqlConn = new SqlConnection(SqlHelper.ConnectionStringMain)) { sqlConn.Open(); SqlHelper.ExecuteNonQuery(sqlConn, CommandType.StoredProcedure, "Area_InsertUpdate", parameters); int Result = int.Parse(parameters[6].Value.ToString()); switch (Result) { case 0: return int.Parse(parameters[0].Value.ToString()); case -300: return -11; default: return -30; } } } catch (Exception ex) { //MyErrorXml.WiterErrorToXml(ex); return -31; } }
// �������� public int Batch(string pIDList, ActionProvider pActionProvider) { }
/// <summary> /// ������Ϣ /// </summary> public void Update(Article pArticleFullInfo, ActionProvider pActionProvider) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Article set "); strSql.Append("Title=@Title,"); strSql.Append("Content=@Content,"); strSql.Append("AddDate=@AddDate,"); strSql.Append("IP=@IP,"); strSql.Append("UserID=@UserID,"); strSql.Append("ClassID=@ClassID,"); strSql.Append("Summary=@Summary,"); strSql.Append("TotalHits=@TotalHits,"); strSql.Append("IsDraft=@IsDraft,"); strSql.Append("UpdateDate=@UpdateDate,"); strSql.Append("IsCheck=@IsCheck,"); strSql.Append("IsDelete=@IsDelete,"); strSql.Append("IsCommon=@IsCommon"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4), new SqlParameter("@Title", SqlDbType.NVarChar,100), new SqlParameter("@Content", SqlDbType.Text), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@IP", SqlDbType.NVarChar,50), new SqlParameter("@UserID", SqlDbType.Int,4), new SqlParameter("@ClassID", SqlDbType.Int,4), new SqlParameter("@Summary", SqlDbType.NVarChar,500), new SqlParameter("@TotalHits", SqlDbType.Int,4), new SqlParameter("@IsDraft", SqlDbType.Bit,1), new SqlParameter("@UpdateDate", SqlDbType.DateTime), new SqlParameter("@IsCheck", SqlDbType.Bit,1), new SqlParameter("@IsDelete", SqlDbType.Bit,1), new SqlParameter("@IsCommon", SqlDbType.Int,4)}; parameters[0].Value = model.ID; parameters[1].Value = model.Title; parameters[2].Value = model.Content; parameters[3].Value = model.AddDate; parameters[4].Value = model.IP; parameters[5].Value = model.UserID; parameters[6].Value = model.ClassID; parameters[7].Value = model.Summary; parameters[8].Value = model.TotalHits; parameters[9].Value = model.IsDraft; parameters[10].Value = model.UpdateDate; parameters[11].Value = model.IsCheck; parameters[12].Value = model.IsDelete; parameters[13].Value = model.IsCommon; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
public RequestBuilder Action(ActionProvider action) { actionProvider = action; return this; }