public static string ChangePass(string pv_strUserName, string pv_strPass, string pv_strNewPass) { string v_strRet = "ERROR|" + ErrorDef.SYSTEM_ERROR.ToString(); try { XmlDocument v_objDoc = LXMLMessage.InitXmlMessageTemplate(); LXMLMessage.SetAttribute(ref v_objDoc, LXMLAttribute.FunctionName, "BusinessServices.System.SystemController.ChangeUserPass"); DataTable v_dtParam = LXMLMessage.InitRequestParamTable(); v_dtParam.Rows.Add(new string[] { "UserName", pv_strUserName }); v_dtParam.Rows.Add(new string[] { "UserPass", LSecurity.MD5Encrypt(pv_strPass) }); v_dtParam.Rows.Add(new string[] { "NewPass", LSecurity.MD5Encrypt(pv_strNewPass) }); v_objDoc.DocumentElement.SelectSingleNode("RequestInfo").InnerXml = "<![CDATA[" + LXMLMessage.ConvertDataTableToXml(v_dtParam) + "]]>"; string v_strDocument = LXMLMessage.ConvertDocumentToString(v_objDoc); v_strRet = WebProcess.Instance().SendMessage(v_strDocument); } catch (Exception ex) { v_strRet = "ERROR|" + ErrorDef.SYSTEM_ERROR.ToString(); } return(v_strRet); }
private void btnResetPassword_Click(object sender, RoutedEventArgs e) { try { if (Validation()) { string newPassword = LSecurity.MD5Encrypt(txtNewPassword.Password); QuanTriHeThongProcess process = new QuanTriHeThongProcess(); string responseMessage = ""; ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG; ret = process.ThietLapMatKhauNguoiDung(userName, newPassword, ref responseMessage); if (ret == ApplicationConstant.ResponseStatus.THANH_CONG) { LMessage.ShowMessage("M.ResponseMessage.QuanTriHeThong.NguoiDung.ResetMatKhauThanhCong", LMessage.MessageBoxType.Information); CustomControl.CommonFunction.CloseUserControl(this); } else { LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning); } } } catch (System.Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
/// <summary> /// So sánh 2 địa chỉ MAC. /// Trả về true nếu bằng nhau. /// Trả về false nếu khác nhau /// </summary> /// <param name="macSource"></param> /// <param name="mac"></param> /// <returns></returns> public bool SoSanhMAC(string macSource, string mac) { if (!LSecurity.IsMacAddress(macSource) || !LSecurity.IsMacAddress(mac)) { return(false); } if (macSource.Equals("*")) { return(true); } macSource = macSource.Replace(" ", ""); macSource = macSource.Replace("-", ""); mac = mac.Replace(" ", ""); mac = mac.Replace("-", ""); if (macSource.Equals(mac)) { return(true); } else { return(false); } }
/// <summary> /// So sánh 2 địa chỉ IP. /// Trả về true nếu bằng nhau. /// Trả về false nếu khác nhau /// </summary> /// <param name="ipSource">IP nguồn, ip có thể có dạng *</param> /// <param name="ip">IP cần so sánh</param> /// <returns></returns> public bool SoSanhIP(string ipSource, string ip) { if (!LSecurity.IsIPv4Address(ipSource) || !LSecurity.IsIPv4Address(ip)) { return(false); } //IPSource = "*" -> Luôn bằng nhau if (ipSource.Equals("*")) { return(true); } string[] s1 = ipSource.Split('.'); string[] s2 = ip.Split('.'); for (int i = 0; i < s1.Length; i++) { if (!s1[i].Equals("*") && !s1[i].Equals(s2[i])) //IPSource = "192.168.*.*" & IP = "192.168.1.23" -> bằng nhau { return(false); } } return(true); }
private bool Validate() { if (cmbDonVi.SelectedIndex < 0) { CommonFunction.ThongBaoChuaChon(lblMaDonVi.Content.ToString()); cmbDonVi.Focus(); return(false); } if (txtMaNhom.Text.IsNullOrEmptyOrSpace()) { CommonFunction.ThongBaoChuaNhap(lblMaNhom.Content.ToString()); txtMaNhom.Focus(); return(false); } if (txtTenNhom.Text.IsNullOrEmptyOrSpace()) { CommonFunction.ThongBaoChuaNhap(lblTenNhom.Content.ToString()); txtTenNhom.Focus(); return(false); } if (dtTruyCap != null && dtTruyCap.Rows.Count > 0) { string message = ""; string dsMAC = ""; string dsIP = ""; foreach (DataRow dr in dtTruyCap.Rows) { if (dr["LOAI_DIA_CHI"].ToString().Equals(MAC) && !LSecurity.IsMacAddress(dr["DIA_CHI"].ToString())) { dsMAC = dsMAC + " " + dr["STT"].ToString(); } else if (dr["LOAI_DIA_CHI"].ToString().Equals(IP) && !LSecurity.IsIPv4Address(dr["DIA_CHI"].ToString())) { dsIP = dsIP + " " + dr["STT"].ToString(); } } if (dsMAC.Length > 0) { message = message + "MAC address is not valid. Row number:" + dsMAC + "\n"; } if (dsIP.Length > 0) { message = message + "IP address is not valid. Row number:" + dsIP; } if (message.Length > 0) { LMessage.ShowMessage(message, LMessage.MessageBoxType.Warning); grdTruyCap.Focus(); return(false); } } return(true); }
public static void SaveConfiguration(string name, string ip, string port, UserInformation userInformation) { try { string ApplicationPath = AppDomain.CurrentDomain.BaseDirectory; // Create new DataTable. DataTable dt = new DataTable("Config"); DataSet ds = new DataSet("Framework"); // Declare DataColumn and DataRow variables. DataColumn dc; DataRow dr; dc = new DataColumn(); dc.DataType = System.Type.GetType("System.String"); dc.ColumnName = "Company"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = System.Type.GetType("System.String"); dc.ColumnName = "WorkingDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ConfigDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "DataDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "HelpDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ImagesDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "LanguagesDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "TempDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "IconName"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ShortName"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "FullName"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "VersionDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "BackupVersionDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "CurrentVersionDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "DefaultVersionDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "OtaVersionDir"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "Log4NetConfig"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "Log4NetUpdConfig"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "Log4NetOutput"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ServerList"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ServerName"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ServerIP"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "ServerPort"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "License"; dt.Columns.Add(dc); dc = new DataColumn(); dc.DataType = Type.GetType("System.String"); dc.ColumnName = "Version"; dt.Columns.Add(dc); // Create new DataRow objects and add to DataTable. DataTable dtConfig = userInformation.DataTableConfig; dr = dt.NewRow(); dr["Company"] = dtConfig.Rows[0]["Company"].ToString(); dr["WorkingDir"] = dtConfig.Rows[0]["WorkingDir"].ToString(); dr["ConfigDir"] = dtConfig.Rows[0]["ConfigDir"].ToString(); dr["DataDir"] = dtConfig.Rows[0]["DataDir"].ToString(); dr["HelpDir"] = dtConfig.Rows[0]["HelpDir"].ToString(); dr["ImagesDir"] = dtConfig.Rows[0]["ImagesDir"].ToString(); dr["LanguagesDir"] = dtConfig.Rows[0]["LanguagesDir"].ToString(); dr["TempDir"] = dtConfig.Rows[0]["TempDir"].ToString(); dr["IconName"] = dtConfig.Rows[0]["IconName"].ToString(); dr["ShortName"] = dtConfig.Rows[0]["ShortName"].ToString(); dr["FullName"] = dtConfig.Rows[0]["FullName"].ToString(); dr["VersionDir"] = dtConfig.Rows[0]["VersionDir"].ToString(); dr["BackupVersionDir"] = dtConfig.Rows[0]["BackupVersionDir"].ToString(); dr["CurrentVersionDir"] = dtConfig.Rows[0]["CurrentVersionDir"].ToString(); dr["DefaultVersionDir"] = dtConfig.Rows[0]["DefaultVersionDir"].ToString(); dr["OtaVersionDir"] = dtConfig.Rows[0]["OtaVersionDir"].ToString(); dr["Log4NetConfig"] = dtConfig.Rows[0]["Log4NetConfig"].ToString(); dr["Log4NetUpdConfig"] = dtConfig.Rows[0]["Log4NetUpdConfig"].ToString(); dr["Log4NetOutput"] = dtConfig.Rows[0]["Log4NetOutput"].ToString(); dr["ServerList"] = dtConfig.Rows[0]["ServerList"].ToString(); dr["ServerName"] = name; userInformation.ServerName = name; dr["ServerIP"] = ip; userInformation.ServerIP = ip; dr["ServerPort"] = port; userInformation.ServerPort = port; dr["License"] = dtConfig.Rows[0]["License"].ToString(); dr["Version"] = dtConfig.Rows[0]["Version"].ToString(); dt.Rows.Add(dr); ds.Tables.Add(dt); string systemPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string filePath = systemPath + "config\\config.conf"; string filePathTemp = systemPath + "config\\config.conf_"; ds.WriteXml(filePathTemp); string keyEncrypt = "!=Q|A'Z?"; if (LSecurity.DESEncryptFile(filePathTemp, filePath, keyEncrypt)) { new ClientInitProcess().docLaiThongTinCauHinhClient(dt); LMessage.ShowMessage("Thay đổi thông tin kết nối thành công", LMessage.MessageBoxType.Information); } else { } LFile.DeleteFile(filePathTemp); } catch (Exception ex) { LMessage.ShowMessage("SaveConfiguration", LMessage.MessageBoxType.Warning); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
protected void cmdLogin_Click(object sender, EventArgs e) { lblErrorDesc.Text = ""; long v_lngErrorCode = ErrorDef.SYSTEM_SUCESS; if (ValidateForm()) { string v_strUser = txtUserName.Text.Trim().ToUpper(); string v_strPass = LSecurity.MD5Encrypt(txtPass.Text.Trim()); string v_strSessionId = ""; string v_strResult = UserController.LoginRequest(v_strUser, v_strPass, ref v_strSessionId); if (v_strResult.StartsWith("OK")) { XmlDocument v_objDoc = new XmlDocument(); v_objDoc.LoadXml(v_strResult.Substring(3)); UserInfo v_objUser = new UserInfo(); v_objUser.SessionID = v_strSessionId; v_objUser.UserName = v_strUser; v_objUser.IDNguoiSuDung = Convert.ToInt32(v_objDoc.DocumentElement.SelectSingleNode("IDNguoiSuDung").InnerText); v_objUser.LoaiNguoiSuDung = v_objDoc.DocumentElement.SelectSingleNode("LoaiNguoiSuDung").InnerText; v_objUser.FullName = v_objDoc.DocumentElement.SelectSingleNode("FullName").InnerText; v_objUser.MaDonVi = v_objDoc.DocumentElement.SelectSingleNode("MaDonVi").InnerText; v_objUser.TenDonVi = v_objDoc.DocumentElement.SelectSingleNode("TenDonVi").InnerText; v_objUser.MaDonViQuanLy = v_objDoc.DocumentElement.SelectSingleNode("MaDonVi").InnerText; v_objUser.TenDonViQuanLy = v_objDoc.DocumentElement.SelectSingleNode("TenDonVi").InnerText; v_objUser.MaDonViGiaoDich = v_objDoc.DocumentElement.SelectSingleNode("MaDonVi").InnerText + "00"; v_objUser.TenDonViGiaoDich = "TenDonViGiaoDich"; //v_objUser.MaDonViQuanLy = v_objDoc.DocumentElement.SelectSingleNode("MaDonViQuanLy").InnerText; //v_objUser.TenDonViQuanLy = v_objDoc.DocumentElement.SelectSingleNode("TenDonViQuanLy").InnerText; //v_objUser.MaDonViGiaoDich = v_objDoc.DocumentElement.SelectSingleNode("MaDonViGiaoDich").InnerText; //v_objUser.TenDonViGiaoDich = v_objDoc.DocumentElement.SelectSingleNode("TenDonViGiaoDich").InnerText; v_objUser.NgayLamViecTruoc = v_objDoc.DocumentElement.SelectSingleNode("NgayLamViecTruoc").InnerText; v_objUser.NgayLamViecHienTai = v_objDoc.DocumentElement.SelectSingleNode("NgayLamViecHienTai").InnerText; v_objUser.NgayLamViecSau = v_objDoc.DocumentElement.SelectSingleNode("NgayLamViecSau").InnerText; v_objUser.MaDongNoiTe = v_objDoc.DocumentElement.SelectSingleNode("MaDongNoiTe").InnerText; v_objUser.CayMenu = LXMLMessage.ConvertXmlToDataTable(v_objDoc.DocumentElement.SelectSingleNode("CayMenu").InnerXml.Replace("<![CDATA[", "").Replace("]]>", "")); v_objUser.DSDonVi = LXMLMessage.ConvertXmlToDataTable(v_objDoc.DocumentElement.SelectSingleNode("ListDonVi").InnerXml.Replace("<![CDATA[", "").Replace("]]>", "")); AppConfig.LoginedUser = v_objUser; //Them doan nay de co the goi cac service khac UserInformation userInfo = new UserInformation(); //userInfo.SessionId = HttpContext.Current.Session["LoginedUser"].GetHashCode().ToString(); userInfo.SessionId = v_strSessionId; userInfo.TenDangNhap = AppConfig.LoginedUser.UserName; userInfo.ListChucNang = null; userInfo.IdNguoiSuDung = AppConfig.LoginedUser.IDNguoiSuDung; userInfo.HoTen = AppConfig.LoginedUser.FullName; userInfo.MaDonVi = AppConfig.LoginedUser.MaDonVi; userInfo.TenDonVi = AppConfig.LoginedUser.TenDonVi; userInfo.MaDonViQuanLy = AppConfig.LoginedUser.MaDonViQuanLy; userInfo.TenDonViQuanLy = AppConfig.LoginedUser.TenDonViQuanLy; userInfo.MaDonViGiaoDich = AppConfig.LoginedUser.MaDonViGiaoDich; userInfo.TenDonViGiaoDich = AppConfig.LoginedUser.TenDonViGiaoDich; userInfo.LoaiNguoiSuDung = AppConfig.LoginedUser.LoaiNguoiSuDung; userInfo.NgayLamViecTruoc = AppConfig.LoginedUser.NgayLamViecTruoc; userInfo.NgayLamViecHienTai = AppConfig.LoginedUser.NgayLamViecHienTai; userInfo.NgayLamViecSau = AppConfig.LoginedUser.NgayLamViecSau; userInfo.MaDongNoiTe = AppConfig.LoginedUser.MaDongNoiTe; userInfo.MacAddress = ""; HttpContext.Current.Session["UserInformation"] = userInfo; //Add cookie if (chkRemember.Checked) { v_objUser.SaveCookie(); } Response.Redirect("~/Default.aspx"); } else { v_lngErrorCode = Convert.ToInt64(v_strResult.Replace("ERROR|", "")); lblErrorDesc.Text = CacheService.Instance().GetErrorDef(v_lngErrorCode); txtUserName.Focus(); } } }
protected void LoadConfig() { string v_strConfigPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Config\\Config.conf"; MemoryStream mStream = LSecurity.DESDecryptFile(v_strConfigPath, @"!=Q|A'Z?"); XElement xml = XElement.Load(mStream); DataTable dt = LDatatable.XElementToDataTable(xml); if (dt.Rows.Count > 0) { ClientInformation.DataTableConfig = dt; if (dt.Columns.Contains("Company")) { ClientInformation.Company = dt.Rows[0]["Company"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Company trong file cau hinh"); } if (dt.Columns.Contains("ClientType")) { ClientInformation.ClientType = dt.Rows[0]["ClientType"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ClientType trong file cau hinh"); } if (dt.Columns.Contains("IconName")) { ClientInformation.IconName = ClientInformation.ImagesDir + "\\" + dt.Rows[0]["IconName"].ToString() + ".ico"; } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so IconName trong file cau hinh"); } if (dt.Columns.Contains("ShortName")) { ClientInformation.ShortName = dt.Rows[0]["ShortName"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ShortName trong file cau hinh"); } if (dt.Columns.Contains("FullName")) { ClientInformation.FullName = dt.Rows[0]["FullName"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so FullName trong file cau hinh"); } if (dt.Columns.Contains("Theme")) { ClientInformation.Theme = dt.Rows[0]["Theme"].ToString(); } else { ClientInformation.Theme = "default"; Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Theme trong file cau hinh"); } if (dt.Columns.Contains("LanguageList")) { ClientInformation.LanguageList = dt.Rows[0]["LanguageList"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so LanguageList trong file cau hinh"); } if (dt.Columns.Contains("ServerIP")) { ClientInformation.ServerIP = dt.Rows[0]["ServerIP"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ServerIP trong file cau hinh"); } if (dt.Columns.Contains("ServerPort")) { ClientInformation.ServerPort = dt.Rows[0]["ServerPort"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ServerPort trong file cau hinh"); } ClientInformation.IpAddress = ""; ClientInformation.MacAddress = ""; } }
private void Login() { try { // @TrườngNX on 20120905 // Lựa chọn ngôn ngữ của phiên làm việc // Căn cứ vào ngôn ngữ, load file language resources tương ứng //this.Cursor = Cursors.Wait; //var process = new ZAMainAppProcess(); string userName = txtUsername.Text; string txtMD5 = LSecurity.MD5Encrypt(txtPassword.Password); //process.createSession(); string responseMessage = ""; NGON_NGU_DTO ngonNguDTO = null; bool ret = process.doLoginWithSession(userName, txtMD5, ref ngonNguDTO, ref responseMessage); // Nếu thành công if (ret) { // Nếu yêu cầu cập nhật phiên bản if (responseMessage != null && responseMessage.Equals(ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_NotLatestVersion.layGiaTri()) ) { //MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question); //if (retQuestion == MessageBoxResult.Yes) //{ // // Cập nhật phiên bản //} //else //{ //} MessageBoxResult retMessage = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question); if (retMessage == MessageBoxResult.Yes) { UserControl p = null; bool stretchWindow = false; p = new PresentationWPF.QuanTriHeThong.PhienBan.ucPhienBanCapNhat(); if (p != null) { Window window = new Window { Title = LLanguage.SearchResourceByKey("MENU.152_CAP_NHAT_PB"), WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, //Icon = (rmb.ImageSource == null ? this.Icon : rmb.ImageSource), Width = (Double.IsNaN(p.Width) ? 1024 : p.Width), Height = (Double.IsNaN(p.Height) ? 700 : p.Height), Content = p, }; if (stretchWindow == true) { window.WindowState = WindowState.Maximized; } window.Width = 500; window.Height = 150; window.ResizeMode = ResizeMode.NoResize; //Mouse.OverrideCursor = Cursors.Arrow; this.Close(); window.ShowDialog(); } else { Mouse.OverrideCursor = Cursors.Arrow; LMessage.ShowMessage("Không tìm thấy chức năng này", LMessage.MessageBoxType.Warning); } } } ClientInformation.NgonNgu = ((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString(); // @Truonglq set Culture ngôn ngữ cho Coltrol (telerik) //CultureInfo culture = new CultureInfo(((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString()); //System.Threading.Thread.CurrentThread.CurrentCulture = culture; //System.Threading.Thread.CurrentThread.CurrentUICulture = culture; InitializeCultures(); //InitializeCulturesTelerik(); LocalizationManager.Manager = new LocalizationManager() { ResourceManager = LocalizationRadControl.ResourceManager }; // Khởi tạo phiên làm việc, chọn đơn vị nghiệp vụ cần thao tác dữ liệu if (!ClientInformation.LoaiNguoiSuDung.Equals(BusinessConstant.LoaiNguoiSuDung.CAP_SA.layGiaTri())) { InitSession initSession = new InitSession(ClientInformation.ListPhongGD); initSession.ResizeMode = ResizeMode.NoResize; initSession.Height = 250; initSession.Width = 600; initSession.WindowStartupLocation = WindowStartupLocation.CenterScreen; initSession.lblNguoiDungValue.Content = "(" + ClientInformation.TenDangNhap + ") " + ClientInformation.HoTen; initSession.lblChiNhanhValue.Content = "(" + ClientInformation.MaDonVi + ") " + ClientInformation.TenDonVi; //initSession.ListPhongGD = ClientInformation.ListPhongGD; initSession.Show(); this.Cursor = Cursors.Arrow; Close(); } else { ClientInformation.TenDonViGiaoDich = ClientInformation.TenDonVi; ClientInformation.MaDonViGiaoDich = ClientInformation.MaDonVi; ClientInformation.IdDonViGiaoDich = ClientInformation.IdDonVi; ClientInformation.PhuongPhapHachToan = null; MainWindow mainwindow = new MainWindow(); mainwindow.Show(); this.Cursor = Cursors.Arrow; Close(); } } else { ImageBehavior.SetAnimatedSource(imgWaiting, null); // Nếu yêu cầu đổi mật khẩu if (responseMessage != null && ( responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhauLanDau.layGiaTri()) || responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhau.layGiaTri()) ) ) { MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question); if (retQuestion == MessageBoxResult.Yes) { txtPassword.Clear(); ChangePassword changePassword = new ChangePassword(); Window window = new Window(); window.ResizeMode = ResizeMode.NoResize; window.Height = 180; window.Width = 500; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.Title = LLanguage.SearchResourceByKey("U.ZAMainApp.ChangePassword.Title"); window.Content = changePassword; changePassword.userName = userName; window.ShowDialog(); //LMessage.ShowMessage("Change pass", LMessage.MessageBoxType.Warning); } else { return; } } else { LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning); } } } //else catch (Exception ex) { ImageBehavior.SetAnimatedSource(imgWaiting, null); //this.Close(); //Application.Current.Shutdown(); this.Cursor = Cursors.Arrow; if (ex.GetType() == typeof(CustomException)) { new frmThongBaoLoi(ex.Message, ex.InnerException).ShowDialog(); } else { if (ex.InnerException != null) { if (ex.InnerException.GetType() == typeof(CustomException)) { new frmThongBaoLoi(ex.InnerException.Message, ex.InnerException).ShowDialog(); } else { new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog(); } } else { new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog(); } } LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
/// <summary> /// Đọc thông tin cấu hình client /// </summary> /// <param name="type">0: IIS App, 1: WPF App</param> /// <returns></returns> public bool docThongTinCauHinhClient(int type) { try { // string filePath=@"D:\InCompany\Resources\VSS\NG-mFINA\2.SourceCode\NG.mFinance\Build\Build.Client\Dev\config\config.conf"; //string systemPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string systemPath = ""; if (type == 0) { systemPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; } else if (type == 1) { systemPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; } string filePath = systemPath + "config\\config.conf"; MemoryStream mStream = LSecurity.DESDecryptFile(filePath, @"!=Q|A'Z?"); XElement xml = XElement.Load(mStream); DataTable dt = LDatatable.XElementToDataTable(xml); if (dt.Rows.Count > 0) { ClientInformation.DataTableConfig = dt; if (dt.Columns.Contains("Company")) { ClientInformation.Company = dt.Rows[0]["Company"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Company trong file cau hinh"); } if (dt.Columns.Contains("ClientType")) { ClientInformation.ClientType = dt.Rows[0]["ClientType"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ClientType trong file cau hinh"); } if (dt.Columns.Contains("WorkingDir")) { ClientInformation.WorkingDir = systemPath + dt.Rows[0]["WorkingDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so WorkingDir trong file cau hinh"); } if (dt.Columns.Contains("ConfigDir")) { ClientInformation.ConfigDir = systemPath + dt.Rows[0]["ConfigDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ConfigDir trong file cau hinh"); } if (dt.Columns.Contains("DataDir")) { ClientInformation.DataDir = systemPath + dt.Rows[0]["DataDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so DataDir trong file cau hinh"); } if (dt.Columns.Contains("HelpDir")) { ClientInformation.HelpDir = systemPath + dt.Rows[0]["HelpDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so HelpDir trong file cau hinh"); } if (dt.Columns.Contains("ImagesDir")) { ClientInformation.ImagesDir = systemPath + dt.Rows[0]["ImagesDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ImagesDir trong file cau hinh"); } if (dt.Columns.Contains("LanguagesDir")) { ClientInformation.LanguagesDir = systemPath + dt.Rows[0]["LanguagesDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so LanguagesDir trong file cau hinh"); } if (dt.Columns.Contains("TempDir")) { ClientInformation.TempDir = systemPath + dt.Rows[0]["TempDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so TempDir trong file cau hinh"); } if (dt.Columns.Contains("IconName")) { ClientInformation.IconName = ClientInformation.ImagesDir + "\\" + dt.Rows[0]["IconName"].ToString() + ".ico"; } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so IconName trong file cau hinh"); } if (dt.Columns.Contains("ShortName")) { ClientInformation.ShortName = dt.Rows[0]["ShortName"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ShortName trong file cau hinh"); } if (dt.Columns.Contains("FullName")) { ClientInformation.FullName = dt.Rows[0]["FullName"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so FullName trong file cau hinh"); } if (dt.Columns.Contains("Theme")) { ClientInformation.Theme = dt.Rows[0]["Theme"].ToString(); } else { ClientInformation.Theme = "default"; Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Theme trong file cau hinh"); } if (dt.Columns.Contains("LanguageList")) { ClientInformation.LanguageList = dt.Rows[0]["LanguageList"].ToString(); } else { ClientInformation.LanguageList = ""; Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so LanguageList trong file cau hinh"); } if (dt.Columns.Contains("VersionDir")) { ClientInformation.VersionDir = systemPath + dt.Rows[0]["VersionDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so VersionDir trong file cau hinh"); } if (dt.Columns.Contains("BackupVersionDir")) { ClientInformation.BackupVersionDir = ClientInformation.VersionDir + "\\" + dt.Rows[0]["BackupVersionDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so BackupVersionDir trong file cau hinh"); } if (dt.Columns.Contains("CurrentVersionDir")) { ClientInformation.CurrentVersionDir = ClientInformation.VersionDir + "\\" + dt.Rows[0]["CurrentVersionDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so CurrentVersionDir trong file cau hinh"); } if (dt.Columns.Contains("DefaultVersionDir")) { ClientInformation.DefaultVersionDir = ClientInformation.VersionDir + "\\" + dt.Rows[0]["DefaultVersionDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so DefaultVersionDir trong file cau hinh"); } if (dt.Columns.Contains("OtaVersionDir")) { ClientInformation.OtaVersionDir = ClientInformation.VersionDir + "\\" + dt.Rows[0]["OtaVersionDir"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so OtaVersionDir trong file cau hinh"); } if (dt.Columns.Contains("Log4NetConfig")) { ClientInformation.Log4NetConfig = systemPath + dt.Rows[0]["Log4NetConfig"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Log4NetConfig trong file cau hinh"); } if (dt.Columns.Contains("Log4NetUpdConfig")) { ClientInformation.Log4NetUpdConfig = systemPath + dt.Rows[0] ["Log4NetUpdConfig"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Log4NetUpdConfig trong file cau hinh"); } if (dt.Columns.Contains("Log4NetOutput")) { ClientInformation.Log4NetOutput = systemPath + dt.Rows[0]["Log4NetOutput"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Log4NetOutput trong file cau hinh"); } if (dt.Columns.Contains("ServerList")) { ClientInformation.ServerList = dt.Rows[0]["ServerList"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ServerList trong file cau hinh"); } if (dt.Columns.Contains("ServerName")) { ClientInformation.ServerName = dt.Rows[0]["ServerName"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ServerName trong file cau hinh"); } if (dt.Columns.Contains("ServerIP")) { ClientInformation.ServerIP = dt.Rows[0]["ServerIP"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ServerIP trong file cau hinh"); } if (dt.Columns.Contains("ServerPort")) { ClientInformation.ServerPort = dt.Rows[0]["ServerPort"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so ServerPort trong file cau hinh"); } if (dt.Columns.Contains("License")) { ClientInformation.License = dt.Rows[0]["License"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so License trong file cau hinh"); } if (dt.Columns.Contains("Version")) { ClientInformation.Version = dt.Rows[0]["Version"].ToString(); } else { Console.WriteLine("Presentation.Process.Common: Chua khai bao tham so Version trong file cau hinh"); } //ClientInformation.IpAddress = Utilities.GetIpAddress(); //ClientInformation.MacAddress = Utilities.GetMacAddress(); // log4net log4net.ThreadContext.Properties["path"] = ClientInformation.Log4NetOutput; log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(ClientInformation.Log4NetConfig)); } else { Console.WriteLine("Presentation.Process.Common: Doc thong tin cau hinh khong thanh cong; "); } LLogging.WriteLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), LLogging.LogType.SYS, "Client initialization"); return(true); } catch (Exception ex) { Console.WriteLine("Presentation.Process.Common: Doc thong tin cau hinh khong thanh cong; " + ex.ToString()); return(false); } }
private void Login() { try { // @TrườngNX on 20120905 // Lựa chọn ngôn ngữ của phiên làm việc // Căn cứ vào ngôn ngữ, load file language resources tương ứng //this.Cursor = Cursors.Wait; //var process = new ZAMainAppProcess(); string userName = txtUsername.Text; string txtMD5 = LSecurity.MD5Encrypt(txtPassword.Password); //process.createSession(); string responseMessage = ""; NGON_NGU_DTO ngonNguDTO = null; bool ret = process.doLoginWithSession(userName, txtMD5, ref ngonNguDTO, ref responseMessage); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "ret value: " + ret.ToString()); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "responseMessage value: " + responseMessage); // Nếu thành công if (ret) { // Nếu yêu cầu cập nhật phiên bản if (responseMessage != null && responseMessage.Equals(ApplicationConstant.CommonResponseMessage.M_ResponseMessage_Common_NotLatestVersion.layGiaTri()) ) { //MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question); //if (retQuestion == MessageBoxResult.Yes) //{ // // Cập nhật phiên bản //} //else //{ //} MessageBoxResult retMessage = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question); if (retMessage == MessageBoxResult.Yes) { UserControl p = null; bool stretchWindow = false; p = new PresentationWPF.QuanTriHeThong.PhienBan.ucPhienBanCapNhat(); if (p != null) { Window window = new Window { Title = LLanguage.SearchResourceByKey("MENU.152_CAP_NHAT_PB"), WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, //Icon = (rmb.ImageSource == null ? this.Icon : rmb.ImageSource), Width = (Double.IsNaN(p.Width) ? 1024 : p.Width), Height = (Double.IsNaN(p.Height) ? 700 : p.Height), Content = p, }; if (stretchWindow == true) { window.WindowState = WindowState.Maximized; } window.Width = 500; window.Height = 150; window.ResizeMode = ResizeMode.NoResize; //Mouse.OverrideCursor = Cursors.Arrow; this.Close(); window.ShowDialog(); } else { Mouse.OverrideCursor = Cursors.Arrow; LMessage.ShowMessage("Không tìm thấy chức năng này", LMessage.MessageBoxType.Warning); } } } #region Ghi ngôn ngữ ra file UIResources if (ngonNguDTO != null) { List <string> lstResource_vi = new List <string>(); List <string> lstResource_en = new List <string>(); List <string> lstResource_gl = new List <string>(); List <string> lstMessage_vi = new List <string>(); List <string> lstMessage_en = new List <string>(); List <string> lstMessage_gl = new List <string>(); string pathFileResource_vi = ClientInformation.LanguagesDir + "\\UIResources_vi.xaml"; string pathFileResource_en = ClientInformation.LanguagesDir + "\\UIResources_en.xaml"; string pathFileResource_gl = ClientInformation.LanguagesDir + "\\UIResources_gl.xaml"; string pathFileMessage_vi = ClientInformation.LanguagesDir + "\\MessageResources_vi.xaml"; string pathFileMessage_en = ClientInformation.LanguagesDir + "\\MessageResources_en.xaml"; string pathFileMessage_gl = ClientInformation.LanguagesDir + "\\MessageResources_gl.xaml"; string begin = "<ResourceDictionary xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"" + "\n " + "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"" + "\n " + "xmlns:my=\"clr-namespace:System;assembly=mscorlib\">"; string end = "\n\n</ResourceDictionary>"; if (!ngonNguDTO.checkResource && ngonNguDTO.lstResource != null) { lstResource_vi.Add(begin); lstResource_en.Add(begin); lstResource_gl.Add(begin); foreach (var item in ngonNguDTO.lstResource) { lstResource_vi.Add("\n <my:String x:Key=\"" + item.MA + "\">" + item.VIET_NAM + "</my:String>"); lstResource_en.Add("\n <my:String x:Key=\"" + item.MA + "\">" + item.ENGLISH + "</my:String>"); lstResource_gl.Add("\n <my:String x:Key=\"" + item.MA + "\">" + item.GLOBAL + "</my:String>"); } lstResource_vi.Add(end); lstResource_en.Add(end); lstResource_gl.Add(end); LFile.DeleteFile(pathFileResource_vi); LFile.DeleteFile(pathFileResource_en); LFile.DeleteFile(pathFileResource_gl); LFile.WriteListTextToFile(pathFileResource_vi, true, lstResource_vi); LFile.WriteListTextToFile(pathFileResource_en, true, lstResource_en); LFile.WriteListTextToFile(pathFileResource_gl, true, lstResource_gl); } if (!ngonNguDTO.checkMessage && ngonNguDTO.lstMessage != null) { lstMessage_vi.Add(begin); lstMessage_en.Add(begin); lstMessage_gl.Add(begin); foreach (var item in ngonNguDTO.lstMessage) { lstMessage_vi.Add("\n <my:String x:Key=\"" + item.MA + "\">" + item.VIET_NAM + "</my:String>"); lstMessage_en.Add("\n <my:String x:Key=\"" + item.MA + "\">" + item.ENGLISH + "</my:String>"); lstMessage_gl.Add("\n <my:String x:Key=\"" + item.MA + "\">" + item.GLOBAL + "</my:String>"); } lstMessage_vi.Add(end); lstMessage_en.Add(end); lstMessage_gl.Add(end); LFile.DeleteFile(pathFileMessage_vi); LFile.DeleteFile(pathFileMessage_en); LFile.DeleteFile(pathFileMessage_gl); LFile.WriteListTextToFile(pathFileMessage_vi, true, lstMessage_vi); LFile.WriteListTextToFile(pathFileMessage_en, true, lstMessage_en); LFile.WriteListTextToFile(pathFileMessage_gl, true, lstMessage_gl); } ChangeLanguage(); } #endregion ClientInformation.NgonNgu = ((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString(); // @Truonglq set Culture ngôn ngữ cho Coltrol (telerik) //CultureInfo culture = new CultureInfo(((RadComboBoxItem)cboLanguage.SelectedItem).Tag.ToString()); //System.Threading.Thread.CurrentThread.CurrentCulture = culture; //System.Threading.Thread.CurrentThread.CurrentUICulture = culture; InitializeCultures(); //InitializeCulturesTelerik(); LocalizationManager.Manager = new LocalizationManager() { ResourceManager = LocalizationRadControl.ResourceManager }; // Khởi tạo phiên làm việc, chọn đơn vị nghiệp vụ cần thao tác dữ liệu if (!ClientInformation.LoaiNguoiSuDung.Equals(BusinessConstant.LoaiNguoiSuDung.CAP_SA.layGiaTri())) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "BeforeInitSession"); InitSession initSession = new InitSession(ClientInformation.ListPhongGD); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "AfterInitSession"); initSession.ResizeMode = ResizeMode.NoResize; initSession.Height = 250; initSession.Width = 600; initSession.WindowStartupLocation = WindowStartupLocation.CenterScreen; initSession.lblNguoiDungValue.Content = "(" + ClientInformation.TenDangNhap + ") " + ClientInformation.HoTen; initSession.lblChiNhanhValue.Content = "(" + ClientInformation.MaDonVi + ") " + ClientInformation.TenDonVi; //initSession.ListPhongGD = ClientInformation.ListPhongGD; LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "BeforeInitSession Show"); initSession.Show(); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "AfterInitSession Show"); this.Cursor = Cursors.Arrow; Close(); } else { ClientInformation.TenDonViGiaoDich = ClientInformation.TenDonVi; ClientInformation.MaDonViGiaoDich = ClientInformation.MaDonVi; ClientInformation.IdDonViGiaoDich = ClientInformation.IdDonVi; ClientInformation.PhuongPhapHachToan = null; MainWindow mainwindow = new MainWindow(); mainwindow.Show(); this.Cursor = Cursors.Arrow; Close(); } } else { ImageBehavior.SetAnimatedSource(imgWaiting, null); // Nếu yêu cầu đổi mật khẩu if (responseMessage != null && ( responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhauLanDau.layGiaTri()) || responseMessage.Equals(ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhau.layGiaTri()) ) ) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "IF M_ResponseMessage_Login_YeuCauDoiMatKhau"); MessageBoxResult retQuestion = LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Question); if (retQuestion == MessageBoxResult.Yes) { txtPassword.Clear(); ChangePassword changePassword = new ChangePassword(); Window window = new Window(); window.ResizeMode = ResizeMode.NoResize; window.Height = 180; window.Width = 500; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.Title = LLanguage.SearchResourceByKey("U.ZAMainApp.ChangePassword.Title"); window.Content = changePassword; changePassword.userName = userName; window.ShowDialog(); //LMessage.ShowMessage("Change pass", LMessage.MessageBoxType.Warning); } else { return; } } else { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "ELSE M_ResponseMessage_Login_YeuCauDoiMatKhau"); LMessage.ShowMessage(responseMessage, LMessage.MessageBoxType.Warning); } } } //else catch (Exception ex) { LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, "Login() Exception"); ImageBehavior.SetAnimatedSource(imgWaiting, null); //this.Close(); //Application.Current.Shutdown(); this.Cursor = Cursors.Arrow; if (ex.GetType() == typeof(CustomException)) { new frmThongBaoLoi(ex.Message, ex.InnerException).ShowDialog(); } else { if (ex.InnerException != null) { if (ex.InnerException.GetType() == typeof(CustomException)) { new frmThongBaoLoi(ex.InnerException.Message, ex.InnerException).ShowDialog(); } else { new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog(); } } else { new frmThongBaoLoi("M.ResponseMessage.Login.KhongThanhCong", ex).ShowDialog(); } } LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
public JsonResult CheckLogin(string user, string password, int width, int height) { try { if (fcnValidForm(user, password)) { ZAMainAppProcess obj = new ZAMainAppProcess(); string sMessage = ""; string ngongu = ""; NGON_NGU_DTO ngonNguDto = new NGON_NGU_DTO(); string sMatKhau = LSecurity.MD5Encrypt(password); if (UserInformation.Session_User.IsNullOrEmpty()) { UserInformation.Session_User = new Presentation.Process.Common.UserInformation(); } if (UserInformation.Session_User.NgonNgu.IsNullOrEmpty()) { UserInformation.Session_User.NgonNgu = "vi"; } else { ngongu = UserInformation.Session_User.NgonNgu; } UserInformation.Session_User.U_PhienBan = LanguageNode.GetValueUILanguage("U.PhienBan"); UserInformation.Session_User.M_PhienBan = LanguageNode.GetValueMessageLanguage("M.PhienBan"); System.Web.HttpContext.Current.Session["UserInformation"] = UserInformation.Session_User; bool isResult = obj.doLoginWithSession(user, sMatKhau, ref ngonNguDto, ref sMessage); UserInformation.Session_User = (Presentation.Process.Common.UserInformation)System.Web.HttpContext.Current.Session["UserInformation"]; UserInformation.Session_User.NgonNgu = ngongu; if (!ngonNguDto.IsNullOrEmpty()) { if (!ngonNguDto.lstResource.IsNullOrEmpty() && ngonNguDto.lstResource.Count() > 0) { LanguageNode.LoadUILanguage(ngonNguDto.lstResource.ToList()); } if (!ngonNguDto.lstMessage.IsNullOrEmpty() && ngonNguDto.lstMessage.Count() > 0) { LanguageNode.LoadMessageLanguage(ngonNguDto.lstMessage.ToList()); } } //if (sMessage != null && (sMessage.Equals(Utilities.Solution.ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhauLanDau.layGiaTri()) || sMessage.Equals(Utilities.Solution.ApplicationConstant.LoginResponseMessage.M_ResponseMessage_Login_YeuCauDoiMatKhau.layGiaTri()))) //{ // ses.USER_ID = user; // ses.USER_NAME = objUser.USER_NAME; // ses.FULL_NAME = objUser.FULL_NAME; // ses.MAT_KHAU = password; // ses.PHAI_DOI_MK = 1; // SessionUser.Session_User = ses; // return Json(Common.ResultJson.Success.LayMa(), JsonRequestBehavior.AllowGet); //} if (isResult) { //ses.PHAI_DOI_MK = 0; //ses.USER_ID = user; //ses.USER_NAME = objUser.TenDangNhap; //ses.FULL_NAME = objUser.HoTen; //ses.DON_VI_TAO = objUser.DON_VI_QLY; //Presentation.Process.DanhMucServiceRef.DM_DON_VI objDV = objdmdv.getDonViByMa(objUser.DON_VI_QLY); //ses.ID_DON_VI_TAO = objDV.ID; //ses.DON_VI_QLY = objDV.MA_DVI_CHA; //ses.LOAI_DON_VI = objDV.LOAI_DVI; //ses.TEN_DON_VI = objDV.TEN_GDICH; //ses.MAT_KHAU = password; //ses.LIST_CHUC_NANG = objUser.ListChucNang; //double dbCount = double.Parse(Application["access_count"].ToString()); //dbCount = dbCount + 1; //Application["access_count"] = dbCount; //SessionUser.Session_User = ses; return(Json("", JsonRequestBehavior.AllowGet)); } else { return(Json(Common.ResultJson.Error.LayMa(), JsonRequestBehavior.AllowGet)); } } else { return(Json(Common.ResultJson.Error.LayMa(), JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(Common.ResultJson.Error.LayMa(), JsonRequestBehavior.AllowGet)); } }