// /// <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 }
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); } }
public static string ReadCalibration(string addr) { string calStr = ""; using (IGpibSession dev = GlobalResourceManager.Open(addr) as IGpibSession) { dev.Clear(); //dev.RawIO.Write("H0"); //dev.ReadStatusByte(); //List<byte> vals = new List<byte>(); for (int i = 0; i < 256; i++) { dev.RawIO.Write(new byte[] { 0x57, (byte)i }); // 0x57 is 'W' in hex calStr = calStr + dev.RawIO.ReadString(); if (i % 32 == 31) { calStr = calStr + System.Environment.NewLine; } /*byte[] x = dev.RawIO.Read(); * x[0] = (byte)((int)x[0] - 64); * vals.Add(x[0]);*/ } } return(calStr); }
static void Main(string[] args) { try { using (var res = GlobalResourceManager.Open("TCPIP:localhost::inst0::INSTR")) { if (res is IMessageBasedFormattedIO session) { session.WriteLine("*IDN?"); var idn = session.ReadLine(); Console.WriteLine("Connected to {0}", idn); } } } catch (TypeInitializationException ex) { if (ex.InnerException != null && ex.InnerException is DllNotFoundException) { var VisaNetSharedComponentsVersion = typeof(GlobalResourceManager).Assembly.GetName().Version.ToString(); Console.WriteLine("VISA implementation compatible with VISA.NET Shared Components {0} not found. Please install corresponding vendor-specific VISA implementation first.", VisaNetSharedComponentsVersion); } } catch (Exception ex) { Console.WriteLine(ex.Message); } // suppress DllNotFoundException exception in Ivi.Visa dispose AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionEventHandler; }
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(); } }
static void Main(string[] args) { // Change this variable to the address of your instrument string VISA_ADDRESS = "Your instrument's VISA address goes here!"; // Create a connection (session) to the TCP/IP socket on the instrument. // Change VISA_ADDRESS to a SOCKET address, e.g. "TCPIP::169.254.104.59::5025::SOCKET" IMessageBasedSession session = GlobalResourceManager.Open(VISA_ADDRESS) as IMessageBasedSession; // The first thing you should do with a SOCKET connection is enable the Termination Character. Otherwise all of your read's will fail session.TerminationCharacterEnabled = true; // We can find out details of the connection ITcpipSocketSession socket = session as ITcpipSocketSession; Console.WriteLine("IP: {0}\r\nHostname: {1}\r\nPort: {2}\r\n", socket.Address, socket.HostName, socket.Port); // Send the *IDN? and read the response as strings MessageBasedFormattedIO formattedIO = new MessageBasedFormattedIO(session); formattedIO.WriteLine("*IDN?"); string idnResponse = formattedIO.ReadLine(); Console.WriteLine("*IDN? returned: {0}", idnResponse); // Close the connection to the instrument session.Dispose(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
protected VISADevice(string visaID) { this.visaID = visaID; // set this visaID to the parameter visaID threadLock = new object(); // each device needs its own locking object. manualResetEventIO = new ManualResetEvent(false); // init the manualResetEvent mbSession = GlobalResourceManager.Open(this.visaID) as IMessageBasedSession; // open the message session between the computer and the device. }
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(); } }
static bool Find(string searchString, ref List <KeysightDevice> deviceList) { IEnumerable <string> devices; try { devices = GlobalResourceManager.Find(searchString); foreach (string device in devices) { //Console.WriteLine("\tAddress: {0}, Alias: {1}", device, GlobalResourceManager.Parse(device).AliasIfExists); KeysightDevice d = new KeysightDevice { VisaAddress = device, Alias = GlobalResourceManager.Parse(device).AliasIfExists }; deviceList.Add(d); } return(true); } catch (VisaException ex) { return(false); } }
private void button3_Click(object sender, EventArgs e) { string VISA_ADDRESS = listBox1.GetItemText(listBox1.SelectedItem); // Create a connection (session) to the instrument IMessageBasedSession session; session = GlobalResourceManager.Open(VISA_ADDRESS) as IMessageBasedSession; // Create a formatted I/O object which will help us format the data we want to send/receive to/from the instrument MessageBasedFormattedIO formattedIO = new MessageBasedFormattedIO(session); // For Serial and TCP/IP socket connections enable the read Termination Character, or read's will timeout if (session.ResourceName.Contains("ASRL") || session.ResourceName.Contains("SOCKET")) { session.TerminationCharacterEnabled = true; } formattedIO.WriteLine(":SYSTem:SECurity:ERASeall"); formattedIO.WriteLine(":SYSTem:SECurity:SANitize"); formattedIO.WriteLine(":SYSTem:FILesystem:STORage:FSDCard ON|OFF|1|0"); formattedIO.WriteLine(":SYSTem:PRESet: PERSistent"); formattedIO.WriteLine(":SYSTem:COMMunicate:LAN:DEFaults"); formattedIO.WriteLine(":CAL:IQ:DEF"); session.Dispose(); MessageBox.Show("Очистка заврешена"); }
/// <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(); } } }
public bool requirementVerified(GlobalResourceManager GRM) { switch (this.trophyName) { case "Medal3": //8 types de batiments contruits return(this.Score.numberOfDifferentBuildingBuilt >= 8); case "Medal2": //12 types de batiments contruits return(this.Score.numberOfDifferentBuildingBuilt >= 12); case "Medal1": //tous types de batiments contruits return(this.Score.allBuildingBuilt); case "Trophy3": //TOTAL resources count > 6000 return(GRM.totalResourceCount > 6000); case "Trophy2": //TOTAL resources count > 15000 return(GRM.totalResourceCount > 15000); case "Trophy1": //TOTAL resources count > 30000 return(GRM.totalResourceCount > 30000); // Airport requirement managed in the trophy manager //return resourceManager.getResource(TypeResource.Gold).Stock > 10000; //return resourceManager.getResource(TypeResource.Food).Stock > 5000; } return(false); }
static void Main(string[] args) { // Change this variable to the address of your instrument string VISA_ADDRESS = "Your instrument's VISA address goes here!"; // Create a connection (session) to the RS-232 device. // Change VISA_ADDRESS to a serial address, e.g. "ASRL1::INSTR" IMessageBasedSession session = GlobalResourceManager.Open(VISA_ADDRESS) as IMessageBasedSession; // The first thing you should do with a serial port is enable the Termination Character. Otherwise all of your read's will fail session.TerminationCharacterEnabled = true; // If you've setup the serial port settings in Connection Expert, you can remove this section. // Otherwise, set your connection parameters ISerialSession serial = session as ISerialSession; serial.BaudRate = 9600; serial.DataBits = 8; serial.Parity = SerialParity.None; serial.FlowControl = SerialFlowControlModes.DtrDsr; // Send the *IDN? and read the response as strings MessageBasedFormattedIO formattedIO = new MessageBasedFormattedIO(session); formattedIO.WriteLine("*IDN?"); string idnResponse = formattedIO.ReadLine(); Console.WriteLine("*IDN? returned: {0}", idnResponse); // Close the connection to the instrument session.Dispose(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
public static string[] FindGPIBAddresses() { IEnumerable <string> result = new List <string>(); try { result = GlobalResourceManager.Find($"GPIB?*INSTR"); } catch (Exception ex) { if (!(ex is NativeVisaException)) { if (ex.InnerException != null) { throw ex.InnerException; } else { throw ex; } } } return(result.ToArray().Where(n => !n.Contains("//")).ToArray()); }
void Start() { this.Client = GameObject.Find("Network").GetComponent <Client>(); //this.Client.MessageTrophyWonEvent += Client_MessageTrophyWonEvent; this.Client.MessageBuildingConstructionEvent += Client_MessageBuildingConstructionEvent; this.ResourceManager = GameObject.Find("Resources").GetComponent <GlobalResourceManager>(); //Trophy trophy1 = GameObject.Find("Medal1").GetComponent<Trophy>(); //new Trophy(1, "Trophée ressources", "Gain de ressources", 50, 50, null); //Trophy trophy2 = GameObject.Find("Medal2").GetComponent<Trophy>(); //new Trophy(2, "Trophée innovation", "Multiplication de la productivité par 1.5", 160, 50, null); //Trophy trophy3 = GameObject.Find("Medal3").GetComponent<Trophy>(); //new Trophy(3, "Trophée rapidité", "Multiplication de la productivité par 1.5", 270, 50, null); //Trophy trophy4 = GameObject.Find("Trophy1").GetComponent<Trophy>(); //new Trophy(4, "Trophée stratégie", "Une description", 380, 50, null); //Trophy trophy5 = GameObject.Find("Trophy2").GetComponent<Trophy>(); //new Trophy(5, "Trophée légende", "Une description", 490, 50, null); //Trophy trophy6 = GameObject.Find("Trophy3").GetComponent<Trophy>(); //Trophy trophy7 = GameObject.Find("AirportMedal").GetComponent<Trophy>(); //this.Trophies.Add(trophy1); //this.Trophies.Add(trophy2); //this.Trophies.Add(trophy3); //this.Trophies.Add(trophy4); //this.Trophies.Add(trophy5); this.Trophies.Add(GameObject.Find("Medal1").GetComponent <Trophy>()); this.Trophies.Add(GameObject.Find("Medal2").GetComponent <Trophy>()); this.Trophies.Add(GameObject.Find("Medal3").GetComponent <Trophy>()); this.Trophies.Add(GameObject.Find("Trophy1").GetComponent <Trophy>()); this.Trophies.Add(GameObject.Find("Trophy2").GetComponent <Trophy>()); this.Trophies.Add(GameObject.Find("Trophy3").GetComponent <Trophy>()); this.Trophies.Add(GameObject.Find("AirportMedal").GetComponent <Trophy>()); StartCoroutine(checkNewTrophyAvailable()); }
void Start() { GameObject resourceObject = GameObject.Find("Resources"); //resourceObject.transform.position = new Vector3(0, 0, 12); resourceObject.GetComponent<Canvas>().enabled = false; this.GRM = resourceObject.GetComponent<GlobalResourceManager>(); //fill island stats for (int i = 1; i < 5; i++) { foreach (Resource resource in this.GRM.ResourceManagers[i-1].Resources) { GameObject.Find(resource.TypeResource.ToString().ToLower() + i.ToString()).GetComponent<Text>().text = resource.Stock.ToString(); } } //fill total stats foreach (Resource resource in this.GRM.Resources) { GameObject.Find(resource.TypeResource.ToString().ToLower() + "5").GetComponent<Text>().text = resource.Stock.ToString(); } //fill challenge success rate Score score = GameObject.Find("Game").GetComponent<Score>(); GlobalInfo globalInfo = GameObject.Find("GlobalInfo").GetComponent<GlobalInfo>(); float totalSuccessRate = 0; float value = 0; for(int i = 0; i <score.ChallengeSuccessRate.Count; i++) { value = score.ChallengeSuccessRate[i] * 100; totalSuccessRate += value; GameObject.Find("goodAnswersValue" + (i + 1).ToString()).GetComponent<Text>().text = value.ToString("F2") + "%"; } float verticalRate = 0; if (score.verticalAnswers == 0) { verticalRate = 1; } else { verticalRate = ((float) score.verticalGoodAnwsers) / score.verticalAnswers; } GameObject.Find("goodAnswersValue0").GetComponent<Text>().text = (verticalRate * 100).ToString("F2") + "%"; totalSuccessRate += verticalRate * 100; GameObject.Find("goodAnswersValue5").GetComponent<Text>().text = (totalSuccessRate / 5).ToString("F2") +"%"; score.finalChallengeRate = (((float) totalSuccessRate) / 5f); score.addScore(globalInfo.teamName); //fill buildings GameObject.Find("buildingScoreValue").GetComponent<Text>().text = score.BuildingCount.ToString(); //fill Medals GameObject.Find("medalScoreValue").GetComponent<Text>().text = score.MedalCount.ToString(); //fill score GameObject.Find("totalScoreValue").GetComponent<Text>().text = score.ScoreCount.ToString(); SoundPlayer.Instance.playApplauseSound(); }
public static GlobalResourceManager GetInstance() { if (Instance == null) { Instance = new GlobalResourceManager(); } return(Instance); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //初始化表情资源 GlobalResourceManager.Initialize(); Application.Run(new Demo()); }
/// <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); }
/// <summary> /// 使用lvi.Visa库中的类打开与设备的会话(方式1) /// </summary> /// <param name="resourceName">资源名称,例如"TCPIP0::192.168.0.10::inst0::INSTR"</param> private void connectDevice(string resourceName) { try { ITcpipSession session = (ITcpipSession)GlobalResourceManager.Open(resourceName); ibfIo = session.FormattedIO; ShowMsg("*[" + DateTime.Now.ToString() + "] " + "Connect to the device successfully!:lvi.Visa."); } catch { lbxReception.Items.Add("*[" + DateTime.Now.ToString() + "] " + "Can't connect to the device!:lvi.Visa."); } }
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(); } }
private void GetVisaChecked(string visa_addr) { IMessageBasedSession session; try { session = GlobalResourceManager.Open(visa_addr) as IMessageBasedSession; richTextBox1.Text = "Соединение установлено"; } catch (NativeVisaException visaException) { richTextBox1.Text = "Соединение не установлено"; } }
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(); } }
static void Main(string[] args) { IEnumerable <string> devices; try { // Finding all devices and interfaces is straightforward Console.WriteLine("Find all devices and interfaces:"); devices = GlobalResourceManager.Find(); foreach (string device in devices) { Console.WriteLine("\tAddress: {0}, Alias: {1}", device, GlobalResourceManager.Parse(device).AliasIfExists); } } catch (VisaException ex) { Console.WriteLine("Didn't find any devices!"); } Console.WriteLine(); // You can specify other device types using different search strings. Here are some common examples: // All instruments (no INTFC, BACKPLANE or MEMACC) Find("?*INSTR"); // PXI modules Find("PXI?*INSTR"); // USB devices Find("USB?*INSTR"); // GPIB instruments Find("GPIB?*"); // GPIB interfaces Find("GPIB?*INTFC"); // GPIB instruments on the GPIB0 interface Find("GPIB0?*INSTR"); // LAN instruments Find("TCPIP?*"); // SOCKET (::SOCKET) instruments Find("TCPIP?*SOCKET"); // VXI-11 (inst) instruments Find("TCPIP?*inst?*INSTR"); // HiSLIP (hislip) instruments Find("TCPIP?*hislip?*INSTR"); // RS-232 instruments Find("ASRL?*INSTR"); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
/// <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 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(); } }
private bool openGPIB() { try { session = GlobalResourceManager.Open(VISA_ADDRESS, AccessModes.None, 5) as IMessageBasedSession; formattedIO = new MessageBasedFormattedIO(session); MessageBox.Show("The instrument has been successfully connected on GPIB0::25", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } catch (NativeVisaException visaException) { //Shell.WriteLine("Error is:\r\n{0}\r\nPress any key to exit...", visaException); MessageBox.Show("Please check GPIB conncetion. GPIB port of the instrument should be set as GPIB0::25", "Error: Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
/// <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); }
private bool openGPIB() { try { sessionLRC = GlobalResourceManager.Open(LRC_VISA_ADDRESS, AccessModes.None, 50000) as IMessageBasedSession; formattedIOLRC = new MessageBasedFormattedIO(sessionLRC); sessionTEMPCON = GlobalResourceManager.Open(TEMPCON_VISA_ADDRESS, AccessModes.None, 50000) as IMessageBasedSession; formattedIOTEMPCON = new MessageBasedFormattedIO(sessionTEMPCON); MessageBox.Show("The instruments have been successfully connected on GPIB0::25 and GPIB0::12", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } catch (NativeVisaException visaException) { MessageBox.Show("Failed to connect at least one instrument. Please check GPIB conncetion. GPIB port of the LRC Meter and Temperature Controller should be set as GPIB0::25 and GPIB0::12 respectively.", "Error: Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
public bool requirementVerified(GlobalResourceManager GRM) { switch (this.trophyName) { case "Medal3": //8 types de batiments contruits return this.Score.numberOfDifferentBuildingBuilt >= 8; case "Medal2"://12 types de batiments contruits return this.Score.numberOfDifferentBuildingBuilt >= 12; case "Medal1"://tous types de batiments contruits return this.Score.allBuildingBuilt; case "Trophy3": //TOTAL resources count > 6000 return GRM.totalResourceCount > 6000; case "Trophy2": //TOTAL resources count > 15000 return GRM.totalResourceCount > 15000; case "Trophy1": //TOTAL resources count > 30000 return GRM.totalResourceCount > 30000; // Airport requirement managed in the trophy manager //return resourceManager.getResource(TypeResource.Gold).Stock > 10000; //return resourceManager.getResource(TypeResource.Food).Stock > 5000; } return false; }
void Start() { this.resourceManager = gameObject.GetComponent<GlobalResourceManager>(); }
void Start() { this.Client = GameObject.Find("Network").GetComponent<Client>(); //this.Client.MessageTrophyWonEvent += Client_MessageTrophyWonEvent; this.Client.MessageBuildingConstructionEvent += Client_MessageBuildingConstructionEvent; this.ResourceManager = GameObject.Find("Resources").GetComponent<GlobalResourceManager>(); //Trophy trophy1 = GameObject.Find("Medal1").GetComponent<Trophy>(); //new Trophy(1, "Trophée ressources", "Gain de ressources", 50, 50, null); //Trophy trophy2 = GameObject.Find("Medal2").GetComponent<Trophy>(); //new Trophy(2, "Trophée innovation", "Multiplication de la productivité par 1.5", 160, 50, null); //Trophy trophy3 = GameObject.Find("Medal3").GetComponent<Trophy>(); //new Trophy(3, "Trophée rapidité", "Multiplication de la productivité par 1.5", 270, 50, null); //Trophy trophy4 = GameObject.Find("Trophy1").GetComponent<Trophy>(); //new Trophy(4, "Trophée stratégie", "Une description", 380, 50, null); //Trophy trophy5 = GameObject.Find("Trophy2").GetComponent<Trophy>(); //new Trophy(5, "Trophée légende", "Une description", 490, 50, null); //Trophy trophy6 = GameObject.Find("Trophy3").GetComponent<Trophy>(); //Trophy trophy7 = GameObject.Find("AirportMedal").GetComponent<Trophy>(); //this.Trophies.Add(trophy1); //this.Trophies.Add(trophy2); //this.Trophies.Add(trophy3); //this.Trophies.Add(trophy4); //this.Trophies.Add(trophy5); this.Trophies.Add(GameObject.Find("Medal1").GetComponent<Trophy>()); this.Trophies.Add(GameObject.Find("Medal2").GetComponent<Trophy>()); this.Trophies.Add(GameObject.Find("Medal3").GetComponent<Trophy>()); this.Trophies.Add(GameObject.Find("Trophy1").GetComponent<Trophy>()); this.Trophies.Add(GameObject.Find("Trophy2").GetComponent<Trophy>()); this.Trophies.Add(GameObject.Find("Trophy3").GetComponent<Trophy>()); this.Trophies.Add(GameObject.Find("AirportMedal").GetComponent<Trophy>()); StartCoroutine(checkNewTrophyAvailable()); }