/// <summary> /// ��ȡ��־��Ϣ /// </summary> /// <param name="L_ID">��¼Id</param> /// <returns>��־���ݶ���</returns> public XYECOM.Model.LogInfo GetItem(int L_ID) { XYECOM.Model.LogInfo lg = null; SqlParameter[] Param = new SqlParameter[] { new SqlParameter("@strWhere"," Where L_ID=" + L_ID.ToString()), new SqlParameter("@strTableName","XYV_Log"), new SqlParameter("@strOrder","") }; using (SqlDataReader rdr = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.StoredProcedure, "XYP_SelectByWhere", Param)) { if (rdr.Read()) { lg = new XYECOM.Model.LogInfo(); lg.L_Content = rdr["L_Content"].ToString(); lg.L_ID = Int32.Parse(rdr["L_ID"].ToString()); lg.L_MF = rdr["L_MF"].ToString(); lg.L_Title = rdr["L_Title"].ToString(); lg.UM_ID = Int32.Parse(rdr["UM_ID"].ToString()); lg.L_AddTime = DateTime.Parse(rdr["L_addtime"].ToString()); } } return lg; }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { string userName = this.txtUserName.Text.Trim(); string password = this.txtPassWord.Text.Trim(); string code = this.txtCode.Text.Trim().ToLower(); if (userName == "" || password == "" || code == "") { this.ClientScript.RegisterClientScriptBlock(GetType(), "01", "<script>alertmsg(\"�û��������롢��֤�������д�� \")</script>"); return; } if (Core.Utils.GetSession("VNum") == null || Core.Utils.GetSession("VNum") == "") { this.ClientScript.RegisterClientScriptBlock(GetType(), "01", "<script>alertmsg(\"��֤����ڣ� \")</script>"); return; } if (txtCode.Text.Trim().ToLower() != Core.Utils.GetSession("VNum").ToLower()) { this.ClientScript.RegisterClientScriptBlock(GetType(), "01", "<script>alertmsg(\"��֤����� \")</script>"); return; } XYECOM.Business.Admin adminBLL = new XYECOM.Business.Admin(); int err = adminBLL.isMyUser(txtUserName.Text.Trim(), XYECOM.Core.SecurityUtil.MD5(txtPassWord.Text.Trim(), XYECOM.Configuration.Security.Instance.Md5value)); if (err > 0) { XYECOM.Model.AdminInfo adminInfo = adminBLL.GetItem(this.txtUserName.Text.Trim()); Session.Add("UM_ID", adminInfo.UM_ID); Session.Add("A_Name", userName); Session.Add("AdminName", userName); ////��cookie ���ܴ洢 XYECOM.Core.Utils.WriteCookie("AdminId", XYECOM.Core.SecurityUtil.AESEncrypt(adminInfo.UM_ID.ToString(), XYECOM.Configuration.Security.Instance.AESKey), ""); XYECOM.Core.Utils.WriteCookie("AdminName", XYECOM.Core.SecurityUtil.AESEncrypt(userName, XYECOM.Configuration.Security.Instance.AESKey), ""); XYECOM.Core.Utils.WriteCookie("AdminPwd", adminInfo.UM_Pwd, ""); XYECOM.Core.Utils.WriteCookie("AdminExpires", XYECOM.Core.SecurityUtil.AESEncrypt(DateTime.Now.AddMinutes(30).ToLongTimeString(), XYECOM.Configuration.Security.Instance.AESKey), ""); // ��½��־ XYECOM.Model.LogInfo el = new XYECOM.Model.LogInfo(); XYECOM.Business.Log l = new XYECOM.Business.Log(); el.L_Title = "��½��־����"; el.L_Content = "����Ա��½��Ϣ"; el.L_MF = "��½��־����"; el.UM_ID = adminInfo.UM_ID; l.Insert(el); Response.Redirect("default.htm"); } else { this.ClientScript.RegisterClientScriptBlock(GetType(), "01", "<script>alertmsg(\"�û�������������� \")</script>"); } }
protected void btnDelete_Click(object sender, EventArgs e) { XYECOM.Business.Log l = new XYECOM.Business.Log(); XYECOM.Model.LogInfo el = new XYECOM.Model.LogInfo(); XYECOM.Business.UserDomain ur = new XYECOM.Business.UserDomain(); string ids = ""; foreach (GridViewRow GR in this.gvlist.Rows) { HtmlInputCheckBox checkbox = GR.FindControl("chkExport") as HtmlInputCheckBox; if (checkbox != null && checkbox.Checked) { ids += "," + checkbox.Value; } } if (ids.IndexOf(",") == 0) { ids = ids.Substring(1); int i = ur.Delete(ids); if (i >= 0) { el.L_Title = "��������������"; el.L_Content = "ɾ��������������Ϣ�ɹ�"; el.L_MF = "�û�����"; { el.UM_ID = AdminId; } l.Insert(el); } else { el.L_Title = "��������������"; el.L_Content = "ɾ��������������Ϣʧ��"; el.L_MF = "�û�����"; { el.UM_ID = AdminId; } l.Insert(el); Alert("ɾ��ʧ�ܣ�"); } this.DataBind(); } }
protected void btnBackUpDatabase_Click(object sender, EventArgs e) { string prefix = DateTime.Now.ToString("yyyyMMddhhssmm"); string UserFileName = prefix + GenerateCheckCode(); database = GetSystemDatabaseName(); string path = Server.MapPath("/_BackUp/"); if (!Directory.Exists(path)) Directory.CreateDirectory(path); path += UserFileName + ".bak"; if (!File.Exists(path)) { try { StreamWriter stream = new StreamWriter(path); stream.Flush(); stream.Close(); } catch (Exception ex) { WriteLog("�������ݿ�ʧ��", ex); } } try { string backupSql = "use master;"; backupSql += "backup database @databse to disk =@path"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@databse",database), new SqlParameter("@path",path), }; XYECOM.Core.Data.SqlHelper.ExecuteNonQuery(CommandType.Text, backupSql, param); XYECOM.Business.Log l = new XYECOM.Business.Log(); XYECOM.Model.LogInfo el = new XYECOM.Model.LogInfo(); el.L_Title = "���ݿ�ά��"; el.L_Content = "�������ݿ�"; el.L_MF = "ϵͳ����"; { el.UM_ID = AdminId; } l.Insert(el); Alert("���ݳɹ���"); ReadBackFile(); } catch (Exception ex) { string url = "DataList.aspx"; Alert("����ʧ�ܣ�<br/>(Ŀǰ��֧�ֳ�������������ݷ�����Ϊͬһ�������ı��ݲ�����", url); WriteLog("�������ݿ�ʧ�ܣ�", ex); } }
protected void btnExexSql_Click(object sender, EventArgs e) { string sql = this.txtSQL.Text.Trim(); if (sql.Equals("")) { this.lblExecSqlResult.InnerHtml = "������SQL���!"; return; } this.lblExecSqlResult.InnerHtml = ""; string result = "ִ�гɹ���"; try { int rows = XYECOM.Core.Data.SqlHelper.ExecuteNonQuery(sql); if (rows>=0)result += "��Ӱ�������Ϊ��" + rows +" �С�"; } catch (SqlException ex) { result = ex.Message + "<br/><br/>" + ex.StackTrace; } finally { XYECOM.Model.LogInfo el = new XYECOM.Model.LogInfo(); el.L_Title = "���ݿ�ά��"; el.L_Content = this.txtSQL.Text; el.L_MF = "ϵͳ����"; { el.UM_ID = AdminId; } new XYECOM.Business.Log().Insert(el); } this.lblExecSqlResult.InnerHtml = result; }