// 修改 public ResultEntity <int> UpdateFormLibrary(FormLibrary uie) { ResultEntity <int> result; try { int IntRet = 0; var repResult = dal.Update <FormLibrary>(uie); if (repResult) { IntRet = 1; } if (IntRet > 0) { result = new ResultEntity <int>(true, ConstantDefine.TipSaveSuccess, IntRet); } else { result = new ResultEntity <int>(ConstantDefine.TipSaveFail); } } catch (Exception ex) { Loger.LogErr(ex); result = new ResultEntity <int>(ex.Message); } return(result); }
// 添加 public ResultEntity <int> InsertFormLibrary(FormLibrary uie) { ResultEntity <int> result; try { int IntRet = 0; var repResult = dal.Insert <FormLibrary>(uie); if (repResult != null) { IntRet = int.Parse(repResult.ToString()); } if (IntRet > 0) { result = new ResultEntity <int>(true, ConstantDefine.TipSaveSuccess, IntRet); } else { result = new ResultEntity <int>(ConstantDefine.TipSaveFail); } } catch (Exception ex) { Loger.LogErr(ex); result = new ResultEntity <int>(ex.Message); } return(result); }
private void libraryButton_Click(object sender, EventArgs e)//查阅馆内藏书 { FormLibrary formLibrary = new FormLibrary(this, currentClient); this.Hide(); formLibrary.ShowDialog(); }
public ActionResult SaveFormLibrary(FormLibrary entity) { ResponseEntity <int> response; if (entity.Id == 0) { var list = new FormLibraryBLL().GetDataByName(entity.Name); if (list != null && list.Count > 0) { return(Json(new ResponseEntity <object>(-999, "±íµ¥ÒÑ´æÔÚ", ""), JsonRequestBehavior.AllowGet)); } entity.IsDelete = 0; entity.CreateBy = ""; entity.CreateTime = DateTime.Now; entity.UpdateBy = ""; entity.UpdateTime = DateTime.Now; var result = new FormLibraryBLL().InsertFormLibrary(entity); response = new ResponseEntity <int>(result.Success, result.Message, result.Data); new LogBLL().LogEvent(CurrenUserInfo.LoginName, GDS.Entity.Constant.ConstantDefine.ModuleBaseData, GDS.Entity.Constant.ConstantDefine.TypeAdd, GDS.Entity.Constant.ConstantDefine.ActionSaveFormLibrary, $"{result.Data}"); } else { entity.UpdateBy = ""; entity.UpdateTime = DateTime.Now; var result = new FormLibraryBLL().UpdateFormLibrary(entity); response = new ResponseEntity <int>(result.Success, result.Message, result.Data); new LogBLL().LogEvent(CurrenUserInfo.LoginName, GDS.Entity.Constant.ConstantDefine.ModuleBaseData, GDS.Entity.Constant.ConstantDefine.TypeUpdate, GDS.Entity.Constant.ConstantDefine.ActionUpdateFormLibrary, $"{entity.Id}"); } return(Json(response, JsonRequestBehavior.AllowGet)); }
public GalaxyScene(IGalaxyViewListener galaxyViewListener, Action mainMenuCallback) { this.galaxyViewListener = galaxyViewListener; this.reportOpener = new OpenReportVisitor(showDevelopment, showResearch); var mainMenuButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.MainMenu, Padding = 4, ClickCallback = mainMenuCallback, Tooltip = new SimpleTooltip("GalaxyScene", "MainMenuTooltip") }; mainMenuButton.Position.FixedSize(36, 32).ParentRelative(-1, 1).WithMargins(5, 5); this.AddElement(mainMenuButton); this.fuelInfo = new GuiText { TextColor = Color.Yellow, TextHeight = 24, Tooltip = new SimpleTooltip("GalaxyScene", "FuelTooltip") }; this.fuelInfo.Position.WrapContent().Then.RelativeTo(mainMenuButton, 1, 0, -1, 0).WithMargins(20, 5); this.AddElement(this.fuelInfo); var designButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Design, PaddingX = 12, PaddingY = 4, ClickCallback = () => { using (var form = new FormShipDesignList(this.currentPlayer)) form.ShowDialog(); }, Tooltip = new SimpleTooltip("GalaxyScene", "DesignTooltip") }; designButton.Position.FixedSize(48, 32).RelativeTo(fuelInfo, 1, 0, -1, 0).WithMargins(20, 5); this.AddElement(designButton); var developmentButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Development, PaddingX = 12, PaddingY = 4, ClickCallback = this.showDevelopment, Tooltip = new SimpleTooltip("GalaxyScene", "DevelopmentTooltip") }; developmentButton.Position.FixedSize(48, 32).RelativeTo(designButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(developmentButton); var researchButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Research, PaddingX = 12, PaddingY = 4, ClickCallback = this.showResearch, Tooltip = new SimpleTooltip("GalaxyScene", "ResearchTooltip") }; researchButton.Position.FixedSize(48, 32).RelativeTo(developmentButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(researchButton); var diplomacyButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Diplomacy, PaddingX = 12, PaddingY = 4, ClickCallback = () => { using (var form = new FormRelations(this.currentPlayer)) form.ShowDialog(); }, Tooltip = new SimpleTooltip("GalaxyScene", "DiplomacyTooltip") }; diplomacyButton.Position.FixedSize(48, 32).RelativeTo(researchButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(diplomacyButton); var colonizationButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Colonization, PaddingX = 12, PaddingY = 4, ClickCallback = () => { using (var form = new FormColonization(this.currentPlayer)) form.ShowDialog(); }, Tooltip = new SimpleTooltip("GalaxyScene", "ColonizationTooltip") }; colonizationButton.Position.FixedSize(48, 32).RelativeTo(diplomacyButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(colonizationButton); var reportsButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Reports, PaddingX = 12, PaddingY = 4, ClickCallback = () => { using (var form = new FormReports(this.currentPlayer.Reports)) if (form.ShowDialog() == DialogResult.OK) { form.Result.Accept(this.reportOpener); } }, Tooltip = new SimpleTooltip("GalaxyScene", "ReportsTooltip") }; reportsButton.Position.FixedSize(48, 32).RelativeTo(colonizationButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(reportsButton); var stareaterButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Stareater, PaddingX = 12, PaddingY = 4, ClickCallback = () => { using (var form = new FormStareater(this.currentPlayer.Stareater)) form.ShowDialog(); }, Tooltip = new SimpleTooltip("GalaxyScene", "StareaterTooltip") }; stareaterButton.Position.FixedSize(48, 32).RelativeTo(reportsButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(stareaterButton); var libraryButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), ForgroundImage = GalaxyTextures.Get.Library, PaddingX = 12, PaddingY = 4, ClickCallback = () => { using (var form = new FormLibrary(this.currentPlayer.Library)) form.ShowDialog(); }, Tooltip = new SimpleTooltip("GalaxyScene", "LibraryTooltip") }; libraryButton.Position.FixedSize(48, 32).RelativeTo(stareaterButton, 1, 0, -1, 0).WithMargins(5, 5); this.AddElement(libraryButton); this.turnCounter = new GuiText { TextColor = Color.LightGray, TextHeight = 24 }; this.turnCounter.Position.WrapContent().Then.ParentRelative(1, 1).WithMargins(10, 5); this.AddElement(this.turnCounter); var turnButton = new GuiButton { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.EndTurnHover, 0), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.EndTurnNormal, 0), ClickCallback = this.galaxyViewListener.TurnEnded, Tooltip = new SimpleTooltip("GalaxyScene", "EndTurn") }; turnButton.Position.FixedSize(80, 80).ParentRelative(1, -1).WithMargins(10, 10); this.AddElement(turnButton); var radarToggle = new ToggleButton(SettingsWinforms.Get.ShowScanRange) { BackgroundHover = new BackgroundTexture(GalaxyTextures.Get.ToggleHover, 7), BackgroundNormal = new BackgroundTexture(GalaxyTextures.Get.ToggleNormal, 7), BackgroundToggled = new BackgroundTexture(GalaxyTextures.Get.ToggleToggled, 7), ForgroundImage = new BackgroundTexture(GalaxyTextures.Get.Radar, 0), ToggleCallback = this.toggleRadar, Tooltip = new SimpleTooltip("GalaxyScene", "RadarSwitchToolip") }; radarToggle.Position.FixedSize(24, 24).RelativeTo(turnButton, -1, 1, 1, 1).WithMargins(15, 0); this.AddElement(radarToggle); this.starInfo = new ConstructionSiteView(); this.starInfo.Position.ParentRelative(0, -1).WithMargins(0, 0); this.AddElement(this.starInfo); }
/// <summary> /// 更新费用类别 /// </summary> /// <param name="cInfo">实体</param> public void Update(WuliaoInputInfo cInfo) { if (string.IsNullOrEmpty(cInfo.ID)) { throw new ArgumentNullException("参数ID不能为空。"); } // 加载报表之前的状态,如果状态一致,则直接更新,否则保存到文档库 WuliaoInputInfo preInfo = GetByID(cInfo.ID); if (preInfo.ReportTypeID == cInfo.ReportTypeID) { dal.Update(cInfo); return; } if (preInfo.ReportTypeID == "1") { // 之前为预估输入存入文档库 string formID = new FormLibrary<WuliaoInputInfo>().Add(preInfo); cInfo.PreestimateFormID = formID; } if (preInfo.ReportTypeID == "2") { // 之前为预估输入存入文档库 string formID = new FormLibrary<WuliaoInputInfo>().Add(preInfo); cInfo.AmendFormID = formID; } dal.Update(cInfo); }