protected void btnDownloadExcel_Click(object sender, DirectEventArgs e) { try { Response.Clear(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + ExcelTemplateUrl.Substring(ExcelTemplateUrl.LastIndexOf("/") + 1)); Response.WriteFile(Server.MapPath(ExcelTemplateUrl)); Response.End(); } catch (Exception ex) { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage")); NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("DownloadExcel"), MOTA = "ExcelReader/btnDownloadExcel_Click = " + ex.Message.Replace("'", ""), IsError = true, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } }
protected void btnSetChartDefault_Click(object sender, DirectEventArgs e) { if (!string.IsNullOrEmpty(hdfChartUrl.Text)) { XDocument xDoc = XDocument.Load(Server.MapPath("XMLConfig.xml")); var linkChart = (from t in xDoc.Descendants("Chart") where t.Attribute("userid").Value == CurrentUser.ID.ToString() select t.Element("UserSetDefault")); if (linkChart.Count() != 0) { linkChart.FirstOrDefault().Value = hdfChartUrl.Text; xDoc.Save(Server.MapPath("XMLConfig.xml")); } else //Tạo mới { XElement column = new XElement("Chart", new XElement("UserSetDefault", hdfChartUrl.Text)); column.SetAttributeValue("userid", CurrentUser.ID); xDoc.Root.Add(column); xDoc.Save(Server.MapPath("XMLConfig.xml")); } //Ghi log cho việc thay đổi chart mặc định string chartName = string.Empty; if (hdfChartUrl.Text.Contains("Country")) { chartName = "Biểu đồ quốc tịch"; } else { chartName = hdfChartUrl.Text; } NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = "Thay đổi chart mặc định", IsError = false, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", MOTA = "Biểu đồ : " + chartName, }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } }
/// <summary> /// Ghi log lịch sử truy cập /// </summary> private void SaveLog(string userName) { NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { MOTA = GlobalResourceManager.GetInstance().GetHistoryAccessValue("Login"), CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("Login"), IsError = false, USERNAME = userName, THOIGIAN = DateTime.Now, MANGHIEPVU = "Users", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); }
protected void btnAddFunction_Click(object sender, DirectEventArgs e) { try { FunctionInfo info = new FunctionInfo() { ControlText = txtControlText.Text, Description = txtDescription.Text, MenuID = int.Parse(hdfTreeNodeID.Text), ParentID = int.Parse(cbxChucNangCha.SelectedItem.Value.ToString()) }; FunctionController.GetInstance().CreateFunction(info); if (e.ExtraParams["Continue"] == "No") { wdFunction.Hide(); } if (string.IsNullOrEmpty(hdfRoleID.Text) == false || AjaxSearchUser.GetValue() != null) { Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("SetPermissionSuccess")); } else { Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("AddFunctionSuccess")); } ResourceManager1.RegisterClientScriptBlock("ds", "resetWdFunction();"); } catch (Exception ex) { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage")); NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("AddFunction") + " Default/btnAddFunction_Click", MOTA = ex.Message.Replace("'", " "), IsError = true, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "Functions", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } }
//logout protected void BtnLogout_Click(object sender, DirectEventArgs e) { NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { MOTA = GlobalResourceManager.GetInstance().GetLanguageValue("software_online_system"), CHUCNANG = GlobalResourceManager.GetInstance().GetLanguageValue("software_online_system"), IsError = false, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "Users", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); Session.Abandon(); Response.Redirect("Login.aspx"); }
protected void Page_Load(object sender, EventArgs e) { //if (!X.IsAjaxRequest) //{ //} grp_nhatkytrucap.AddComponent(btnTruncateHistory, 2); grp_nhatkytrucap.HiddenDuplicateButton(true); if (!X.IsAjaxRequest) { NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("History"), MOTA = GlobalResourceManager.GetInstance().GetHistoryAccessValue("History"), IsError = false, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "NHATKY_TRUYCAP", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } Ext.Net.Button btnChooseTime = new Ext.Net.Button() { Text = "Chọn thời gian", Icon = Icon.Clock, }; btnChooseTime.Listeners.Click.Handler = "#{wdChooseTime}.show();"; if (!X.IsAjaxRequest) { grp_nhatkytrucap.HiddenAddButton(true); grp_nhatkytrucap.HiddenEditButton(true); grp_nhatkytrucap.HiddenHelpButton(true); grp_nhatkytrucap.HiddenTienIch(true); } grp_nhatkytrucap.AddComponent(btnChooseTime, 0); }
/// <summary> /// Load khớp nối các cột /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MyData_Refresh(object sender, StoreRefreshDataEventArgs e) { try { if (new FileInfo(Server.MapPath(MathRuleXmlUrl)).Exists == false) { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("MathRuleFileNotExist")); return; } if (fUpload.HasFile == false) { return; } //Load các qui tắc khớp nối ở file XML ruleList = new XMLProcess().GetAll(XDocument.Load(Server.MapPath(MathRuleXmlUrl)), true); //chuyển thành true //Lấy các cột trong file Excel IEnumerable <string> ColumnInExcelFile = ExcelEngine.GetInstance().GetColumnName(Server.MapPath(ExcelStoreFolder + "/") + fUpload.FileName, cbSheetName.SelectedItem.Value); List <object> objData = new List <object>(); foreach (string item in ColumnInExcelFile) { objData.Add(new { ColumnName = item }); } ColumnStore.DataSource = objData; ColumnStore.DataBind(); //List<string> listsID = new List<string>(); List <object> db = new List <object>(); foreach (var item in ruleList) { string mMathStatus = "false"; List <string> lists = new List <string>(); string[] objs = item.ColumnInExcel.Split(';'); for (int i = 0; i < objs.Length; i++) { lists.Add(objs[i].Trim()); } string excelColumnName = getColumnInExcel(lists, ColumnInExcelFile.ToList()); if (excelColumnName != "") { mMathStatus = "true"; } db.Add(new MathRule { ColumnInDB = item.ColumnInDB, ColumnInSoftware = item.ColumnInSoftware, ColumnInExcel = excelColumnName, AllowBlank = item.AllowBlank, MathStatus = mMathStatus, DataType = item.DataType, }); if (mMathStatus == "false") { hdfMathStatus.Text += item.ColumnInDB + ", "; } } Store1.DataSource = db; Store1.DataBind(); } catch (Exception ex) { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage")); NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("MathColumnInExcel"), MOTA = "ExcelReader/MyData_Refresh = " + ex.Message.Replace("'", ""), IsError = true, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } }
/// <summary> /// Reset mật khẩu người dùng /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void mnuResetPassword_Click(object sender, DirectEventArgs e) { string userid = ""; string failUserId = ""; try { string[] ds = hdfListUserID.Text.Split(','); List <string> userIDList = new List <string>(); for (int i = 0; i < ds.Count(); i++) { if (ds[i] != "") { userIDList.Add(ds[i]); } } string mailContent = Util.GetInstance().ReadFile(Server.MapPath("EmailHTML/ResetPassword.htm")); string systemName = new HeThongController().GetValueByName(SystemConfigParameter.COMPANY_NAME, Session["MaDonVi"].ToString()).ToString(); string systemEmail = new HeThongController().GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString()); string systemPassword = new HeThongController().GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString()); foreach (var item in userIDList) { string password = Util.GetInstance().GetRandomString(7); UserInfo u = UsersController.GetInstance().GetUser(int.Parse(item)); if (Email.SendEmail(systemEmail, systemPassword, systemName, u.Email, "Thông báo mật khẩu mới", string.Format(mailContent, password, u.DisplayName))) { u.Password = password; UsersController.GetInstance().UpdateUser(u); userid += item + ", "; } else { failUserId += item + ", "; } } if (!string.IsNullOrEmpty(failUserId)) { X.MessageBox.Alert("Thông báo", "Các mã tài khoản sau không đổi đổi được mật khẩu: " + failUserId).Show(); } else { X.MessageBox.Alert("Thông báo", GlobalResourceManager.GetInstance().GetLanguageValue("ResetPasswordSuccess")).Show(); } NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("ResetPassword"), MOTA = GlobalResourceManager.GetInstance().GetHistoryAccessValue("ResetPassword"), IsError = false, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "Users", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "Các UserId bị reset mật khẩu : " + userid, }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); } catch (Exception ex) { NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = GlobalResourceManager.GetInstance().GetHistoryAccessValue("ResetPassword"), MOTA = ex.Message.Replace("'", " "), IsError = true, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "Users", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "Các UserId bị reset mật khẩu : " + userid, }; new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage")); } }
protected void btnCapNhat_Click(object sender, DirectEventArgs e) { try { DaoTaoController daotao = new DaoTaoController(); DAL.KEHOACH_DAOTAO kehoach = new DAL.KEHOACH_DAOTAO() { MA = frm_txtMaKhoaDaoTao.Text.Trim(), TEN_KHOA_HOC = frm_txtTenKhoaDaoTao.Text.Trim(), MA_CHUNGCHI = frm_cbChungChi.SelectedItem.Value, CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, MA_DONVI = new UserController().GetDonViByUserID(CurrentUser.ID).FirstOrDefault().MA_DONVI, DIA_DIEM_DAOTAO = frm_txtDiaDiemDaoTao.Text, THOI_GIAN_DAOTAO = frm_txtThoiLuongDaoTao.Text, DOITUONG_DAOTAO = frm_txtDoiTuongDaoTao.Text, LYDO_DAOTAO = frm_txtLyDoDaoTao.Text, NOIDUNG_DAOTAO = frm_txtNoiDungDaoTao.Text, GHI_CHU = frm_txtGHiChi.Text, MA_DONVIPHUTRACHDAOTAO = frm_cbPhuTrachDaoTao.SelectedItem.Value, TEN_DONVIPHUTRACHDAOTAO = frm_cbPhuTrachDaoTao.SelectedItem.Text, TRANG_THAI = frm_cbTrangThai.SelectedItem.Value }; if (!frm_dfBatDauDaoTao.Text.Contains("01/01/0001")) { kehoach.TU_NGAY = frm_dfBatDauDaoTao.SelectedDate; } if (!frm_dfKetThucDaoTao.Text.Contains("01/01/0001")) { kehoach.DEN_NGAY = frm_dfKetThucDaoTao.SelectedDate; } if (!frm_dfBatDauDangKy.Text.Contains("01/01/0001")) { kehoach.BATDAU_DANGKY = frm_dfBatDauDangKy.SelectedDate; } if (!frm_dfHetHanDangKy.Text.Contains("01/01/0001")) { kehoach.HETHAN_DANGKY = frm_dfHetHanDangKy.SelectedDate; } // kehoach.MA_CHUNGCHI = frm_cbChungChi.SelectedItem.Value; if (!string.IsNullOrEmpty(frm_txtSoLuongHocVien.Text)) { kehoach.SOLUONG_HOCVIEN = int.Parse(frm_txtSoLuongHocVien.Text); } if (!string.IsNullOrEmpty(frm_txtKinhPhiDuKien.Text)) { kehoach.KINHPHI_DUKIEN = decimal.Parse(frm_txtKinhPhiDuKien.Text); } if (!string.IsNullOrEmpty(frm_txtKinhPhiThucTe.Text)) { kehoach.KINHPHI_THUCTE = decimal.Parse(frm_txtKinhPhiThucTe.Text); } if (!string.IsNullOrEmpty(frm_txtCongTyHoTro.Text)) { kehoach.KINHPHI_CTY_HOTRO = decimal.Parse(frm_txtCongTyHoTro.Text); } if (!string.IsNullOrEmpty(frm_txtNhanVienDongGop.Text)) { kehoach.KINHPHI_NHANVIEN_DONG = decimal.Parse(frm_txtNhanVienDongGop.Text); } NhatkyTruycapInfo accessDiary = new NhatkyTruycapInfo() { CHUCNANG = "Thêm kế hoạch đào tạo", MOTA = "Thêm kế hoạch đào tạo", IsError = false, USERNAME = CurrentUser.UserName, THOIGIAN = DateTime.Now, MANGHIEPVU = "KEHOACH_DAOTAO", TENMAY = Util.GetInstance().GetComputerName(Request.UserHostAddress), IPMAY = Request.UserHostAddress, THAMCHIEU = "", }; if (e.ExtraParams["Command"] == "Edit") { accessDiary.CHUCNANG = "Sửa kế hoạch đào tạo"; accessDiary.MOTA = "Mã kế hoạch đào tạo được sửa là : " + frm_txtMaKhoaDaoTao.Text; daotao.Update(kehoach); } else { daotao.Insert(kehoach); } new SoftCore.AccessHistory.AccessHistoryController().AddAccessHistory(accessDiary); if (e.ExtraParams["Close"] == "True") { wdAddWindow.Hide(); } RM.RegisterClientScriptBlock("zz", "#{Store1}.reload();"); } catch (Exception ex) { if (ex.Message.Contains(" Cannot insert duplicate key in object ")) { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("DuplicateMaDaoTao")); } else { Dialog.ShowError("Lối xảy ra " + ex.Message); } } }