// /// <summary> /// /// </summary> /// <param name="host">smtp.gmail.com</param> /// <param name="port">587</param> /// <param name="mailsend">Địa chỉ mail gửi</param> /// <param name="password">Mật khẩu địa chỉ gửi</param> /// <param name="MailName">Tên người gửi</param> /// <param name="mailto">Mail đến</param> /// <param name="titlemail">Tiêu đề mail</param> /// <param name="bodymail">Nội dung mail</param> public void SendMail(string host, int port, string mailsend, string password, string MailName, string mailto, string titlemail, string bodymail) { #region [Sendmail] System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(); mailMessage.From = (new MailAddress(mailsend, MailName, System.Text.Encoding.UTF8)); mailMessage.To.Add(mailto); mailMessage.Bcc.Add(mailto); mailMessage.Subject = titlemail; mailMessage.SubjectEncoding = System.Text.Encoding.UTF8; mailMessage.Body = bodymail; mailMessage.IsBodyHtml = true; mailMessage.BodyEncoding = System.Text.Encoding.UTF8; System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential(); mailAuthentication.UserName = mailsend; mailAuthentication.Password = password; System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient(host, port); mailClient.EnableSsl = true; mailClient.UseDefaultCredentials = false; mailClient.Credentials = mailAuthentication; try { mailClient.Send(mailMessage); Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetDesktopValue("UpdateComplete")); } catch (Exception ex) { //ExtMessage.Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetCommonMessageValue("Error")); return; } #endregion }
/// <summary> /// Load biểu đồ mặc định của chương trình hoặc do người dùng thiết lập /// </summary> private void SetChartDefault() { if (new FileInfo(Server.MapPath("XMLConfig.xml")).Exists) { XDocument xDoc = XDocument.Load(Server.MapPath("XMLConfig.xml")); try { var UserSetDefault = (from t in xDoc.Descendants("Chart") where t.Attribute("userid").Value == CurrentUser.ID.ToString() select t.Element("UserSetDefault")); if (UserSetDefault.Count() != 0) { hdfChartUrl.Text = UserSetDefault.FirstOrDefault().Value; if (UserSetDefault.FirstOrDefault().Value.IndexOf("BDNhanSu") >= 0) { cbxChonNam.Hidden = false; tbsChonNam.Hidden = false; } lblIframe.Html = string.Format("<iframe height='400' frameborder='0' id='iframeChart' width='100%' src='{0}' />", UserSetDefault.FirstOrDefault().Value); } else { lblIframe.Html = "<iframe height='400' frameborder='0' id='iframeChart' width='100%' src='chart/ColumnChart.aspx?type=NSDonVi' />"; } } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("thong_bao"), ex.Message).Show(); } } }
private void BindData(object[] _data, string Title, int nHeight, int nSize, bool showInLegend) { try { hcVendas.Title = new Title(Title); // hcVendas.SubTitle = new SubTitle("(Chỉ thống kê theo những nhân viên đang làm việc)"); hcVendas.Height = nHeight; var series = new Collection <Serie>(); series.Add(new Serie { size = nSize, data = _data }); hcVendas.PlotOptions = new PlotOptionsPie { allowPointSelect = true, cursor = "pointer", dataLabels = new DataLabels { enabled = true, align = Align.right, y = 10, verticalAlign = Highcharts.Core.VerticalAlign.top }, animation = true, enableMouseTracking = true, showInLegend = showInLegend, }; hcVendas.Legend = new Legend() { enabled = true, layout = Highcharts.Core.Layout.vertical, align = Align.left, verticalAlign = Highcharts.Core.VerticalAlign.top, x = 5, y = 10, floating = true, shadow = true, backgroundColor = "#FFF", }; if (displayPercentage) { //hide percentage when mouse hover hcVendas.Tooltip = new ToolTip("'<b>'+ this.point.name +'</b>'"); } else { //display percentage when mouse hover hcVendas.Tooltip = new ToolTip("'<b>'+ this.point.name +'</b>: '+ this.y +' %'"); } hcVendas.Exporting.enabled = true; hcVendas.DataSource = series; hcVendas.DataBind(); } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), ex.Message).Show(); } }
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 Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { hdfCurrentUserID.Text = CurrentUser.ID.ToString(); // chon nam cbxChonNamStore.DataSource = getYear(Session["MaDonVi"].ToString()); cbxChonNamStore.DataBind(); hdfMaDonVi.Text = Session["MaDonVi"].ToString(); SetChartDefault(); try { string[] tmp = Session["DataHomePage"].ToString().Split(';'); if (int.Parse(tmp[0]) > 0) { pnlSinhNhatNhanVien.Title += " <span style='color:red;'>(" + tmp[0] + " " + GlobalResourceManager.GetInstance().GetDesktopValue("staff") + ")</span>"; } if (int.Parse(tmp[1]) > 0) { pnlNhanVienSapHetHopDong.Title += " <span style='color:red;'>(" + tmp[1] + " " + GlobalResourceManager.GetInstance().GetDesktopValue("staff") + ")</span>"; } } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetDesktopValue("warning"), ex.Message).Show(); } SetVisibleByRole(); LoadDonVi(); } }
/// <summary> /// Lấy định dạng ngày /// </summary> /// <returns></returns> public string GetDateFormat(DateTime date) { if (GlobalResourceManager.GetInstance().GetCurrentCulture() == "vi-VN") { return(string.Format("{0:dd/MM/yyyy}", date)); } return(string.Format("MM/dd/yyyy}", date)); }
/* * Reset password */ protected void btnResetPassword_Click(object sender, DirectEventArgs e) { try { string userName = txtResetUsername.Text; string email = txtResetEmail.Text; string maDonVi = string.Empty;//Mã đơn vị của người khôi phục mật khẩu if (new UserController().CheckUserResetPassword(userName, email, ref maDonVi)) { string newPassword = Util.GetInstance().GetRandomString(7); HeThongController htController = new HeThongController(); string systemGmail = htController.GetValueByName(SystemConfigParameter.EMAIL, maDonVi); string systemGmailPassword = htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, maDonVi); if (string.IsNullOrEmpty(systemGmail) || string.IsNullOrEmpty(systemGmailPassword)) { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), "Chưa có thông tin Email của hệ thống, bạn hãy liên hệ với người quản lý phần mềm để được hỗ trợ !").Show(); return; } string mailName = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_forgot_password"); string subject = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_forgot_password"); string content = Util.GetInstance().ReadFile(Server.MapPath("Modules/MailTemplate/ForgotPassword." + GlobalResourceManager.GetInstance().GetCurrentCulture() + ".html")); SoftCore.User.UserInfo uinfo = UsersController.GetInstance().GetUser(userName); if (uinfo.DisplayName == null) { content = string.Format(content, userName, userName, newPassword); } else { content = string.Format(content, uinfo.DisplayName, userName, newPassword); } if (SoftCore.Utilities.Email.SendEmail(systemGmail, systemGmailPassword, mailName, email, subject, content)) { uinfo.ChangePassword(newPassword); X.Msg.Alert("Đổi mật khẩu thành công", GlobalResourceManager.GetInstance().GetLanguageValue("email_notice_forgot_password")).Show(); wdResetPassword.Hide(); } else { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), "Xin lỗi ,Khôi phục mật khẩu không thành công !").Show(); } } else { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), GlobalResourceManager.GetInstance().GetLanguageValue("email_error_forgot_password")).Show(); } txtResetUsername.Clear(); txtResetEmail.Clear(); } catch (Exception ex) { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), ex.Message).Show(); } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { ltrApplicationName.Text = GlobalResourceManager.GetInstance().GetLanguageValue("software_online_system"); //load combobox để thực hiện cho việc add module - super user if (CurrentUser.IsSuperUser) { List <ModuleInfo> ModulesList = ModuleController.GetInstance().GetAllModules(Server.MapPath("Modules")); foreach (ModuleInfo item in ModulesList) { cbModule.Items.Add(new Ext.Net.ListItem(item.ModuleName)); } LoadRole(this.TreePanel1); //Load role cho việc thiết lập menu, chỉ load khi có quyền LoadTreeIncludeCheckBox(); //cái này chỉ áp dụng cho super admin để thêm module //hiện phân quyền btnSystem.Visible = true; btnSystem_PermissionList.Visible = true; } try { string menuType = new HeThongController().GetValueByName("MENU_TYPE", Session["MaDonVi"].ToString()); if (menuType.Equals("Horizontal")) { LoadTopMenu(); //load menu ngang } else { if (menuType.Equals("VerticalCollapsed")) { LoadLeftMenu(true); //Load menu dọc thu nhỏ } else { LoadLeftMenu(false); //Load menu dọc } } } catch (Exception ex) { Dialog.ShowError("Default.aspx = " + ex.Message); } ModuleFileRefresh(null, null); if (!string.IsNullOrEmpty(CurrentUser.DisplayName)) { btnDisplayName.Text = CurrentUser.DisplayName; } else { btnDisplayName.Text = CurrentUser.FirstName + " " + CurrentUser.LastName; } SetVisibleByRole(); } LoadRole(this.TreePanelRole); }
protected void cbxChonNamStore_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { try { string maDV = Session["MaDonVi"].ToString(); List <object> obj = getYear(maDV); cbxChonNamStore.DataSource = obj; cbxChonNamStore.DataBind(); } catch (Exception ex) { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("thong_bao"), ex.Message.ToString()).Show(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["userID"])) { userID = int.Parse(Request.QueryString["userID"]); } string h = Request.QueryString["height"]; int height = (h == null) ? 250 : Int32.Parse(h); string macb = Request.QueryString["id"]; int thang = int.Parse(Request.QueryString["thang"] == null ? "0" : Request.QueryString["thang"]); int nam = int.Parse(Request.QueryString["nam"] == null ? "0" : Request.QueryString["nam"]); switch (Request.QueryString["type"]) { case "NSDonVi": string dsDonVi = Request.QueryString["dv"]; if (string.IsNullOrEmpty(dsDonVi)) { dsDonVi = Session["MaDonVi"].ToString(); } GenerateNhanSuTheoDonVi(height, dsDonVi); break; case "Age": BieuDoTheoDoTuoi(height); break; case "DiMuonVeSom": BieuDoThongKeTinhTrangDiMuonVeSom(macb, thang, nam, height); break; //case "BDNhanSu": // BieuDoBienDongNhanSu(); // break; default: //GenerateNhanSuTheoDonVi(height); break; } } } catch (Exception ex) { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), "Có lỗi xảy ra: " + ex.Message).Show(); } }
protected void RM_DocumentReady(object sender, DirectEventArgs e) { try { int count = new TuCapNhatController().GetCount("ChuaDuyet", Session["MaDonVi"].ToString()); if (count > 0) { pnlHoSoNhanSuCanDuyet.Title += string.Format("<span style='color:red'> ({0} " + GlobalResourceManager.GetInstance().GetDesktopValue("staff") + ")</span>", count); } } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("error"), ex.Message).Show(); } }
/// <summary> /// Xóa menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MnuDeleteMenu_Click(object sender, DirectEventArgs e) { if (!string.IsNullOrEmpty(hdfTreeNodeID.Text)) { try { MenuController.GetInstance().DeleteMenu(int.Parse(hdfTreeNodeID.Text)); Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("delete_successful_refresh_page")); } catch (Exception ex) { Dialog.ShowError(ex.Message); } } }
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); } }
/// <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); }
/// <summary> /// Thêm mới menu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InsertMenu() { MenuInfo menuInfo = new MenuInfo() { MenuName = txtMenuName.Text, IsDeleted = false, Order = 1, ParentID = int.Parse(hdfParentID.Text), TabName = txtTabName.Text, CreatedBy = CurrentUser.ID, EdittedBy = CurrentUser.ID, Icon = txtIcon.Text, IsPanel = chkIsMenuPanel.Checked }; if (!string.IsNullOrEmpty(cbFile.SelectedItem.Value)) { string LinkUrl = cbFile.SelectedItem.Value.Replace("\\", "/"); menuInfo.LinkUrl = LinkUrl.Substring(LinkUrl.IndexOf("Modules/")); } else { menuInfo.LinkUrl = txtMenuLink.Text; } int menuID = MenuController.GetInstance().InsertMenu(menuInfo); if (menuID > 0) { string[] roleID = hdfRoleID.Text.Split(','); foreach (string item in roleID) { if (!string.IsNullOrEmpty(item)) { MenuController.GetInstance().AddRole(menuID, int.Parse(item), UsersController.GetInstance().GetCurrentUser().ID, false); } } Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("add_menu_successful")); } else { Dialog.ShowError(GlobalResourceManager.GetInstance().GetLanguageValue("error")); } }
protected void btnSendEmail_Click(object sender, DirectEventArgs e) { try { string mailto = e.ExtraParams["Email"]; if (string.IsNullOrEmpty(mailto)) { X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), GlobalResourceManager.GetInstance().GetDesktopValue("email_not_found")).Show(); return; } HeThongController htController = new HeThongController(); SendMail1.SetEmailTo(htController.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString()), htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString()), mailto); SendMail1.Show(); } catch (Exception ex) { X.Msg.Alert("Cảnh báo", ex.Message).Show(); } }
//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"); }
/// <summary> /// Quốc tịch /// </summary> /// <param name="height"></param> /// <param name="size"></param> private void Country(int height, int size) { try { // lay ma don vi string maDV = Session["MaDonVi"].ToString(); DataTable table = DataController.DataHandler.GetInstance().ExecuteDataTable("BieuDo_ThongKeNhanSuTheoQuocTich", "@MaDonVi", "@UserID", "@MenuID", maDV, userID, menuID); int total = 0, max = 0, k = 0; foreach (DataRow item in table.Rows) { if (int.Parse(item["Count"].ToString()) > 0) { total += int.Parse(item["Count"].ToString()); max++; } } object[] _data = new object[max]; float percentage = 0; for (int i = 0; i < table.Rows.Count; i++) { if (int.Parse(table.Rows[i]["Count"].ToString()) > 0) { percentage = (float.Parse(table.Rows[i]["Count"].ToString()) / (float)total) * 100; if (displayPercentage) { _data[k++] = new object[] { table.Rows[i]["TEN_NUOC"] + " (" + table.Rows[i]["Count"] + " người, chiếm " + percentage + " %)", percentage }; } else { _data[k++] = new object[] { table.Rows[i]["TEN_NUOC"] + " (" + table.Rows[i]["Count"] + ")", percentage }; } } } BindData(_data, GlobalResourceManager.GetInstance().GetDesktopValue("chart_by_natinonality"), height, size, true); } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), ex.Message).Show(); } }
private void UploadFile() { try { //upload file HttpPostedFile file = fUpload.PostedFile; if (file.FileName.IndexOf(".xls") == -1) //ko phải Excel 2003 { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("NotExcel2003")); return; } if (fUpload.HasFile == false && file.ContentLength > 2000000) { Dialog.ShowNotification("File không được lớn hơn 200kb"); return; } else { string path = string.Empty; try { DirectoryInfo dir = new DirectoryInfo(Server.MapPath(ExcelStoreFolder)); if (dir.Exists == false) { dir.Create(); } path = Server.MapPath(ExcelStoreFolder + "/") + fUpload.FileName; file.SaveAs(path); } catch (Exception ex) { Dialog.ShowError(ex.Message); } } } catch (Exception ex) { Dialog.ShowNotification(ex.Message); } }
private void UploadFile() { try { //upload file HttpPostedFile file = FileUploadField1.PostedFile; if (file.ContentType != "application/vnd.ms-excel") //ko phải Excel 2003 { Dialog.ShowError(GlobalResourceManager.GetInstance().GetErrorMessageValue("NotExcel2003")); return; } if (FileUploadField1.HasFile == false && file.ContentLength > 2000000) { Dialog.ShowNotification("File không được lớn hơn 200kb"); return; } else { string path = string.Empty; try { DirectoryInfo dir = new DirectoryInfo(Server.MapPath("Files")); if (dir.Exists == false) { dir.Create(); } path = Server.MapPath("Files/") + FileUploadField1.FileName; file.SaveAs(path); } catch (Exception ex) { Dialog.ShowError(ex.Message); } } } catch (Exception ex) { Dialog.ShowNotification(ex.Message); } }
protected void btnLogin_Click(object sender, DirectEventArgs e) { try { string donviId = ""; UserController c = new UserController(); DAL.User user = new UserController().CheckLogin(txtUserName.Text, txtPassword.Text); if (user != null) { // lấy danh sách các bộ phận được truy cập tìm cán bộ sinh nhật trong tháng string dsDv = new DepartmentRoleController().GetMaBoPhanByRole(user.ID, DepartmentRoleController.MENUID_BIRTHDAY); DAL.DM_DONVI department = c.GetDonViByUserID(user.ID).FirstOrDefault(); if (department != null) { donviId = department.MA_DONVI; SoftCore.User.UserInfo uInfo = new SoftCore.User.UserInfo(user.ID, user.UserName, user.FirstName, user.LastName, user.Image, user.DisplayName, user.Email, user.IsSuperUser, user.IsLock, user.Phone, user.Address, user.CreatedBy, user.CreatedOn, user.EdittedBy, user.EdittedOn, user.Password, user.Birthday, user.Gender); Session["CURRENTUSER"] = uInfo; Session["USERNAME"] = txtUserName.Text; object objCount = DataController.DataHandler.GetInstance().ExecuteScalar("Hopdong_CountDanhSachNhanVienSapHetHopDong", "@day", "@MaDonVi", "@UserID", "@MenuID", 30, donviId, uInfo.ID, DepartmentRoleController.MENUID_CONTRACT); object objSNhat = DataController.DataHandler.GetInstance().ExecuteScalar("report_CountBirthdayOfEmployee", "@MaDonVi", "@MaBoPhan", "@startMonth", "@endMonth", "@Gender", "@whereClause", donviId, dsDv, DateTime.Now.Month, DateTime.Now.Month, "", "1=1"); Session["DataHomePage"] = objSNhat + ";" + objCount; Session["MaDonVi"] = donviId; Session["Language"] = cbLanguage.SelectedItem.Value; Response.Redirect("Default.aspx"); } else { X.MessageBox.Alert("Có lỗi xảy ra", "Tài khoản này chưa được cấp phát quyền đăng nhập").Show(); } } else { RM.RegisterClientScriptBlock("al", "Ext.Msg.alert('" + GlobalResourceManager.GetInstance().GetErrorMessageValue("LoginFail") + "', '" + GlobalResourceManager.GetInstance().GetErrorMessageValue("LoginFailMessage") + "');"); } } catch (Exception ex) { RM.RegisterClientScriptBlock("al", "Ext.Msg.alert('Error', \"" + ex.Message + "\");"); } }
/// <summary> /// Loại hợp đồng /// </summary> /// <param name="height"></param> /// <param name="size"></param> private void ContractType(int height, int size) { try { string maDV = Session["MaDonVi"].ToString(); DataTable table = DataHandler.GetInstance().ExecuteDataTable("BieuDo_ThongKeNhanSuTheoLoaiHopDong", "@MaDonVi", "@UserID", "@MenuID", maDV, userID, menuID); int total = 0, tong = 0, k = 0; foreach (DataRow item in table.Rows) { if (int.Parse(item["Count"].ToString()) > 0) { total += int.Parse(item["Count"].ToString()); tong++; } } object[] data = new object[tong]; float percentage = 0; for (int i = 0; i < table.Rows.Count; i++) { if (int.Parse(table.Rows[i]["Count"].ToString()) > 0) { percentage = (float.Parse(table.Rows[i]["Count"].ToString()) / (float)total) * 100; if (displayPercentage) { data[k++] = new object[] { table.Rows[i]["TEN_LOAI_HDONG"].ToString() + " (" + table.Rows[i]["Count"] + " người, chiếm " + percentage + " %)", percentage }; } else { data[k++] = new object[] { table.Rows[i]["TEN_LOAI_HDONG"].ToString() + " (" + table.Rows[i]["Count"] + ")", percentage }; } } } BindData(data, GlobalResourceManager.GetInstance().GetDesktopValue("chart_by_contract_type"), height, size, true); } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), ex.Message).Show(); } }
private List <object> getYear(string maDV) { List <Int32> lists = new ChartController().GetDanhSachNam(maDV); lists.Sort(new MyComparation()); List <object> obj = new List <object>(); if (!lists.Contains(DateTime.Now.Year)) { obj.Add(new { ID = DateTime.Now.Year, Title = DateTime.Now.Year }); } for (int i = 0; i < lists.Count; i++) { obj.Add(new { ID = lists[i], Title = lists[i] }); } if (obj.Count == 0) { obj.Add(new { ID = -1, Title = GlobalResourceManager.GetInstance().GetLanguageValue("not_have_data") }); } return(obj); }
protected void btnAddRole_Click(object sender, DirectEventArgs e) { try { //check xem user này đã có trong bảng DOnvi_User chưa foreach (var selectedUsers in RowSelectionModel1.SelectedRows) { if (!new DM_DONVIController().UserIsInAnyDepartments(int.Parse(selectedUsers.RecordID))) { X.MessageBox.Alert("Cảnh báo", "Người dùng có <b>mã tài khoản = " + selectedUsers.RecordID + "</b> không thể thiết lập quyền vì chưa nằm trong bộ phận nào !").Show(); return; } } // Xóa quyền cũ để thiết lập quyền mới foreach (var selectedUsers in RowSelectionModel1.SelectedRows) { UsersController.GetInstance().DeleteUserRoleByUserID(int.Parse(selectedUsers.RecordID)); } string[] roleList = hdfSelectedNodeID.Text.Split(','); foreach (var item in roleList) { if (item.Length != 0) { int roleId = int.Parse(item); foreach (var selectedUsers in RowSelectionModel1.SelectedRows) { UsersController.GetInstance().SetRoles(int.Parse(selectedUsers.RecordID), roleId); } } } } catch (Exception ex) { Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetErrorMessageValue("DefaultErrorMessage")); } wdAssignRole.Hide(); Dialog.ShowNotification("Thiết lập quyền thành công !"); }
protected void btnUpdatePassword_Click(object sender, DirectEventArgs e) { if (CurrentUser == null) { CurrentUser = Session["CURRENTUSER"] as UserInfo; // CurrentUser = UsersController.GetInstance().GetCurrentUser(); } if (CurrentUser.Password != Hash.GetSHA256(txtOldPassword.Text)) { Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("old_password_not_valid")); return; } if (CurrentUser.ChangePassword(txtNewPassword.Text)) { Dialog.ShowNotification(GlobalResourceManager.GetInstance().GetLanguageValue("change_password_successful")); } else { Dialog.ShowError(GlobalResourceManager.GetInstance().GetLanguageValue("error")); } wdChangePassword.Hide(); }
/// <summary> /// Bind Biểu đồ giới tính /// </summary> private void Gender(int height, int size) { try { // lay ma don vi string maDV = Session["MaDonVi"].ToString(); int male = 0; int female = 0; float percentageMale = 0; float percentageFemale = 0; new ChartController().GetGenderNumber(out male, out female, maDV, userID, menuID); float nam = ((float)male / (float)(male + female)) * 100; percentageMale = ((float)male / ((float)male + (float)female)) * 100; percentageFemale = (100 - percentageMale); if (displayPercentage) { object[] data = new object[] { new object[] { "Nam" + " (" + male + " người, chiếm " + percentageMale + " % )", nam }, new object[] { "Nữ" + " (" + female + " người, chiếm " + percentageFemale + " % )", 100 - nam }, }; BindData(data, GlobalResourceManager.GetInstance().GetDesktopValue("chart_by_gender"), height, size, true); } else { object[] data = new object[] { new object[] { "Nam" + " (" + male + ")", nam }, new object[] { "Nữ" + " (" + female + ")", 100 - nam }, }; BindData(data, GlobalResourceManager.GetInstance().GetDesktopValue("chart_by_gender"), height, size, true); } } catch (Exception ex) { X.MessageBox.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), ex.Message).Show(); } }
protected void Page_Load(object sender, EventArgs e) { hdfIdBangChamCong.Text = idBangChamCong;// Request.QueryString["blID"]; if (!X.IsAjaxRequest) { string scriptContextMenu = "e.preventDefault(); " + RowContextMenu.ClientID + ".dataRecord = this.store.getAt(rowIndex);" + RowContextMenu.ClientID + ".showAt(e.getXY());" + RowSelectEvent.ClientID + ".selectRow(rowIndex);"; GridPanel1.Listeners.RowContextMenu.Handler = scriptContextMenu; SetEditor(); //Đối với người có quyền tạo bảng chấm công txtYear.Text = DateTime.Today.Year.ToString(); txtTenBangChamCong.Text = GlobalResourceManager.GetInstance().GetLanguageValue("bangchamcong") + DateTime.Today.Month + "/" + txtYear.Text; cbMonth.SelectedIndex = DateTime.Now.Month - 1; // new DTH.BorderLayout() { }.AddDepartmentList(br, CurrentUser.ID, true); } if (!Page.IsPostBack) { FindDayOfWeek(); } ucChooseEmployee1.AfterClickAcceptButton += new EventHandler(ucChooseEmployee1_AfterClickAcceptButton); ImportFromExcel1.AfterClickImport += new EventHandler(AfterClickImport_AfterClickImport); ImportFromExcel1.AfterClickTestData += new EventHandler(AfterClickTestData_AfterClickTestData); }
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); }
private void sendEmailCreateAccount(UserInfo uInfo) { // send email to user HeThongController htController = new HeThongController(); object mailFrom = htController.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString()); string from = mailFrom != null?mailFrom.ToString() : ""; string mailPassword = htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString()); string fromEmailPassword = mailPassword != null?mailPassword.ToString() : ""; if (from == "" || fromEmailPassword != "") { from = "*****@*****.**"; fromEmailPassword = "******"; } string mailName = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_create_account"); string subject = GlobalResourceManager.GetInstance().GetLanguageValue("email_title_create_account"); string content = Util.GetInstance().ReadFile(Server.MapPath("../../Modules/MailTemplate/CreateAccount." + GlobalResourceManager.GetInstance().GetCurrentCulture() + ".html")); if (uInfo.DisplayName == null) { content = string.Format(content, uInfo.UserName, uInfo.UserName, uInfo.Password); } else { content = string.Format(content, uInfo.DisplayName, uInfo.UserName, uInfo.Password); } if (mailFrom != "" && mailPassword != "") { SoftCore.Utilities.Email.SendEmail(from, fromEmailPassword, mailName, uInfo.Email, subject, content); X.Msg.Alert(GlobalResourceManager.GetInstance().GetLanguageValue("warning"), GlobalResourceManager.GetInstance().GetLanguageValue("email_notice_create_account")).Show(); } // end send email to user }
private void GenerateNhanSuTheoDonVi(int height, string dsDonVi) { try { hcFrutas.Title = new Title(GlobalResourceManager.GetInstance().GetDesktopValue("chart_by_unit")); hcFrutas.Height = height; //Danh sách giới tinh theo đơn vị List <NhanSu> nhansu = new ChartController().GetBaoCaoGioiTinhTheoDonVi(dsDonVi, userID, menuID); List <DM_DONVI> dvList = new DM_DONVIController().GetByDS(dsDonVi); int total = dvList.Count(); object[] dvdata = new object[total]; object[] MaleData = new object[total]; object[] FemaleData = new object[total]; for (int i = 0; i < dvList.Count(); i++) { dvdata[i] = dvList[i].TEN_DONVI; string[] dv = new DM_DONVIController().GetAllMaDonVi(dvList[i].MA_DONVI).Split(','); MaleData[i] = (from t in nhansu where dv.Contains(t.MaDonVi) && t.MaGioiTinh == "M" select t).ToList().Count(); //lấy số lượng nhân viên nam FemaleData[i] = (from p in nhansu where dv.Contains(p.MaDonVi) && p.MaGioiTinh == "F" select p).ToList().Count(); //lấy số lượng nhân viên nữ } //definições de eixos hcFrutas.YAxis.Add(new YAxisItem { title = new Title("Số lượng") }); hcFrutas.XAxis.Add(new XAxisItem { categories = dvdata }); //dados var series = new Collection <Serie>(); series.Add(new Serie { name = "Nam", data = MaleData }); series.Add(new Serie { name = "Nữ", data = FemaleData }); hcFrutas.PlotOptions = new PlotOptionsColumn() { borderColor = "#dedede", borderRadius = 4, dataLabels = new DataLabels() { enabled = true, }, }; hcFrutas.Legend = new Legend() { layout = Highcharts.Core.Layout.horizontal, align = Align.left, verticalAlign = Highcharts.Core.VerticalAlign.top, x = 70, y = -5, floating = true, shadow = true, backgroundColor = "#FFF", }; hcFrutas.Exporting.enabled = true; hcFrutas.DataSource = series; hcFrutas.DataBind(); } catch { throw; } }