private void Content_Load(object sender, EventArgs e) { dg1.DataSource = DataHelper.xkfyData.Tables["BattleNeigong"].DefaultView; ToolsHelper tl = new ToolsHelper(); tl.updateCellName("BattleNeigong", dg1); }
private void dg1_CellClick(object sender, DataGridViewCellEventArgs e) { ToolsHelper tl = new ToolsHelper(); DataGridViewRow dv = dg1.CurrentRow; label3.Text = tl.ExplainTalkManager(dv); }
public IHttpActionResult Post(AirportManager manager) { try { var CorreoElectronico = manager.Email; var pass = manager.Password; mng.Create(manager); string Mensaje = "Estimado " + manager.FirstName + " " + manager.LastName + " <br/><br/> " + "Su contraseña de inicio es: " + pass; ToolsHelper.SendMail(CorreoElectronico, "Confirmación de cuenta", Mensaje); apiResp = new ApiResponse { Message = "Action was executed" }; return(Ok(apiResp)); } catch (BussinessException bex) { var MessageManage = new ApplicationMessageManagement(); MessageManage.Create(bex.AppMessage); return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } catch (Exception ex) { ApplicationMessage msg = new ApplicationMessage { Message = ex.Message }; var MessageManage = new ApplicationMessageManagement(); MessageManage.Create(msg); return(InternalServerError(new Exception(ex.Message))); } }
/// <summary> /// 复制版本包 实名认证文件 /// </summary> /// <param name="targetPath"></param> static void CopyVerPackgetFile(string targetPath) { string Path = Application.dataPath + "/GameFramework/SDK/VerPackageFile"; targetPath = targetPath.Remove(targetPath.Length - 1); ToolsHelper.CopyDirToDir(Path, targetPath); }
static void CopySDKFile(string targetPath) { string Path = Application.dataPath + SDKFilePath; targetPath = targetPath.Remove(targetPath.Length - 1); ToolsHelper.CopyDirToDir(Path, targetPath); }
/// <summary> /// 安卓工程整理 /// </summary> static void AndroidProjectArrangement(string TargetPath) { ToolsHelper.Log($"生成的工程路径:{TargetPath}"); string ScrPath = "src/main"; try { //把src/main/目录下jniLibs文件改成libs string JniLibsPath = Path.Combine(TargetPath, ScrPath, "jniLibs"); string JniLibsTargerPath = Path.Combine(TargetPath, ScrPath, "libs"); Directory.Move(JniLibsPath, JniLibsTargerPath); //复制src/main文件夹下所有文件到根目录 ToolsHelper.CopyDirToDir(Path.Combine(Path.Combine(TargetPath, ScrPath)), TargetPath.Remove(TargetPath.Length - 1)); //删除src/文件夹 Directory.Delete(Path.Combine(TargetPath, "src"), true); //java目录改成src目录 Directory.Move(Path.Combine(TargetPath, "java"), Path.Combine(TargetPath, "src")); //复制SDK文件 CopySDKFile(TargetPath); } catch (Exception e) { ToolsHelper.Error(e.Message); } }
private void button2_Click(object sender, EventArgs e) { ToolsHelper tl = new ToolsHelper(); string[] sRewardData = txtsRewardData.Text.Split('*'); lblExplain.Text = ExplainHelper.ExplainRewardData(sRewardData); }
private void InitUserTool(ToolsDesign toolDesign) { try { //先移除用户控件 toolStrip1.Items.Clear(); if (toolDesign.ToolsCfg.Count <= 0) { if (toolStrip1.Items.Count <= 0 && this.DesignMode == false) { toolStrip1.Visible = false; } return; } ToolsHelper.ConfigButtons(toolStrip1, toolDesign, DoUserToolEvent_StripItem); if (this.DesignMode == false) { toolStrip1.Visible = (toolStrip1.Items.Count <= 0) ? false : true; } } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
public void WhenDownloadTool_IfToolIsInTheConfig_ShouldTakePathFromConfig() { // Arrange var mockFileSystem = new Mock <IFileSystem>(MockBehavior.Strict); mockFileSystem.Setup(m => m.FileExists(@"mytool.exe")).Returns(false); mockFileSystem.Setup(m => m.GetExecutingAssemblyDirectory()).Returns(@"x:\somelocalpath"); mockFileSystem.Setup(m => m.DirectoryExists(@"x:\localpath")).Returns(false); mockFileSystem.Setup(m => m.DirectoryCreate(@"x:\localpath")); mockFileSystem.Setup(m => m.FileExists(@"x:\localpath\mytoolqq.exe")).Returns(true); mockFileSystem.Setup(m => m.FileExists(@"x:\sourcepathfromconfig\mytoolqq.exe")).Returns(true); mockFileSystem.Setup(m => m.FileGetLastWriteTime(@"x:\sourcepathfromconfig\mytoolqq.exe")).Returns(new DateTime(2000, 1, 1)); mockFileSystem.Setup(m => m.FileGetLastWriteTime(@"x:\localpath\mytoolqq.exe")).Returns(new DateTime(2000, 1, 1)); var mockEnvironmentSystem = new Mock <IEnvironmentSystem>(MockBehavior.Strict); mockEnvironmentSystem.Setup(m => m.ExpandEnvironmentVariables(@"x:\localpath")).Returns(@"x:\localpath"); TestEasyConfig.Instance.Tools.Tools.Add(new ToolElement { Name = "mytool.exe", Path = @"x:\sourcepathfromconfig\mytoolqq.exe" }); // Act var helper = new ToolsHelper(mockFileSystem.Object, mockEnvironmentSystem.Object, null); var result = helper.DownloadTool("mytool.exe", @"x:\sourcepath", @"x:\localpath"); // Assert Assert.Equal(@"x:\localpath\mytoolqq.exe", result); }
private void LoadDesign() { if (_wordModuleDesign.ToolsDesign.Visible == false) { toolStrip1.Visible = false; return; } if (_wordModuleDesign.ToolsDesign.Size > 0) { toolStrip1.Height = _wordModuleDesign.ToolsDesign.Size; } toolStrip1.Visible = true; toolStrip1.BackColor = _wordModuleDesign.ToolsDesign.BackColor; toolStrip1.ForeColor = _wordModuleDesign.ToolsDesign.ForceColor; toolStripTextBox1.Visible = _wordModuleDesign.ButWordLocateVisible; tsbFind.Visible = _wordModuleDesign.ButWordLocateVisible; tsbWrite.Visible = _wordModuleDesign.ButWordWriteVisible; if (_wordModuleDesign.ToolsDesign.ToolsCfg != null) { InitUserTool(_wordModuleDesign.ToolsDesign); } ToolsHelper.SyncDesignEventsByButtons(_wordModuleDesign.ToolsDesign, _designEvents); }
public void WhenDownloadTool_IfFirewallTrue_ShouldAddToolToFirewall() { // Arrange var mockFileSystem = new Mock <IFileSystem>(MockBehavior.Strict); mockFileSystem.Setup(m => m.FileExists(@"mytool.exe")).Returns(false); mockFileSystem.Setup(m => m.GetExecutingAssemblyDirectory()).Returns(@"x:\somelocalpath"); mockFileSystem.Setup(m => m.DirectoryExists(@"x:\localpathexpanded")).Returns(true); mockFileSystem.Setup(m => m.FileExists(@"x:\localpathexpanded\mytool.exe")).Returns(false); mockFileSystem.Setup(m => m.FileExists(@"x:\sourcepath\mytool.exe")).Returns(true); mockFileSystem.Setup(m => m.FileCopy(@"x:\sourcepath\mytool.exe", @"x:\localpathexpanded\mytool.exe", true)); var mockEnvironmentSystem = new Mock <IEnvironmentSystem>(MockBehavior.Strict); mockEnvironmentSystem.Setup(m => m.ExpandEnvironmentVariables(@"x:\localpath")).Returns(@"x:\localpathexpanded"); var mockProcessRunner = new Mock <IProcessRunner>(MockBehavior.Strict); mockProcessRunner.Setup(m => m.Start(It.Is <Process>( p => p.StartInfo.FileName == "netsh.exe" && p.StartInfo.Arguments == @"firewall add allowedprogram ""x:\localpathexpanded\mytool.exe"" TestEasyTool enable"))) .Returns(true); mockProcessRunner.Setup(m => m.WaitForExit(It.Is <Process>( p => p.StartInfo.FileName == "netsh.exe" && p.StartInfo.Arguments == @"firewall add allowedprogram ""x:\localpathexpanded\mytool.exe"" TestEasyTool enable"), 60000)) .Returns(true); // Act var helper = new ToolsHelper(mockFileSystem.Object, mockEnvironmentSystem.Object, mockProcessRunner.Object); var result = helper.DownloadTool("mytool.exe", @"x:\sourcepath", @"x:\localpath", true); // Assert Assert.Equal(@"x:\localpathexpanded\mytool.exe", result); }
public async Task <IHttpActionResult> IncIssueTool([FromBody] IncIssueModel data) { Code status = default(Code); dynamic response = null; int? userID = UserSessionState.UserID(data.token); if (userID.HasValue) { store.ToolsUses.Add(new ToolsUs() { ToolID = data.id, WorkerID = data.workerid, ManageWorkerID = store.Users.FirstOrDefault(u => u.WorkerID == userID.Value).WorkerID, Count = data.count * (data.isinc ? 1 : -1), CreationDate = DateTimeOffset.UtcNow.DateTime }); store.Audits.Add(new Audit() { Action = (int)(data.isinc ? ToolAction.Take : ToolAction.Issue), Count = data.count, Readed = false, ToolID = data.id, WorkerID = store.Users.FirstOrDefault(u => u.WorkerID == userID).WorkerID, CreationDate = DateTimeOffset.UtcNow.DateTime, }); store.SaveChanges(); response = Math.Abs(ToolsHelper.ToolStatByToolID(store, data.id)); } else { status = Code.AuthRequired; } return(Ok(ApiResponseManager.CreateResponse(new Status(status), response))); }
private void BattleAreaData_Edit_Load(object sender, EventArgs e) { Dictionary <string, TableExplain> dlc = new Dictionary <string, TableExplain>(); string path = Path.Combine(ToolsHelper.ExplainPath, _tableName + ".xml"); if (File.Exists(path)) { dlc = DataHelper.GetTableExplainList(path); } ToolsHelper tl = new ToolsHelper(); tl.CreateCtr(DataHelper.XkfyData.Tables[_tableName], gbDrop, _dr, dlc, 12); if (_type == "Modify") { //修改 DataHelper.CopyRowToData(this, _dr); btnUpdate.Visible = true; } else if (_type == "Add") { //新增 btnAdd.Visible = true; } else { //复制新增 DataHelper.CopyRowToData(this, _dr); btnAdd.Visible = true; } }
protected override List <object> GetAllData(dynamic data) { return(store .Categories .Where(c => !c.IsDeleted) .AsEnumerable() .Select(c => { dynamic expando = new ExpandoObject(); expando.id = c.CategoryID; expando.name = c.Name; expando.description = c.Description; expando.cellfrom = c.CellFrom; expando.cellto = c.CellTo; expando.toolpositions = c .Tools .Where(t => t.CategoryID == c.CategoryID && (!t.IsDeleted.HasValue || (t.IsDeleted.HasValue && !t.IsDeleted.Value))) .Count(); var tools = c .Tools .Where(t => t.CategoryID == c.CategoryID && (!t.IsDeleted.HasValue || (t.IsDeleted.HasValue && !t.IsDeleted.Value))) .ToList(); expando.toolscount = tools.Count > 0 ? tools.Select(t => t.Count).AsEnumerable().Sum() : 0; expando.candelete = ToolsHelper.ToolStatByCategoryID(store, c.CategoryID) == 0; return expando; }) .ToList <object>()); }
public ActionResult GuardarComprobantes(String id, String comprobanteId) { if (!String.IsNullOrEmpty(id)) { ToolsHelper th = new ToolsHelper(); ParametrosHelper ph = new ParametrosHelper(); Parametro parametro = ph.getParameterByKey("COMPRUTA"); String destino = parametro.valorString.Trim() + comprobanteId.Trim(); String fileName = th.cargarArchivo(Request.Files, destino); int idTemp = int.Parse(id.Trim()); Pago pago = db.Pagos.Find(idTemp); if (comprobanteId.Trim().Equals("CL")) { pago.comprobantePago = fileName.Trim(); } else if (comprobanteId.Trim().Equals("RL")) { pago.resumenLiquidacion = fileName.Trim(); } else { pago.cedulaAutodeterminacion = fileName.Trim(); } db.Entry(pago).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); }
private void BattleCondition_Load(object sender, EventArgs e) { this.dg1.DataSource = DataHelper.xkfyData.Tables["BattleCondition"].DefaultView; ToolsHelper tl = new ToolsHelper(); tl.updateCellName("BattleCondition", dg1); }
public void WhenDownloadTool_IfSourcePathProvidedAndTargetPathProvided_ShouldUseThem() { // Arrange var mockFileSystem = new Mock <IFileSystem>(MockBehavior.Strict); mockFileSystem.Setup(m => m.FileExists(@"mytool.exe")).Returns(false); mockFileSystem.Setup(m => m.GetExecutingAssemblyDirectory()).Returns(@"x:\somelocalpath"); mockFileSystem.Setup(m => m.DirectoryExists(@"x:\localpath")).Returns(true); mockFileSystem.Setup(m => m.FileExists(@"x:\localpath\mytool.exe")).Returns(true); mockFileSystem.Setup(m => m.FileExists(@"x:\sourcepath\mytool.exe")).Returns(true); mockFileSystem.Setup(m => m.FileGetLastWriteTime(@"x:\sourcepath\mytool.exe")).Returns(new DateTime(2000, 1, 1)); mockFileSystem.Setup(m => m.FileGetLastWriteTime(@"x:\localpath\mytool.exe")).Returns(new DateTime(2000, 1, 1)); var mockEnvironmentSystem = new Mock <IEnvironmentSystem>(MockBehavior.Strict); mockEnvironmentSystem.Setup(m => m.ExpandEnvironmentVariables(@"x:\localpath")).Returns(@"x:\localpath"); TestEasyConfig.Instance.Tools.DefaultLocalToolsPath = @"x:\localpath"; // Act var helper = new ToolsHelper(mockFileSystem.Object, mockEnvironmentSystem.Object, null); var result = helper.DownloadTool("mytool.exe", @"x:\sourcepath", @"x:\localpath"); // Assert Assert.Equal(@"x:\localpath\mytool.exe", result); }
public IHttpActionResult UpdateAndSendEmailRejected(AirlineManager manager) { try { var CorreoElectronico = manager.Email; var pass = manager.Password; mng.Update(manager); string Mensaje = "Estimado " + manager.FirstName + " " + manager.LastName + " lamentamos informarle que su aerolínea ha sido rechazada por nuestra administración"; ToolsHelper.SendMail(CorreoElectronico, "Denegación de cuenta", Mensaje); apiResp = new ApiResponse { Message = "Action was executed." }; return(Ok(apiResp)); } catch (BussinessException bex) { var MessageManage = new ApplicationMessageManagement(); MessageManage.Create(bex.AppMessage); return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } catch (Exception ex) { ApplicationMessage msg = new ApplicationMessage { Message = ex.Message }; var MessageManage = new ApplicationMessageManagement(); MessageManage.Create(msg); return(InternalServerError(new Exception(ex.Message))); } }
public ActionResult Create(Manager model) { var jm = new JsonWithUIcallback(); try { if (ModelState.IsValid) { model.Password = ToolsHelper.Md5(model.Password); model.AddTime = DateTime.Now; var bl = _bll.Insert(model) > 0; jm.statusCode = bl ? 200 : 300; jm.message = (bl ? KeyWordsHelper.CreateSuccess : KeyWordsHelper.CreateFailure); jm.closeCurrent = bl; jm.tabid = bl ? "ManagerList" : ""; } else { jm.message = KeyWordsHelper.DataParameterError; } } catch (Exception ex) { ComToolsController.AddtxtLog(ex, "创建提交", EnumHelper.Nlog.Error.ToString()); jm.statusCode = 300; jm.message = ex.ToString(); jm.closeCurrent = true; } return(Json(jm)); }
private void LoadDesign() { if (_chrModuleDesign.ToolsDesign.Visible == false) { toolStrip1.Visible = false; return; } if (_chrModuleDesign.ToolsDesign.Size > 0) { toolStrip1.Height = _chrModuleDesign.ToolsDesign.Size; } toolStrip1.Visible = true; toolStrip1.BackColor = _chrModuleDesign.ToolsDesign.BackColor; toolStrip1.ForeColor = _chrModuleDesign.ToolsDesign.ForceColor; tsbConfig.Visible = _chrModuleDesign.ButSettingVisible; if (_chrModuleDesign.ToolsDesign.ToolsCfg != null) { InitUserTool(_chrModuleDesign.ToolsDesign); } ToolsHelper.SyncDesignEventsByButtons(_chrModuleDesign.ToolsDesign, _designEvents); }
private void ItemData_Load(object sender, EventArgs e) { dg1.DataSource = DataHelper.XkfyData.Tables["ItemData"].DefaultView; ToolsHelper tl = new ToolsHelper(); tl.UpdateCellName("ItemData", dg1); }
private void btnSelMsgStr_Click(object sender, EventArgs e) { string[] row = new string[3] { "iID", "sString", "xUse" }; ToolsHelper.OpenRadioForm("String_table", row, txtMsgStr, txtMsgString); }
private void button2_Click(object sender, EventArgs e) { ToolsHelper tl = new ToolsHelper(); string[] sRewardData = txtsRewardData.Text.Split('*'); lblExplain.Text = tl.ExplainRewardData(sRewardData, DataHelper.DdlDataSet.Tables["TalkManager.iGtype"]); }
public ActionResult BatchDelete(string delids) { var jm = new JsonWithUIcallback(); try { if (string.IsNullOrEmpty(delids)) { jm.message = KeyWordsHelper.DataParameterError; } else { var idintarr = ToolsHelper.StringToIntArray(delids); var bl = _bll.Delete(p => p.Id.In(idintarr) && p.Username != "admin") > 0; jm.statusCode = bl ? 200 : 300; jm.message = bl ? KeyWordsHelper.DeleteSuccess : KeyWordsHelper.DeleteFailure; } } catch (Exception ex) { ComToolsController.AddtxtLog(ex, "批量删除", EnumHelper.Nlog.Error.ToString()); jm.message = KeyWordsHelper.DataHandleEx; } return(Json(jm)); }
private void btnAdd_Click(object sender, EventArgs e) { int rowIndex = 0; if (!string.IsNullOrEmpty(txtIndexSn.Text)) { try { rowIndex = Convert.ToInt16(txtIndexSn.Text); } catch { MessageBox.Show("必须填入数字"); return; } } ToolsHelper th = new ToolsHelper(); //th.addData(this, "TalkManager"); DataRow dr = DataHelper.XkfyData.Tables["TalkManager"].NewRow(); DataHelper.CopyDataToRow(this, dr); if (string.IsNullOrEmpty(dr["rowState"].ToString())) { dr["rowState"] = "1"; } DataHelper.XkfyData.Tables["TalkManager"].Rows.InsertAt(dr, rowIndex); this.Close(); }
private void button4_Click(object sender, EventArgs e) { string[] row = new string[2] { "iRID", "sRewardData" }; string tbName = "RewardData"; ToolsHelper.OpenRadioForm(tbName, row, txtRewardFale, null); }
public ActionResult LoginMin(Manager model) { var jm = new JsonWithUIcallback(); try { var bll = new Dal.Manager(); if (string.IsNullOrEmpty(model.Username) || string.IsNullOrEmpty(model.Password)) { jm.message = "请输入用户名和密码!"; return(Json(jm)); } var md5Pwd = ToolsHelper.Md5(model.Password); var manager = bll.QueryToEnetity(p => p.Username == model.Username && p.Password == md5Pwd); if (manager == null) { jm.message = "账户密码错误!"; return(Json(jm)); } //写入数据库日志 var mlog = new ManagerLog { UserId = manager.Id, UserName = manager.Username, ActionType = "Login", AddTime = DateTime.Now, Remark = "后台管理登录", UserIp = RequestHelper.GetIp() }; new Dal.ManagerLog().Insert(mlog); //修改登录时间 manager.LastLoginTime = DateTime.Now; bll.Update(manager); //写入session System.Web.HttpContext.Current.Session.Timeout = 20; System.Web.HttpContext.Current.Session[KeyWordsHelper.SessionManager] = manager; //写入cookie CookieHelper.Set("AdminName", model.Username, 1200); CookieHelper.Set("AdminPwd", md5Pwd, 1200); jm.statusCode = 200; jm.message = "登录成功!"; //jm.forward = "/Admins/Panel/"; jm.closeCurrent = true; return(Json(jm)); } catch (Exception ex) { ComToolsController.AddtxtLog(ex, model.Username + "登录", "Login"); jm.message = "数据异常"; } return(Json(jm)); }
private void btnMustJoin_Click(object sender, EventArgs e) { string[] row = new string[3] { "CharID", "Name", "HP" }; string tbName = "BattleCharacterData"; ToolsHelper.OpenMultiForm(tbName, row, txtMustJoin, null); }
private void dg1_CellClick(object sender, DataGridViewCellEventArgs e) { lblMsg.Text = ""; int index = dg1.CurrentRow.Index; string id = dg1.Rows[index].Cells[0].Value.ToString(); ToolsHelper tl = new ToolsHelper(); lblExplain.Text = tl.ExplainNeiGong(id); }
public ActionResult DeleteConfirmed(int id) { ToolsHelper th = new ToolsHelper(); ArchivoEmpleado archivosEmpleado = db.ArchivoEmpleadoes.Find(id); th.BorrarArchivo(archivosEmpleado.archivo.Trim()); db.ArchivoEmpleadoes.Remove(archivosEmpleado); db.SaveChanges(); return(RedirectToAction("Index")); }