//通知信息 public override void ProcessNotify() { WxPayData notifyData = GetNotifyData(); Log4netHelper.Get(KeyModel.Log.PayNotification).AsyncWriter(notifyData.ToJson()); //检查支付结果中transaction_id是否存在 if (!notifyData.IsSet("transaction_id")) { //若transaction_id不存在,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中微信订单号不存在"); context.Response.Write(res.ToXml()); context.Response.End(); } string transaction_id = notifyData.GetValue("transaction_id").ToString(); string tradeNo = StringHelper.Get(notifyData.GetValue("out_trade_no")); decimal moneyValue = DecimalHelper.Get(notifyData.GetValue("total_fee")) / 100; string rechrageRecordId = ""; bool isFunction = false; if (QueryOrder(transaction_id)) { //执执判断是否执行成功 isFunction = fun(tradeNo, moneyValue, rechrageRecordId); } if (!isFunction) { WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); context.Response.Write(res.ToXml()); context.Response.End(); } else { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "订单查询失败"); context.Response.Write(res.ToXml()); context.Response.End(); } }
public static bool SaveBox(YKBoxInfo box) { if (SysConfig.IsTest) { return(true); } try { string sql = string.Format(@" delete from YKBox where HU='{0}' delete from YKBoxDetail where HU='{0}'", box.Hu); string sql1 = string.Format(@"INSERT INTO dbo.YKBox( Hu ,Source , Target , Status , Remark , Timestamps , EquipHla , EquipXindeco , IsHandover , IsFull , SubUser,SapStatus,SapRemark,LouCeng,PackMat,LIFNR) VALUES ( '{0}' , '{1}' , '{2}' , '{3}' , '{4}' , GETDATE() , '{5}' , '{6}' , {7} , {8} , '{9}','{10}','{11}','{12}','{13}','{14}')", box.Hu, box.Source, box.Target, box.Status, box.Remark, box.EquipHla, box.EquipXindeco, box.IsHandover, box.IsFull, box.SubUser, box.SapStatus, box.SapRemark.Replace("'", ""), box.LouCeng, box.PackMat, box.LIFNR); string sql2 = ""; if (box.Details != null && box.Details.Count > 0) { sql2 = string.Format(@" INSERT INTO dbo.YKBoxDetail( Hu , Epc , Matnr , Zsatnr , Zcolsn , Zsiztx , Timestamps , Barcd, IsAdd) VALUES"); foreach (YKBoxDetailInfo item in box.Details) { string sonsql = string.Format(@"('{0}','{1}','{2}','{3}','{4}','{5}',GETDATE() ,'{6}',{7}),", item.Hu, item.Epc, item.Matnr, item.Zsatnr, item.Zcolsn, item.Zsiztx, item.Barcd, item.IsAdd); sql2 += sonsql; } if (sql2.EndsWith(",")) { sql2 = sql2.Remove(sql2.Length - 1, 1); } } return(DBHelper.ExecuteNonQuery(sql + " " + sql1 + " " + sql2) > 0); } catch (Exception ex) { Log4netHelper.LogError(ex); } return(true); }
public void Save(object sender, EventArgs e) { try { SendKeys.SendWait("{ENTER}"); if (tabControl1.SelectedTabIndex == 0) { for (int i = 0; i < dataGridViewX1.Rows.Count; i++) { if (!string.IsNullOrEmpty(dataGridViewX1.Rows[i].Cells[1].ErrorText)) { UIHelper.ToastNotify(false, "保存失败,正式生产表中存在不合理数据,请重新检查!", tabControl1); Log4netHelper.Error(this.GetType(), string.Format("正式生产表中存在不合理数据,请重新检查!第{0}行,第{1}列,原因是:{2}", i, 1, dataGridViewX1.Rows[i].Cells[1].ErrorText)); return; } } DataTable formal_dt = ((DataTable)dataGridViewX1.DataSource).Copy(); StringBuilder Formal_strconn = DgdDealHelper.GetCombineInfo(formal_dt); sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("update {0} set sgelasticinfo='{1}' where sgelasticbom='{2}' and generic_assembly='{3}'", Constant.Elastic_sqlname, Formal_strconn, ElasticBOM_str, Assembly_str), null); DgdDealHelper.Deal_DifDgdValue(this.Text, NotModify_dt1, dataGridViewX1, "正式表"); NotModify_dt1 = formal_dt; UIHelper.ToastNotify(true, "已提交,正式表数据保存成功!", tabControl1); } else { for (int j = 0; j < dataGridViewX2.Rows.Count; j++) { if (!string.IsNullOrEmpty(dataGridViewX2.Rows[j].Cells[1].ErrorText)) { UIHelper.ToastNotify(false, "保存失败,样机生产表中存在不合理数据,请重新检查!", tabControl1); Log4netHelper.Error(this.GetType(), string.Format("样机生产表中存在不合理数据,请重新检查!第{0}行,第{1}列,原因是:{2}", j, 1, dataGridViewX1.Rows[j].Cells[1].ErrorText)); return; } } DataTable test_dt = ((DataTable)dataGridViewX2.DataSource).Copy(); StringBuilder Test_strconn = DgdDealHelper.GetCombineInfo(test_dt); sqlconnection.ExecuteDataTable(Constant.strConnectSQL_T, CommandType.Text, string.Format("update {0} set sgelasticinfo_test='{1}' where sgelasticbom='{2}' and generic_assembly='{3}'", Constant.Elastic_sqlname, Test_strconn, ElasticBOM_str, Assembly_str), null); DgdDealHelper.Deal_DifDgdValue(this.Text, NotModify_dt2, dataGridViewX2, "样机表"); NotModify_dt2 = test_dt; UIHelper.ToastNotify(true, "已提交,样机表数据保存成功!", tabControl1); } } catch (Exception ex) { MessageBox.Show("保存时发生异常:" + ex.Message); } }
public void showErrorInfo(List <TagDetailInfo> tags, string errormsg) { try { if (string.IsNullOrEmpty(errormsg)) { return; } if (!Visible) { Show(); TopMost = true; } if (tags == null) { dataGridView1_showGrid.Rows.Insert(0, "", "", "", "", errormsg); return; } if (tags.Count > 0) { List <string> matrList = tags.Select(i => i.MATNR).Distinct().ToList(); foreach (string mtr in matrList) { TagDetailInfo tg = tags.First(j => j.MATNR == mtr); dataGridView1_showGrid.Rows.Insert(0 , tg != null ? tg.ZSATNR : "" , tg != null ? tg.ZCOLSN : "" , tg != null ? tg.ZSIZTX : "" , tags.Count(i => i.MATNR == mtr && !i.IsAddEpc) , errormsg); } } else { dataGridView1_showGrid.Rows.Insert(0, "", "", "", "", errormsg); } CommonService.playSound(2); } catch (Exception ex) { Log4netHelper.LogError(ex); } }
/// <summary> /// Log the mcdonalds AM API exception. /// </summary> /// <param name="apiRetAMObject">The API ret am object.</param> /// <param name="isNeedThrowException">if set to <c>true</c> [is need throw exception].</param> /// <exception cref="System.Exception"></exception> private void LogMCDAMApiException(MCDAMReturnObject apiRetAMObject, bool isNeedThrowException = false) { if (!string.IsNullOrEmpty(apiRetAMObject.ErrorMessage)) { string _msgTemplate = @"ErrorMessage: {0} \r\n InnerErrorMessage: {1} \r\n StackTrace: {2}"; _msgTemplate = string.Format(_msgTemplate, apiRetAMObject.ErrorMessage, apiRetAMObject.InnerErrorMessage, apiRetAMObject.StackTrace); Log4netHelper.WriteErrorLog(_msgTemplate); if (isNeedThrowException) { throw new Exception(_msgTemplate); } } }
public static RenewalToolWriteOffAndReinCost Get(string projectId, Guid toolId, NodeInfo nodeInfo = null) { Log4netHelper.WriteInfo( JsonConvert.SerializeObject(new { desc = "write off and rein cost", projectId, toolId, nodeInfo })); var entity = FirstOrDefault(w => w.ToolId == toolId); if (entity == null) { entity = new RenewalToolWriteOffAndReinCost(); entity.Id = Guid.NewGuid(); entity.ToolId = toolId; entity.Add(); } return(entity); }
public static string HttpPost(string url, Dictionary <string, string> param, Dictionary <string, string> headers = null, string charset = "UTF-8", int timeout = 15000) { var data = GenderParamString(param); var policy = Policy.Handle <WebException>().WaitAndRetry(5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(1, retryAttempt)), (ex, timer, c, context) => { Log4netHelper.Fatal("HttpPost异常", ex); Log4netHelper.Fatal($"执行失败! 重试次数 {c} timer={timer.ToString()}i={context.ToJson()}"); }); return(policy.Execute(() => { return HttpPost(url, data, headers, charset, timeout); })); }
///<summary> ///语言学员列表 /// <para>ID:语言ID</para> /// </summary> public List <JiaJiNewWebModel.LernerScore> LearnShow(int Id) { try { string sql = "SELECT a.LearnerID,a.LearnSorceID,a.Sorce,a.LearnerGonsis,c.LearnName,c.LearnImage,a.LearnerContent,a.HeatHot from learnsorce a INNER JOIN `languages` b on a.LanguageID=b.LanguageID " + " INNER JOIN learner c on a.LearnerID = c.LearnerID where b.LanguageID = " + Id + " LIMIT 3"; List <LernerScore> list = MySqlDB.GetList <LernerScore>(sql, System.Data.CommandType.Text, null); return(list); } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); throw ex; } }
public string ActiveShow(int Id) { try { Session["Aid"] = Id; //int Id = Convert.ToInt32(Session[""]); string list = JsonConvert.SerializeObject(Activebll.ActiveShow(Id)); Log4netHelper.WriteLog("日志报告"); return(list); } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); return(null); } }
/// <summary> /// 获取项目对应的图片 /// </summary> /// <returns></returns> public List <JiaJiNewWebModel.projectItem> GetProImgList(int proid) { try { string sql = "select * from projectItem where Pro_ID=" + proid + " "; List <JiaJiNewWebModel.projectItem> list = MySqlDB.GetList <JiaJiNewWebModel.projectItem>(sql, System.Data.CommandType.Text, null); Log4netHelper.WriteLog("系统日志,请求了ProjectItemDAL类下的GetProductList方法"); return(list); } catch (System.Exception ex) { Log4netHelper.WriteLog("错误信息:请求了ProjectItemDAL类下的GetProductList方法", ex); return(null); } }
/// <summary> /// 写异常信息表数据 /// </summary> /// <param name="exception"></param> public static void WriteExceptionInfo(ExceptionInfoEntity exception) { Task.Run(() =>//未找到消费线程,新建线程消费队列 { try { //只是记录日志吧 Log4netHelper.WriteErrorLogByLog4Net(typeof(Log4netHelper), JsonConvert.SerializeObject(exception)); dal.AddWithKey(exception); } catch (Exception ex) { Log4netHelper.WriteErrorLogByLog4Net(typeof(Log4netHelper), "WriteExceptionInfo记录异常表出现异常,exception:" + JsonConvert.SerializeObject(exception), ex); } }); }
///<summary> ///获取移民项目详情 /// </summary> /// <para>Id:项目ID</para> /// <returns></returns> public Project ImmigrantShow(int Id) { try { string sql = "update project set ProjectReadCount=ProjectReadCount+1 where ProjectID=" + Id + ";"; sql += "select * from project where ProjectID='" + Id + "'"; DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, null); Project pro = MySqlDB.fanshemodel <Project>(dt); return(pro); } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); throw ex; } }
///<summary> ///获取背景提升项目详情 /// </summary> /// <para>Id:项目ID</para> /// <returns></returns> public projectItem ProjectItemShow(int Id) { try { string sql = "update projectitem set Pro_ReadCount=Pro_ReadCount+1 where Pro_ID=" + Id + ";"; sql += "select * from projectitem where Pro_ID=" + Id + ""; DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, null); projectItem pro = MySqlDB.fanshemodel <projectItem>(dt); return(pro); } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); throw ex; } }
/// <summary> /// 将异常写入到日志文件 /// /// </summary> /// <param name="ex">异常对象</param> public static void WriteExceptionToFile(Exception ex) { //获取登录对象 string username = ""; if (username != null) { string errorMsg = ErrorHandler.GetErrorDescription(ex, username); Log4netHelper.GetErrorLog().Error(errorMsg); } else { string errorMsg = ErrorHandler.GetErrorDescription(ex); Log4netHelper.GetErrorLog().Error(errorMsg); } }
/// <summary> /// 启动全部 /// </summary> public void StartAll() { foreach (var client in GetList()) { ThreadPool.QueueUserWorkItem((id) => { Policy.Handle <Exception>().WaitAndRetryForever(retryAttempt => TimeSpan.FromSeconds(Math.Pow(1, retryAttempt)), (policy_ex, timer) => { Log4netHelper.Fatal($"连接服务端失败 timer={timer.TotalSeconds} ex={policy_ex.Message}", policy_ex); }).Execute(() => { Start(id.ToString()); }); }, client.Id); } }
/// <summary> /// 获取学生信息的数量 /// </summary> /// <returns></returns> public int CountStudentInfo() { try { string sql = @"select COUNT(1) from Successful_Relation a INNER JOIN student b on a.StudentID = b.StudentID INNER JOIN College d ON b.CollegeID = d.CollegeID "; int ids = MySqlDB.scalar(sql, CommandType.Text, null); Log4netHelper.WriteLog("系统日志:请求了ActiveDal类下的CountStudentInfo方法"); return(ids); } catch (Exception ex) { Log4netHelper.WriteLog("错误信息:请求了ActiveDal类下的ActiveLsitIndex方法", ex); return(0); } }
/// <summary> /// 首页显示解决方案步骤 /// </summary> /// <returns></returns> public List <JiaJiNewWebModel.Solution_BuZhou> SolutionBuZhouList() { try { string sql = "select SolutionBuZhouID,SolutionBuZhou from solution_buzou ORDER BY SolutionBuZhouID DESC LIMIT 8"; List <JiaJiNewWebModel.Solution_BuZhou> list = MySqlDB.GetList <JiaJiNewWebModel.Solution_BuZhou>(sql, CommandType.Text, null); Log4netHelper.WriteLog("系统日志,请求了SolutionDAL类下的SolutionIndexList方法"); return(list); } catch (System.Exception ex) { Log4netHelper.WriteLog("错误信息:请求了ActiveDal类下的ActiveLsitIndex方法", ex); return(null); } }
/// <summary> /// 获取国家集合 /// </summary> /// <returns></returns> public List <JiaJiNewWebModel.Country> CountryList() { try { string sql = "SELECT CountryID,CountryName,CountryImg from country where IsCountry=1"; List <JiaJiNewWebModel.Country> list = MySqlDB.GetList <JiaJiNewWebModel.Country>(sql, System.Data.CommandType.Text, null); Log4netHelper.WriteLog("系统日志,请求了CountryDal类下的CountryDAL方法"); return(list); } catch (Exception ex) { Log4netHelper.WriteLog("错误,请求了CountryDal类下的CountryDAL方法", ex); throw; } }
//软件升级 private void SoftwareUpdata_InSetup(Object sender, EventArgs eArgs) { if (File.Exists("Setup.exe")) { File.Delete("Setup.exe"); } if (updater == null) { updater = Updater.CreateUpdaterInstance("http://47.102.136.78:8888/Win10APPS/{0}", "update_c.xml"); updater.Error += (s, e) => { Log4netHelper.Error(updater.Context.Exception); _setupForm.ShowToast_InSetup("更新发生了错误:", updater.Context.Exception.Message, 1); }; updater.UpdatesFound += (s, e) => { _setupForm.ShowToast_InSetup("发现了新版本:", updater.Context.UpdateInfo.AppVersion, 1); }; updater.NoUpdatesFound += (s, e) => { _setupForm.ShowToast_InSetup("提示", "没有新版本!", 1); }; updater.MinmumVersionRequired += (s, e) => { _setupForm.ShowToast_InSetup("提示", "当前版本过低无法使用自动更新!", 1); }; } Updater.CheckUpdateSimple(); }
public virtual bool ConnectReader() { try { if (reader == null) { return(false); } reader.Connect(); int[] antennaList = { 1, 2, 3, 4 }; //选择天线1,2,3,4 reader.ParamSet("/reader/region/id", Reader.Region.NA); SimpleReadPlan plan = new SimpleReadPlan(antennaList, TagProtocol.GEN2, null, null, 1000); //设置天线和协议 reader.ParamSet("/reader/read/plan", plan); //场景配置,用于隧道机 Gen2.LinkFrequency blf = Gen2.LinkFrequency.LINK320KHZ; reader.ParamSet("/reader/gen2/BLF", blf); Gen2.Tari tari = Gen2.Tari.TARI_6_25US; reader.ParamSet("/reader/gen2/tari", tari); Gen2.TagEncoding tagncoding = Gen2.TagEncoding.FM0; reader.ParamSet("/reader/gen2/tagEncoding", tagncoding); Gen2.Session session = Gen2.Session.S1; reader.ParamSet("/reader/gen2/session", session); Gen2.Target target = Gen2.Target.A; reader.ParamSet("/reader/gen2/target", target); //500~3150 reader.ParamSet("/reader/radio/readPower", SysConfig.mReaderPower); reader.TagRead += Reader_OnTagReported; reader.ReadException += new EventHandler <ReaderExceptionEventArgs>(r_ReadException); } catch (Exception ex) { Log4netHelper.LogError(ex); return(false); } return(true); }
/// <summary> /// 发送POTS 请求 /// </summary> /// <param name="url"></param> /// <param name="data"></param> /// <param name="headers"></param> /// <param name="charset"></param> /// <returns></returns> private static string HttpPost(string url, string data, Dictionary <string, string> headers = null, string charset = "UTF-8", int timeout = 15000) { #if DEBUG timeout = 1000 * 60 * 10; #endif HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.Accept = "*/*"; request.Timeout = timeout; request.AllowAutoRedirect = false; SetHeaders(request, headers); byte[] paramBytes = Encoding.GetEncoding(charset).GetBytes(data); request.ContentLength = paramBytes.Length; string responseStr = string.Empty; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(paramBytes, 0, paramBytes.Length); requestStream.Close(); try { var response = request.GetResponse(); if (response != null) { using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) { responseStr = reader.ReadToEnd(); } } } catch (WebException ex) { Log4netHelper.Fatal("HttpPost异常", ex); var response = (HttpWebResponse)ex.Response; using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { responseStr = reader.ReadToEnd(); } } Log4netHelper.Debug(url, responseStr); throw ex; } return(responseStr); } }
/// <summary> /// 获取成功案列详细信息 /// </summary> /// <param name="Id"></param> /// <returns></returns> public SuccessInfor SuccessfulShow(int Id) { try { //string sql = "select * from successful_relation " + // "INNER JOIN student d ON a.StudentID = d.StudentID " + // "INNER JOIN country b ON d.CountryID = b.CountryID " + // "INNER JOIN educationtype c ON d.EducationID = c.EducationID " + // "INNER JOIN successful e ON a.SuccessID = e.SuccessID " + // "INNER JOIN college f ON a.CollegeID = f.CollegeID where a.SRelationID=@Id"; StringBuilder sql = new StringBuilder(); sql.Append(" select * from successful_relation "); sql.Append(" left join successful on successful_relation.SuccessID=successful.SuccessID "); sql.Append(" left join student on student.StudentID=successful_relation.StudentID "); sql.Append(" LEFT JOIN college on college.CollegeID=student.CollegeID "); sql.Append(" left join educationtype on educationtype.EducationID=student.EducationID "); sql.Append(" left join country on country.CountryID=student.CountryID "); sql.Append(" where successful_relation.SRelationID=@Id "); MySqlParameter[] para = { new MySqlParameter("@Id", Id) }; DataTable dt = MySqlDB.GetDataTable(sql.ToString(), CommandType.Text, para); SuccessInfor infor = new SuccessInfor(); infor.StudentName = dt.Rows[0]["StudentName"].ToString(); //infor.CollegeID =(int)dt.Rows[0]["CollegeID"]; infor.CollegeName = dt.Rows[0]["CollegeName"].ToString(); infor.CountryName = dt.Rows[0]["CountryName"].ToString(); infor.EducationName = dt.Rows[0]["EducationName"].ToString(); infor.JiuDuXueyuan = dt.Rows[0]["JiuDuXueyuan"].ToString(); infor.Score = dt.Rows[0]["Score"].ToString(); infor.SuccessContent = dt.Rows[0]["SuccessContent"].ToString(); infor.SuccessDate = dt.Rows[0]["SuccessDate"].ToString(); infor.SuccessTitle = dt.Rows[0]["SuccessTitle"].ToString(); Log4netHelper.WriteLog("日志报告"); return(infor); } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); throw ex; } }
public EwsProvider() { try { //安全验证证书 ServicePointManager.ServerCertificateValidationCallback = delegate(Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { // Replace this line with code to validate server certificate. return(true); }; } catch (Exception ex) { Log4netHelper.Error("ServerCertificateValidationCallback Exception: " + ex.ToString()); } }
public void OnException(ExceptionContext context) { if (_hostingEnvironment.IsDevelopment()) { return; } JsonSerializerSettings setting = Util.GetJsonSetting(); //记录错误日志 Log4netHelper.Error(typeof(HttpGlobalExceptionFilter), context.Exception); //context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Result = new JsonResult(new ApiReponseModel <string>() { Code = ApiResponseCode.failure, Message = "服务器出现故障啦,请联系管理员查看错误日志!" }, setting); context.ExceptionHandled = true; }
public bool Save(CBasNormalScheduleVCtDet BasNormalScheduleVCtDet, out string errMsg) { errMsg = ""; try { if (BasNormalScheduleVCtDet.SecondVLeadtimeStart > BasNormalScheduleVCtDet.SecondVLeadtimeEnd) { errMsg = "<=StartTimeGreaterThanEndTime>"; return(false); } Dashboard.Authentication.Authentication.UpdateEntity <CBasNormalScheduleVCtDet>(BasNormalScheduleVCtDet); if (string.IsNullOrEmpty(BasNormalScheduleVCtDet.BasNormalScheduleVCtDetId)) { if (DataContext.CBasNormalScheduleVCtDet.Any(c => c.Pdc == BasNormalScheduleVCtDet.Pdc && c.CargoType == BasNormalScheduleVCtDet.CargoType && c.BasNormalScheduleVCtId == BasNormalScheduleVCtDet.BasNormalScheduleVCtId)) { errMsg = "<=DuplicatedNormalScheduleVCtDet>"; return(false); } BasNormalScheduleVCtDet.BasNormalScheduleVCtDetId = Guid.NewGuid().ToString(); DataContext.CBasNormalScheduleVCtDet.Add(BasNormalScheduleVCtDet); } else { if (DataContext.CBasNormalScheduleVCtDet.Any(c => c.Pdc == BasNormalScheduleVCtDet.Pdc && c.CargoType == BasNormalScheduleVCtDet.CargoType && c.BasNormalScheduleVCtId == BasNormalScheduleVCtDet.BasNormalScheduleVCtId && c.BasNormalScheduleVCtDetId != BasNormalScheduleVCtDet.BasNormalScheduleVCtDetId)) { errMsg = "<=DuplicatedNormalScheduleVCtDet>"; return(false); } } DataContext.SaveChanges(); return(true); } catch (Exception ex) { errMsg = "<=SaveError>"; Log4netHelper.LoadADONetAppender(); ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log.Info("BasNormalScheduleVCtDet Save方法出错。Author:chenjm ", ex); return(false); } }
public bool Delete(string id) { try { var csbcodedef = DataContext.CBasCodeDef.FirstOrDefault(f => f.BasCodeDefId == id); DataContext.CBasCodeDef.Remove(csbcodedef); DataContext.SaveChanges(); return(true); } catch { Log4netHelper.LoadADONetAppender(); ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log.Info("Delete方法出错。Author:huangbx "); return(false); } }
public void Copy(object sender, EventArgs e) { try { dataGridViewX1.EndEdit(); if (tabControl1.SelectedTabIndex == 0) { DgdDealHelper.SetDataGridVIewToClipboard(dataGridViewX1); //UIHelper.ToastNotify(true, "正式生产表数据已复制到粘贴板!", tabControl1); } } catch (Exception ex) { Log4netHelper.Fatal(this.GetType(), "复制时发生异常:", ex); } }
private void SecondInitalCheckbox(object obj) { FlowLayoutPanel flowpanel = obj as FlowLayoutPanel; try { if (!this.IsHandleCreated || this.IsDisposed) { return; } if (InvokeRequired) { this.Invoke((MethodInvoker) delegate { for (int i = 0; i < flowpanel.Controls.Count; i++) { CheckBox update_ck = flowpanel.Controls[i] as CheckBox; if (old_capacity_str.Contains(update_ck.Text)) { update_ck.Checked = true; } if (flowpanel.Name == "Analog") { Analog_flowpanel.Controls.Add(update_ck); } else { Digital_flowpanel.Controls.Add(update_ck); } progressBarX1.Value += 1; progressBarX1.Text = ((double)progressBarX1.Value / progressBarX1.Maximum).ToString("P"); if (progressBarX1.Value == progressBarX1.Maximum) { progressBarX1.Visible = false; } Application.DoEvents(); } }); } } catch (Exception ex) { Log4netHelper.Fatal(this.GetType(), "再次载入传感器容量时异常:", ex); throw ex; } }
public void TakeScreenshotAndGenerateThumbnail(string url, string localPath) { this.EnsureParameters(url, localPath); try { RetryHelper.Do(() => this.TakeScreenshotAndGenerateThumbnailInternal(url, localPath), this.ShouldRetry); } catch (Exception ex) { var exception = new WebScreenshotTakerAppException(ex); Log4netHelper.All(x => x.Error($"{exception.ToString()}")); throw exception; } }
/// <summary> /// 采集数据插入原始dat文件 /// </summary> /// <param name="data"></param> /// <returns></returns> public bool AppendDat(Data _data) { try { if (DatHelper.AppendDat(_data.Name, _data.ModbusData)) { return(true); } return(false); } catch (Exception ex) { Log4netHelper.Error(ex); return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="Log4NetExtensionTest"/> class. /// </summary> public Log4NetExtensionTest() { this.testee = new Log4NetExtension<States, Events>(); this.log4Net = new Log4netHelper(); }