private void ShowImages() { Int32 intNums = 0; lstImageView.Visible = true; frmNavigate f = (frmNavigate)this.MdiParent; lstImageView.LargeImageList = f.lstImage; intNums = f.lstImage.Images.Count; var query = (from app in db.Nums where app.n < intNums select app).ToList(); try { Int32 i = 0; foreach (var r in query) { this.lstImageView.Items.Add(r.n.ToString()); this.lstImageView.Items[i].ImageIndex = r.n; i = i + 1; } } catch (System.ArgumentOutOfRangeException exc) { //Debug.WriteLine("Out of range" + exc.Message); } }
private void lnkExport_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { frmNavigate f = (frmNavigate)this.MdiParent; ImageList il = f.lstImage; string strPath = Path.GetTempPath().ToString(); for (int x = 0; x < il.Images.Count; ++x) { strPath = Path.Combine(strPath, "tmpimage"); if (!(System.IO.Directory.Exists(strPath))) { Directory.CreateDirectory(strPath); } strPath = Path.Combine(strPath, x.ToString() + ".bmp"); try { Image temp = imageList1.Images[x]; temp.Save(strPath); } catch (Exception ex) { } } }
public static void PostMain(Int32 intAPPID, Int32 intLNID, string strUser, int intTSID) { string strVer = ""; string strAppBeta = ""; string strDEV = clsUtility.ConfigVal("DEV"); HRLEntities db = efdb(); RexrothEntities dbRexroth = efdbRexroth(); try { System.Security.Principal.WindowsPrincipal s = new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent()); if (strUser == "") { strUser = s.Identity.Name; strUser = strUser.Substring(strUser.IndexOf("\\") + 1); } //var list = db.tblBISystemUID.Where(w => w.BSU_Active == true && w.BSU_Deleted.HasValue == false).ToList(); //var systemUIDs = list.Select(uid => uid.BSU_UID).ToList(); if (strDEV == "1") { string strDevUser = clsUtility.ConfigVal("UID"); if (strDevUser + "" != "") { strUser = strDevUser; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Credo"); } try { //Verify the version var qryApp = (from ap in db.tblApp where ap.APPID == intAPPID select ap).FirstOrDefault(); strVer = qryApp.APP_Version; Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string strVer2 = fvi.FileVersion.ToString().Substring(0, strVer.Length).Trim(); if (Debugger.IsAttached == false) { if (strVer != strVer2) { MessageBox.Show("This App is version " + strVer2 + ", should be " + strVer + ". Be certain you are using the correct shortcut and re-open.", "Credo"); return; } } intAPPID = Convert.ToInt16(qryApp.APP_BetaFor); if (intAPPID == 22 || intAPPID == 24) { var appUserBIList = (from ap in db.vwAppView2 where ap.APPID == 22 && ap.AB_Level == 2 select ap.AS_User).ToList(); var appUserBIAdminList = (from ap in db.vwAppView2 where ap.APPID == 22 && ap.AB_Level > 2 select ap.AS_User).ToList(); var removeList = new List <string>(); foreach (var user in appUserBIList) { if (appUserBIAdminList.Contains(user)) { removeList.Add(user); } } foreach (var user in removeList) { appUserBIList.Remove(user); } } frmNavigate f = new frmNavigate(); Boolean fOpen = false; //if navidation is already open, then close try { frmNavigate frm = clsFormUtil.ReturnFormInst("frmNavigate"); if (frm.Name == "frmNavigate") { f = frm; fOpen = true; } } catch (Exception ex) { } f.WindowState = FormWindowState.Maximized; f.Text = qryApp.APP_Desc + " Version " + strVer2; f.Token = strUser + "_" + DateTime.Now.ToLongTimeString(); f.Parm1 = qryApp.APP_Color; f.AppName = qryApp.APP_Desc; f.LNID = intLNID; f.TSID = intTSID; f.Image = Convert.ToInt32(qryApp.APP_Image); try { vwAssociate qry = (from ct in db.vwAssociate where ct.AS_User == strUser && ct.APPID == intAPPID orderby ct.AB_Level descending select ct).First(); f.Associate = qry; //clsMail.SendPBRoleAssign(1901, 0, qry, true); } catch (Exception ex) { //get default user vwAssociate qry = (from ct in db.vwAssociate where ct.ASID == 1 && ct.APPID == intAPPID orderby ct.AB_Level descending select ct).First(); try { //supplement the default user with this users info... var qry2 = (from ct in dbRexroth.tblAssociate where ct.AS_User == strUser select ct).First(); qry.ASID = qry2.ASID; qry.AS_Email = qry2.AS_Email; qry.AS_First = qry2.AS_First; qry.AS_Last = qry2.AS_Last; qry.AS_User = qry2.AS_User; qry.FullName = qry2.AS_Display; } catch (Exception ex2) { } f.Associate = qry; //} } //try //{ // var qry5 = (from ct in dbRexroth.tblAssociate // where ct.AS_User == strUser // select ct).First(); // f.RexAssoc = qry5; //} //catch (Exception ex4) //{ // //throw ex4; //} f.APPID = intAPPID; if (fOpen == false) { Application.Run(f); } else { f.SetButtons(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Credo"); } }