/// <summary> /// 删除 /// </summary> public override void EntityDelete() { WindowMenuRule rule = new WindowMenuRule(); WindowMenu entity = EntityGet(); rule.RDelete(entity); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private WindowMenu EntityGet() { WindowMenu entity = new WindowMenu(); entity.ID = HTDataID; return(entity); }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { WindowMenu entity = new WindowMenu(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); txtWinListID.Text = entity.WinListID.ToString(); txtName.Text = entity.Name.ToString(); txtParentID.Text = entity.ParentID.ToString(); txtSort.Text = entity.Sort.ToString(); txtHttFlag.Text = entity.HttFlag.ToString(); txtShowFlag.Text = entity.ShowFlag.ToString(); txtSystemTypeID.Text = entity.SystemTypeID.ToString(); txtShortCutChar.Text = entity.ShortCutChar.ToString(); txtHeadTypeID.Text = entity.HeadTypeID.ToString(); txtSubTypeID.Text = entity.SubTypeID.ToString(); txtModuleFlowID.Text = entity.ModuleFlowID.ToString(); txtMenuTypeID.Text = entity.MenuTypeID.ToString(); txtUseTypeID.Text = entity.UseTypeID.ToString(); if (!findFlag) { } }
private void ShowMenu(object sender, RoutedEventArgs e) { this.Opacity = 0.4; this.Effect = new BlurEffect(); WindowMenu w = new WindowMenu(mSinglePet, mMoney, mFreeHour, mCurrentDay, dailyChoiceSpecialAvailable) { Owner = this.Parent as Window, ShowInTaskbar = false }; if (w.ShowDialog() == false) { string command = w.command; this.Opacity = 1; this.Effect = null; (Parent as Window).ShowInTaskbar = true; if (command == "Restart") { RestartGame(); } else if (command == "Main menu") { (Parent as Window).Content = new UserControlMainWindow(); } else if (command == "Exit") { } } }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { WindowMenu MasterEntity = (WindowMenu)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Sys_WindowMenu WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { WindowMenuRule rule = new WindowMenuRule(); WindowMenu entity = EntityGet(); rule.RAdd(entity); return(entity.ID); }
protected virtual void OnWindowMenuOpening(object sender, RoutedEventArgs e) { MenuItem WindowMenu; if ((WindowMenu = sender as MenuItem) != null) { MenuItem ListWindowMenu = WindowMenu.FindName("ListWindowsMenu") as MenuItem; if (ListWindowMenu != null) { int WindowListIndex = WindowMenu.Items.IndexOf(ListWindowMenu); if (WindowListIndex > 0) { int FirstWindow = WindowListIndex - 1; while (FirstWindow > 0 && !(WindowMenu.Items[FirstWindow] is Separator)) { FirstWindow--; } FirstWindow++; for (int i = 0; i < WindowListIndex - FirstWindow; i++) { WindowMenu.Items.RemoveAt(FirstWindow); } if (OpenDocuments != null) { int i = 0; foreach (IDocument Document in OpenDocuments) { MenuItem NewWindowItem = new MenuItem(); NewWindowItem.Header = (i + 1).ToString(CultureInfo.CurrentCulture) + " " + Document.Path.HeaderName + (Document.IsDirty ? "*" : ""); NewWindowItem.DataContext = Document; NewWindowItem.Click += OnSelectWindowMenuClicked; if (Document == ActiveDocument) { NewWindowItem.IsChecked = true; } WindowMenu.Items.Insert(FirstWindow + i, NewWindowItem); if (++i >= 10) { break; } } } } } } }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WindowMenu entity = (WindowMenu)p_BE; WindowMenuCtl control = new WindowMenuCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WindowMenu entity = (WindowMenu)p_BE; WindowMenuCtl control = new WindowMenuCtl(sqlTrans); //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Sys_WindowMenu,sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
private void TradeButton_PreviewMouseDown(object sender, MouseButtonEventArgs e) { Button button = (Button)sender; Point coord = button.TransformToAncestor(_mainWindow).Transform(new Point(0, 0)); double left = _mainWindow.Left + coord.X; double top = _mainWindow.Top + coord.Y + button.Height; // CKernelTerminal.GetViewModelDispatcherInstance().OpenChildWindow _mainWindow.Topmost = false; Thread thread = new Thread(() => { _windowMenu = new WindowMenu(_mainWindow); _windowMenu.GUIDispMainWindow = _mainWinDispatcher; _windowMenu.Left = left; _windowMenu.Top = top; //_windowMenu. Window win = (Window)_windowMenu; _windowMenu.Show(); System.Windows.Threading.Dispatcher.Run(); } ); thread.SetApartmentState(ApartmentState.STA); thread.Start(); // (new Thread(ThreadTrackMouse)).Start(); //CUtilWin.ShowActivated(ref win); //win.Focus(); // wm.Show(); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private WindowMenu EntityGet() { WindowMenu entity = new WindowMenu(); entity.ID = HTDataID; entity.SelectByID(); entity.WinListID = SysConvert.ToInt32(txtWinListID.Text.Trim()); entity.Name = txtName.Text.Trim(); entity.ParentID = SysConvert.ToInt32(txtParentID.Text.Trim()); entity.Sort = SysConvert.ToInt32(txtSort.Text.Trim()); entity.HttFlag = SysConvert.ToInt32(txtHttFlag.Text.Trim()); entity.ShowFlag = SysConvert.ToInt32(txtShowFlag.Text.Trim()); entity.SystemTypeID = SysConvert.ToInt32(txtSystemTypeID.Text.Trim()); entity.ShortCutChar = txtShortCutChar.Text.Trim(); entity.HeadTypeID = SysConvert.ToInt32(txtHeadTypeID.Text.Trim()); entity.SubTypeID = SysConvert.ToInt32(txtSubTypeID.Text.Trim()); entity.ModuleFlowID = SysConvert.ToInt32(txtModuleFlowID.Text.Trim()); entity.MenuTypeID = SysConvert.ToInt32(txtMenuTypeID.Text.Trim()); entity.UseTypeID = SysConvert.ToInt32(txtUseTypeID.Text.Trim()); return(entity); }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { WindowMenu entity = (WindowMenu)p_BE; }
public static extern int DeleteMenu(this IntPtr systemMenu, WindowMenu menu, int flags = 0x0);
/// <summary> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { WindowMenu MasterEntity = (WindowMenu)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO Sys_WindowMenu("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("WinListID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WinListID) + ","); MasterField.Append("Name" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Name) + ","); MasterField.Append("ParentID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ParentID) + ","); MasterField.Append("Sort" + ","); if (MasterEntity.Sort != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.Sort) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("HttFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.HttFlag) + ","); MasterField.Append("ShowFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ShowFlag) + ","); MasterField.Append("SystemTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SystemTypeID) + ","); MasterField.Append("ShortCutChar" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ShortCutChar) + ","); MasterField.Append("HeadTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.HeadTypeID) + ","); MasterField.Append("SubTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SubTypeID) + ","); MasterField.Append("SubmitFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ","); MasterField.Append("AuditFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.AuditFlag) + ","); MasterField.Append("ModuleFlowID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ModuleFlowID) + ","); MasterField.Append("MenuTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MenuTypeID) + ","); MasterField.Append("UseTypeID" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.UseTypeID) + ")"); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { WindowMenu MasterEntity = (WindowMenu)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE Sys_WindowMenu SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" WinListID=" + SysString.ToDBString(MasterEntity.WinListID) + ","); UpdateBuilder.Append(" Name=" + SysString.ToDBString(MasterEntity.Name) + ","); UpdateBuilder.Append(" ParentID=" + SysString.ToDBString(MasterEntity.ParentID) + ","); if (MasterEntity.Sort != 0) { UpdateBuilder.Append(" Sort=" + SysString.ToDBString(MasterEntity.Sort) + ","); } else { UpdateBuilder.Append(" Sort=null,"); } UpdateBuilder.Append(" HttFlag=" + SysString.ToDBString(MasterEntity.HttFlag) + ","); UpdateBuilder.Append(" ShowFlag=" + SysString.ToDBString(MasterEntity.ShowFlag) + ","); UpdateBuilder.Append(" SystemTypeID=" + SysString.ToDBString(MasterEntity.SystemTypeID) + ","); UpdateBuilder.Append(" ShortCutChar=" + SysString.ToDBString(MasterEntity.ShortCutChar) + ","); UpdateBuilder.Append(" HeadTypeID=" + SysString.ToDBString(MasterEntity.HeadTypeID) + ","); UpdateBuilder.Append(" SubTypeID=" + SysString.ToDBString(MasterEntity.SubTypeID) + ","); UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ","); UpdateBuilder.Append(" AuditFlag=" + SysString.ToDBString(MasterEntity.AuditFlag) + ","); UpdateBuilder.Append(" ModuleFlowID=" + SysString.ToDBString(MasterEntity.ModuleFlowID) + ","); UpdateBuilder.Append(" MenuTypeID=" + SysString.ToDBString(MasterEntity.MenuTypeID) + ","); UpdateBuilder.Append(" UseTypeID=" + SysString.ToDBString(MasterEntity.UseTypeID)); UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }