/// <summary> /// 发送短信接口 /// </summary> /// <param name="content"></param> /// <param name="numbers"></param> /// <param name="priority"></param> /// <returns></returns> public static bool SendSMS(string content, string[] numbers, int priority = 5) { //获取短信接口的序列号,和自定义Key string SerialNo = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_SerialNo"); string Key = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_Key"); if (String.IsNullOrWhiteSpace(SerialNo) || String.IsNullOrWhiteSpace(Key)) { LogHelp.AddErrorLog("亿美短信接口缺少企业序列号或者自定义关键字Key", "亿美短信接口调用失败", HttpContext.Current.Request); return(false); } SMSService.SDKClient sdkClient = new SDKClientClient(); sendSMSRequest smsRequest = new sendSMSRequest(); smsRequest.arg0 = SerialNo; smsRequest.arg1 = Key; smsRequest.arg3 = numbers; smsRequest.arg4 = YSWL.Common.Globals.HtmlEncode(content); smsRequest.arg7 = priority; sendSMSResponse smsResponse = sdkClient.sendSMS(smsRequest); if (smsResponse.@return == 0) { return(true); } string msg = SendSMSException(smsResponse.@return); LogHelp.AddErrorLog("亿美短信接口发送短信出现异常,【" + msg + "】,错误码【" + smsResponse.@return + "】", "亿美短信接口调用失败", HttpContext.Current.Request); return(false); }
public ActionResult Index() { LogHelp.Debug("Debug"); LogHelp.Info("Info"); LogHelp.Error("Error"); return(View()); }
public static async Task <Response> IsHavePower(IsPowerIng ResultMsg, int Id) { Response response = new Response { code = Convert.ToInt32(StatusEnum.Failed) }; response.msg = "暂无权限"; try { var list = await SqlDapperHelper.ReturnListTAsync <Role>("select SR.Id,SR.AdminId,SR.PowerSetId,SR.CreateTime,SP.ActionName,SP.ControllerNmae,SP.PowerName,SP.MenuId from Sys_Role SR join Sys_PowerSet SP on SR.PowerSetId=SP.Id where SR.AdminId=@AdminId", new { AdminId = Id }); var isHave = list.Any(x => x.ControllerNmae == ResultMsg.ControllerName && x.ActionName == ResultMsg.ActionName); if (isHave) { response.code = Convert.ToInt32(StatusEnum.Succeed); response.msg = "正常"; } else { response.code = Convert.ToInt32(StatusEnum.Error); response.msg = "暂无权限"; } } catch (Exception ex) { LogHelp.Error(ex); } return(response); }
public int ExecuteNoneQuery(string sqlLan) { if (null == m_SqlInstance || string.IsNullOrEmpty(sqlLan)) { return(0); } try { SqliteCommand mycommand = new SqliteCommand(m_SqlInstance) { CommandText = sqlLan }; int result = mycommand.ExecuteNonQuery(); mycommand.Dispose(); mycommand = null; return(result); } catch (Exception e) { Debug.LogError(e.ToString()); LogHelp.LogFile(e.ToString()); return(0); } }
//////////////////////////////////////////////////////////// private void OpenDB() { m_SqlReader = null; if (File.Exists(m_StrPath)) { m_FirstOpen = false; } else { m_FirstOpen = true; } try { m_SqlInstance = new SqliteConnection("URI=file:" + m_StrPath); //m_SqlInstance = new SqliteConnection(m_StrPath); //Debug.LogError("URI=file:" + m_StrPath); m_SqlInstance.Open(); } catch (Exception e) { m_SqlInstance = null; LogHelp.LogFile(e.ToString()); } }
protected void btnSave_Click(object sender, System.EventArgs e) { UserType newUserType = new UserType(); string userType = txtUserType.Text.Trim(); string description = txtDescription.Text.Trim(); if (string.IsNullOrWhiteSpace(userType) || string.IsNullOrWhiteSpace(description)) { return; } //string strErr = ""; //if (newUserType.Exists(userType, description)) //{ // strErr += Resources.Site.TooltipUserTypeExist; //} //if (strErr != "") //{ // YSWL.Common.MessageBox.ShowSuccessTip(this, strErr); // return; //} newUserType.Update(userType, description); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("编辑用户类别用户类别:【{0}】", userType), this); this.btnCancle.Enabled = false; this.btnSave.Enabled = false; YSWL.Common.MessageBox.ResponseScript(this, "parent.location.href='UserTypeAdmin.aspx'"); //Response.Redirect("UserTypeAdmin.aspx"); }
public override void ProcessRequest(HttpContext context) { try { context.Response.ContentType = ResponseContentType; //获取上传文件集合 HttpFileCollection files = GetHttpPostedFile(context); if (files == null) { throw new FileNotFoundException("UpdateFile Not Found! HttpPostedFile Is NULL!"); } //获取临时目录 string uploadPath = "/" + MvcApplication.UploadFolder + "/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/";; string uploadPathMP = context.Server.MapPath(uploadPath); if (!Directory.Exists(uploadPathMP)) { //不存在则自动创建文件夹 Directory.CreateDirectory(uploadPathMP); } string fileNames = string.Empty; string ext; for (int i = 0; i < files.Count; i++) { HttpPostedFile postedFile = files[i]; ext = Path.GetExtension(postedFile.FileName).ToLower(); if (!AllowFileExt.Contains(ext)) { LogHelp.AddInvadeLog("Handlers-UploadMultipleFileHandler", context.Request); return; } //文件重命名 string reName = DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + ext; postedFile.SaveAs(uploadPathMP + reName); string thumName = "T300X400_" + reName; //临时保存文件 ImageTools.MakeThumbnail(uploadPathMP + reName, uploadPathMP + thumName, 300, 400, MakeThumbnailMode.HW); fileNames += "|" + thumName; } //json方式输出成功信息 和 保存路径 , 文件名 JsonObject json = new JsonObject(); json.Put("success", true); //成功 json.Put("path", uploadPath + "{0}"); //临时保存路径 json.Put("names", fileNames.TrimStart('|')); //文件名 | 分割 context.Response.Write(json.ToString()); //输出json数据 } catch (Exception ex) { Model.SysManage.ErrorLog model = new Model.SysManage.ErrorLog(); model.Loginfo = ex.Message; model.StackTrace = ex.ToString(); model.Url = context.Request.Url.AbsoluteUri; BLL.SysManage.ErrorLog.Add(model); throw; } }
protected void btnDeleteAll_Click(object sender, EventArgs e) { ColoPay.BLL.SysManage.ErrorLog.DeleteByDate(Globals.SafeDateTime((txtDate.Text), DateTime.Now)); gridView.OnBind(); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("批量删除【{0}】之前的错误日志", txtDate.Text), this); MessageBox.ShowSuccessTip(this, Resources.Site.TooltipDelOK); }
public IActionResult Index() { try { //Get Daily string sp = "sp_DashboardDaily"; DataTable dt = SqlHelp.ExecQuery(sp, new List <Microsoft.Data.SqlClient.SqlParameter>()); // ViewBag.Trolley = dt.Rows[0]["Trolley"].ToString(); ViewBag.Kanban = dt.Rows[0]["Kanban"].ToString(); ViewBag.TrolleyDelay = dt.Rows[0]["TrolleyDelay"].ToString(); //For Chart Daily ViewBag.ChartDailyText = $"Trolley,Kanban,Delay"; ViewBag.ChartDailyVal = $"{Convert.ToInt32(dt.Rows[0]["Trolley"].ToString())},{Convert.ToInt32(dt.Rows[0]["Kanban"].ToString())},{Convert.ToInt32(dt.Rows[0]["TrolleyDelay"].ToString())}"; //Chart Monthly sp = "sp_DashboardMonthly"; dt = SqlHelp.ExecQuery(sp, new List <Microsoft.Data.SqlClient.SqlParameter>()); //For Chart Monthly ViewBag.ChartMonthlyText = string.Join(',', dt.AsEnumerable().Select(x => x.Field <DateTime>("Tgl").ToString("dd")).ToArray()); ViewBag.ChartMonthlyTrolley = string.Join(',', dt.AsEnumerable().Select(x => x.Field <int>("Trolley")).ToArray()); ViewBag.ChartMonthlyKanban = string.Join(',', dt.AsEnumerable().Select(x => x.Field <int>("Kanban")).ToArray()); ViewBag.ChartMonthlyDelay = string.Join(',', dt.AsEnumerable().Select(x => x.Field <int>("TrolleyDelay")).ToArray()); } catch (Exception ex) { LogHelp.WriteErrorLog(ex); } //Return IndexPrep(); return(View()); }
protected void btnSave_Click(object sender, EventArgs e) { if (txtKeyName.Text.Trim() == "") { lblToolTip.ForeColor = Color.Red; lblToolTip.Text = Resources.SysManage.ErrorKeyNameNotNull; return; } if (txtValue.Text.Trim() == "") { lblToolTip.ForeColor = Color.Red; lblToolTip.Text = Resources.SysManage.ErrorValueNotNull; return; } if (txtDescription.Text.Trim() == "") { lblToolTip.ForeColor = Color.Red; lblToolTip.Text = Resources.SysManage.fieldDescription + Resources.SysManage.ErrorContentNotNull; return; } ColoPay.BLL.SysManage.ConfigSystem.Add(txtKeyName.Text.Trim(), txtValue.Text.Trim(), txtDescription.Text.Trim(), YSWL.Common.Globals.SafeEnum( dropConfigType.SelectedValue, Model.SysManage.ApplicationKeyType.System)); MessageBox.ShowSuccessTip(this, Resources.Site.TooltipAddSuccess); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("新增系统参数:【{0}】", txtKeyName.Text.Trim()), this); gridView.OnBind(); lblToolTip.Text = ""; txtKeyName.Text = ""; txtValue.Text = ""; txtDescription.Text = ""; }
public override void OnException(ExceptionContext filterContext) { //1.0 获取最底层的异常 Exception innerExp = filterContext.Exception.InnerException != null ? filterContext.Exception.InnerException : filterContext.Exception; while (innerExp.InnerException != null) { innerExp = innerExp.InnerException; } //2.0 将详细的堆栈信息存入到文本日志(数据表) ,Log4Net.dll //千万不要用 System.IO.File.AppendAllText(); 因为会产生多线程并发问题 LogHelp.WriteLog(typeof(Exception), innerExp); //3.0 区分是否为ajax请求 if (filterContext.HttpContext.Request.IsAjaxRequest()) //表示是一个ajax请求 { //返回:{status:1,msg:} JsonResult json = new JsonResult(); json.Data = new { status = 1, msg = innerExp.Message }; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; filterContext.Result = json; //告诉MVC框架我已经处理完毕,你不需要再跳转到统一出错页面 filterContext.ExceptionHandled = true; } else { filterContext.ExceptionHandled = false;//web.config配置错误页面 } }
public async Task <IActionResult> Detail(int id) { IndexPrep(); try { KanbanRequest data = await DbContext.KanbanRequest.Where(a => a.KanbanReqId == id).FirstOrDefaultAsync(); if (id != 0 && data == null) { return(NotFound()); } if (id == 0) { data = new KanbanRequest(); data.RequestDateTime = DateTime.Now; data.StatusId = 1; data.LotNumber = 640; data.TagRequestNo = 0; } SetViewBag(data); //ViewBag.Message = ""; return(View(data)); } catch (Exception e) { LogHelp.WriteErrorLog(e); } return(View()); }
/// <summary> ///客户端服务程序(连接云服务器) /// </summary> private static void ApiSrvThread(object ob) { ServerXml oServerXml = ob as ServerXml; int iLastSecond = -1; DateTime oNow; //string strApiUrl = "http://127.0.0.1:7788/"; string strApiUrl = "http://127.0.0.1:" + oServerXml.API_Port + "/"; RemoteCtrlInfoQueryServices service = new RemoteCtrlInfoQueryServices(); WebServiceHost _serviceHost = new WebServiceHost(service, new Uri(strApiUrl)); //或者第二种方法:WebServiceHost _serviceHost = new WebServiceHost(typeof(PersonInfoQueryServices), new Uri("http://127.0.0.1:7788/")); try { //如果这里报错,IDE必须以管理员方式运行 _serviceHost.Open(); //LogHelper.WriteLog(string.Format("Socket {0}:{1}启动失败,请检查权限或端口是否被占用!", config.Ip, config.Port)); LogHelp.Info("API 服务启动成功" + strApiUrl); while (m_ClientSvrthread.IsAlive) { oNow = DateTime.Now; //秒任务 SecondTask(ref iLastSecond, oNow); Thread.Sleep(100); } _serviceHost.Close(); } catch (System.Exception ex) { //LogHelper.WriteLog(string.Format("Socket {0}:{1}启动失败,请检查权限或端口是否被占用!", config.Ip, config.Port)); LogHelp.Info(ex.Message); LogHelp.Info("如果提示:HTTP 无法注册 " + strApiUrl + ",尝试以管理员运行程雪"); } }
/// <summary> /// 获取短信验证码 /// </summary> /// <param name="strTel"></param> /// <returns></returns> public ActionResult getValidSMS(string strTel) { try { //List<WxUserEntity> list = null; //校验次手机号是否已注册 var list = new WxUserBC().GetWxUserListByCondition(null, strTel, null, null).ToList(); if (list.Count > 0) { return(Json("该手机号已注册", JsonRequestBehavior.AllowGet)); } else { string yzmCode = CommonHelper.CreateNumber(4, true); //Session["RegisterCode"] = new SMSCodes { Code = yzmCode, CreteTime = DateTime.Now, IsUsered = false }; Session["RegisterCode"] = "1234"; //SendMessageHelper.SmsSend(strTel, SendMessageHelper.YZMMBContent(yzmCode)); return(Json("Success", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { LogHelp.WriteLog("getValidSMS:" + ex.Message); } return(Json("Error", JsonRequestBehavior.AllowGet)); }
/// <summary> /// 接收MQ消息 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="func"></param> /// <param name="queueName"></param> public static void GetMQ <T>(Func <T, bool> func, string queueName) { using (var channel = ConnectionMQ.Connection().CreateModel()) { //事件基本消费者 EventingBasicConsumer consumer = new EventingBasicConsumer(channel); //接收到消息事件 consumer.Received += (ch, ea) => { var message = Encoding.UTF8.GetString(ea.Body); try { var item = JsonConvert.DeserializeObject <T>(message); func(item); } catch (Exception ex) { LogHelp.Error(ex); } //确认该消息已被消费 channel.BasicAck(ea.DeliveryTag, false); }; //启动消费者 设置为手动应答消息 channel.BasicConsume(queueName, false, consumer); } }
public IActionResult LoginAct(string userName, string passWord) { var result = new Response() { code = Convert.ToInt32(StatusEnum.Failed) }; try { if (String.IsNullOrWhiteSpace(userName) || String.IsNullOrWhiteSpace(passWord)) { result.msg = "用户名或密码错误!"; return(Ok(result)); } //验证码,后期需要则加上 //密码加密 passWord = Convert.ToBase64String(BaseController.AESEncrypt(JsonConvert.SerializeObject(passWord))); result = LoginService.LoginAct(userName, passWord); } catch (Exception ex) { result.code = Convert.ToInt32(StatusEnum.Error); result.msg = "内部请求出错";//内部请求出错 LogHelp.Error(ex, ex.Message); } return(Ok(result)); }
/// <summary> /// 退出登录 /// </summary> /// <returns></returns> public IActionResult LoginOut( ) { var result = new Response <Login>() { code = Convert.ToInt32(StatusEnum.Failed) }; result.url = "/Home/Index"; result.msg = "退出失败!"; try { //检查用户状态 //加密存入缓存 //// CacheHelper.SetAbsolute("token",token,15*60); //HttpContext.Response.Cookies.Delete("tokens"); HttpContext.Response.Cookies.Delete("tokens"); result.code = Convert.ToInt32(StatusEnum.Succeed); result.url = "/Home/Index"; result.msg = "退出成功!"; //是否需要返回登录成功后的实体 return(Ok(result)); } catch (Exception ex) { result.code = Convert.ToInt32(StatusEnum.Error); result.msg = "内部请求出错";//内部请求出错 LogHelp.Error(ex, ex.Message); } return(Ok(result)); }
} //系统管理_用户类别管理_新增页面 public void btnSave_Click(object sender, System.EventArgs e) { UserType newUserType = new UserType(); string userType = txtUserType.Text.Trim(); byte[] sarr = System.Text.Encoding.GetEncoding("gb2312").GetBytes(userType); if (sarr.Length > 2) { YSWL.Common.MessageBox.ShowFailTip(this, "输入的用户类型不能超过两个字符"); return; } string description = txtDescription.Text.Trim(); if (string.IsNullOrWhiteSpace(userType) || string.IsNullOrWhiteSpace(description)) { return; } string strErr = ""; DataSet dataSet = newUserType.GetList("UserType='" + YSWL.Common.InjectionFilter.SqlFilter(userType) + "'"); if (dataSet != null && dataSet.Tables[0].Rows.Count > 0) { strErr += Resources.Site.TooltipUserTypeExist; } if (strErr != "") { YSWL.Common.MessageBox.ShowSuccessTip(this, strErr); return; } newUserType.Add(userType, description); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("新增用户类别用户类别:【{0}】", userType), this); YSWL.Common.MessageBox.ResponseScript(this, "parent.location.href='UserTypeAdmin.aspx'"); //Response.Redirect("UserTypeAdmin.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { if (txtRoleName.Text.Trim().Length <= 0) { YSWL.Common.MessageBox.ShowFailTip(this, Resources.SysManage.ErrorRoleIsNull); return; } try { Role role = new Role(); if (!role.RoleExists(txtRoleName.Text.Trim())) { role.Description = txtRoleName.Text; role.Create(); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("新增角色:【{0}】", txtRoleName.Text), this); YSWL.Common.MessageBox.ShowSuccessTip(this, Resources.Site.TooltipSaveOK); } else { YSWL.Common.MessageBox.ShowFailTip(this, Resources.Site.TooltipDataExist); } } catch (Exception ex) { lblToolTip.Text = ex.Message; return; } txtRoleName.Text = ""; dataBind(); }
protected void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { string ID = gridView.DataKeys[e.RowIndex].Value.ToString(); List <string> UserIDlist = YSWL.Common.StringPlus.GetStrArray(BLL.SysManage.ConfigSystem.GetValueByCache("AdminUserID"), ',', true); if (UserIDlist.Contains(ID)) { YSWL.Common.MessageBox.ShowFailTip(this, Resources.Site.ErrorCannotDeleteID); return; } try { User User2 = new User(int.Parse(ID)); ColoPay.BLL.Members.Users userBll = new BLL.Members.Users(); userBll.DeleteEx(int.Parse(ID)); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("删除用户:【{0}】", User2.UserName), this); YSWL.Common.MessageBox.ShowSuccessTip(this, "删除成功!"); gridView.OnBind(); } catch (System.Data.SqlClient.SqlException ex) { if (ex.Number == 547) { YSWL.Common.MessageBox.ShowFailTip(this, Resources.Site.ErrorCannotDeleteUser); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session[YSWL.Common.Globals.SESSIONKEY_ADMIN] != null) { YSWL.Accounts.Bus.User currentUser = (YSWL.Accounts.Bus.User)Session[YSWL.Common.Globals.SESSIONKEY_ADMIN]; LogHelp.AddUserLog(currentUser.UserName, currentUser.UserType, "退出系统", this); #region 更新最新的登录时间 ColoPay.BLL.Members.UsersExp uBll = new BLL.Members.UsersExp(); Model.Members.UsersExpModel uModel = new Model.Members.UsersExpModel(); uModel = uBll.GetUsersExpModel(currentUser.UserID); if (uModel != null) { uModel.LastAccessIP = Request.UserHostAddress; uModel.LastLoginTime = DateTime.Now; uBll.Update(uModel); } #endregion } FormsAuthentication.SignOut(); Session.Remove(Globals.SESSIONKEY_ADMIN); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Write("<script language='javascript'>window.top.location='" + defaullogin + "'</script>"); Response.End(); }
/// <summary> /// 用户提交意见 /// </summary> /// <param name="apiSuggestionModel"></param> /// <returns></returns> public object AddSuggestion([FromBody] ApiSuggestionModel apiSuggestionModel) { var userInfo = GetCurrentUserInfo(); UserSuggestion userSuggestion = new UserSuggestion() { Id = Guid.NewGuid(), Msg = apiSuggestionModel.Msg, UserId = userInfo.Id, CreateTime = DateTime.Now }; try { SuggestionBusiness.AddItem(userSuggestion); return(ApiReturnModel.ReturnOk("提交成功")); } catch (Exception e) { //记录日志 LogHelp.WriteLog(e.Message, ApiFileDirectoryPara.ApiErrorDir); return(ApiReturnModel.ReturnError("提交错误")); } }
public SqliteDataReader ExecuteQuery(string strQuery) { if (null == m_SqlInstance || string.IsNullOrEmpty(strQuery)) { return(null); } ClearReader(); try { SqliteCommand tempSqlCommand = m_SqlInstance.CreateCommand(); tempSqlCommand.CommandText = strQuery; m_SqlReader = tempSqlCommand.ExecuteReader(); tempSqlCommand.Dispose(); tempSqlCommand = null; return(m_SqlReader); } catch (Exception e) { LogHelp.LogFile(e.ToString()); return(null); } }
/// <summary> /// 批量删除权限数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { List <int> idlist = GetSelIDlist(); if (idlist.Count == 0) { return; } string tipmsg = Resources.Site.TooltipDelOK; foreach (int id in idlist) { try { bllPerm.Delete(id); } catch { tipmsg = id.ToString() + "," + tipmsg; } } if (tipmsg != Resources.Site.TooltipDelOK) { tipmsg += Resources.Site.TooltipUpdateError; } YSWL.Common.MessageBox.ShowSuccessTip(this, tipmsg); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, "批量删除权限数据", this); gridView.OnBind(); }
private void btnSync_Click(object sender, EventArgs e) { try { OperDicDal.DelOperDic(DateTime.Now); DB2help db2 = new DB2help(); var dt = db2.GetHisOperNameAll(""); foreach (DataRow dr in dt.Rows) { //LogHelp.WriteLog(dr["ITEMNAME"].ToString(), // dr["ITEMID"].ToString(), // dr["SSDJ"].ToString(), // dr["SSQK"].ToString(), // dr["INPUTSTR"].ToString()); //ITEMID 编码, ITEMNAME 手术名称,SSDJ 手术等级,SSQK 手术切口,INPUTSTR var res = OperDicDal.InsertOperDic( dr["ITEMNAME"].ToString(), dr["ITEMID"].ToString(), dr["SSDJ"].ToString(), dr["SSQK"].ToString(), dr["INPUTSTR"].ToString() ); } BindDatasource(); } catch (Exception ex) { LogHelp.WriteLog(ex.ToString()); MessageBox.Show(ex.Message); } }
public IActionResult Detail(Int16 id) { try { SyUser data; if (id == 0) { data = new SyUser() { IsActive = true //default Active } } ; else { data = DbContext.SyUser.Where(a => a.UserId == id).FirstOrDefault(); if (data == null) { return(NotFound()); } else { data.Password = EncryptHelper.ConvertToDecrypt(data.Password); } } SetViewBag(); return(View(data)); } catch (Exception e) { LogHelp.WriteErrorLog(e); } return(View()); }
public void PushMsg(IThreadMsg msg) { if (null == msg) { return; } if (null == m_tIns) { LogHelp.LogAuto("[Warning] : BackGround Thread Is Not Exist!!"); } try { m_lockTask.Lock(); m_listTaskArray.AddLast(msg); } catch { } finally { m_lockTask.UnLock(); } }
/// <summary> /// 打开一个连接 /// 开启事物方法调用本方法时,要传入true /// </summary> private void OpenDB(bool isTranStart = false) { try { if (this.tran == null) { // 建立 this.conn = new SqlConnection(this.ConnectionString); // 打开连接 this.conn.Open(); // 将参数应用于此连接 if (!isTranStart) { this.cmd.Connection = this.conn; } } else { // 将参数应用于此连接 this.cmd.Connection = this.conn; // 事务用于此 this.cmd.Transaction = this.tran; } } catch (Exception e) { LogHelp.DBLog(e.Message); } }
/// <summary> /// 保存操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void btnSave_Click(object sender, System.EventArgs e) { if (txtPayFree.Text.Trim() == "") { YSWL.Common.MessageBox.ShowSuccessTip(this, string.Format("设置费率{0}!", "")); return; } PayFreeModel.AgentID = int.Parse(lbAgentId.Text); PayFreeModel.PayModeId = int.Parse(lbPayModelid.Text); PayFreeModel.FeeRate = decimal.Parse(txtPayFree.Text); if (lbType.Text == "0") { //开通通道 if (PayFreeBll.Add(PayFreeModel)) { YSWL.Common.MessageBox.ShowSuccessTip(this, string.Format("开通代理商通道成功,费率:【{0}】!", txtPayFree.Text)); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format(" 代理商" + lbAgentId.Text + " ,设置费率:【{0}】", txtPayFree.Text), this); Response.Redirect("AgentPayFeeList.aspx?AgentId=" + lbAgentId.Text + ""); } } else { if (PayFreeBll.Update(PayFreeModel)) { YSWL.Common.MessageBox.ShowSuccessTip(this, string.Format("修改费率:【{0}】成功!", txtPayFree.Text)); LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format(" 代理商" + lbAgentId.Text + " ,设置费率:【{0}】", txtPayFree.Text), this); Response.Redirect("AgentPayFeeList.aspx?AgentId=" + lbAgentId.Text + ""); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (txtDescription.Text.Trim().Length > 0) { if (bll.Exists(txtDescription.Text.Trim())) { YSWL.Common.MessageBox.ShowFailTip(this, Resources.Site.TooltipDataExist); return; } else { if (DropListPermissions.SelectedIndex > 0) { bll.Add(txtDescription.Text.Trim(), Convert.ToInt32(DropListPermissions.SelectedValue)); } else { bll.Add(txtDescription.Text.Trim()); } gridView.OnBind(); } } LogHelp.AddUserLog(CurrentUser.UserName, CurrentUser.UserType, string.Format("新增功能行为:【{0}】", txtDescription.Text.Trim()), this); }