private void dgControlNumberList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                if (dgControlNumberList.SelectedValue != null)
                {
                    ImusCityHallEntities db = new ImusCityHallEntities();
                    int id = (int)dgControlNumberList.SelectedValue;

                    addbtn.IsEnabled  = false;
                    savebtn.IsEnabled = true;

                    var x = db.ControlNumbers.Find(id);

                    if (x != null)
                    {
                        accountcb.SelectedValue  = x.FundBankID;
                        fundtb.Text              = x.FundBank.Fund.FundName;
                        banktb.Text              = x.FundBank.Bank.BankName;
                        controlnobegintb.Value   = x.BeginingControlNo.Value;
                        controlnoendtb.Value     = x.EndingControlNo.Value;
                        controlnocurrenttb.Value = x.NextControlNo.Value;

                        if (x.Active == true)
                        {
                            activechk.IsChecked = true;
                        }
                        else
                        {
                            activechk.IsChecked = false;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Esempio n. 2
0
        private void searchtb_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (String.IsNullOrEmpty(searchtb.Text))
                {
                }
                else
                {
                    var audit = new AuditTrailModel
                    {
                        Activity   = "Searched item in bank list. SEARCH KEY: " + searchtb.Text,
                        ModuleName = this.GetType().Name,
                        EmployeeID = App.EmployeeID
                    };

                    SystemClass.InsertLog(audit);
                }

                searchbtn_Click(sender, e);
            }
        }
        public void GetList()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    DList = new List <DepartmentList>();
                    using (var db = new ImusCityHallEntities())
                    {
                        var get = db.Departments.Where(m => m.IsActive == true).OrderByDescending(m => m.DepartmentID).ToList();

                        foreach (var item in get)
                        {
                            DepartmentList dl = new DepartmentList();
                            dl.DepartmentID   = item.DepartmentID;
                            dl.DepartmentCode = item.DepartmentCode;
                            dl.DepartmentName = item.DepartmentName;
                            DList.Add(dl);
                        }
                        if (!String.IsNullOrEmpty(txtSearch.Text))
                        {
                            DList = DList.Where(m => m.DepartmentCode.ToUpper().Contains(txtSearch.Text) || m.DepartmentName.ToUpper().Contains(txtSearch.Text)).ToList();
                        }


                        dgDepartmentList.ItemsSource       = DList;
                        dgDepartmentList.SelectedValuePath = "DepartmentID";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Esempio n. 4
0
        public void initpage()
        {
            try
            {
                ViewBag.ControllerName = "Bank Details";
                SystemClass sclass = new SystemClass();
                string      userID = sclass.GetLoggedUser();
                long        userid = long.Parse(userID);
                var         dbmain = new DBContext();
                if (userID != null && userID != "")
                {
                    TBL_AUTH_ADMIN_USER currUser = dbmain.TBL_AUTH_ADMIN_USERS.SingleOrDefault(c => c.USER_ID == userid && c.ACTIVE_USER == true);

                    if (currUser != null)
                    {
                        Session["UserId"] = currUser.USER_ID;
                        // Session["UserName"] = currUser.UserName;
                    }
                }
                if (Session["UserId"] == null)
                {
                    Response.Redirect("~/Login/LogOut");
                    return;
                }
                bool Islogin = false;

                if (Session["UserId"] != null)
                {
                    Islogin = true;
                    ViewBag.CurrentUserId = CurrentUser.USER_ID;
                }
                ViewBag.Islogin = Islogin;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.InnerException);
                return;
            }
        }
Esempio n. 5
0
        // Beware with no extra conditions, you get them all..  Mostly used for debugging
        // use starreport to avoid storing the entries instead pass back one by one
        public static List <ISystem> ListStars(string where = null, string orderby = null, string limit = null,
                                               Action <ISystem> starreport = null)
        {
            List <ISystem> ret = new List <ISystem>();

            if (SystemsDatabase.Instance.RebuildRunning)
            {
                return(ret);
            }

            return(SystemsDatabase.Instance.ExecuteWithDatabase(db =>
            {
                //BaseUtils.AppTicks.TickCountLap("Star");

                var cn = db.Connection;

                using (DbCommand selectSysCmd = cn.CreateSelect("Systems s", MakeSystemQueryNamed, where, orderby, limit: limit, joinlist: MakeSystemQueryNamedJoinList))
                {
                    using (DbDataReader reader = selectSysCmd.ExecuteReader())
                    {
                        while (reader.Read())      // if there..
                        {
                            SystemClass s = MakeSystem(reader);
                            if (starreport != null)
                            {
                                starreport(s);
                            }
                            else
                            {
                                ret.Add(s);
                            }
                        }
                    }
                }

                //System.Diagnostics.Debug.WriteLine("Find stars " + BaseUtils.AppTicks.TickCountLap("Star"));
                return ret;
            }));
        }
Esempio n. 6
0
        private void FindNearestSystem(Point3D curpos, out SystemClass system, out double distance)
        {
            List <SystemClass> systems       = SystemData.SystemList;
            SystemClass        nearestsystem = null;
            double             mindistance   = 1E19;

            for (int ii = 0; ii < systems.Count; ii++)
            {
                SystemClass syscheck    = systems[ii];
                Point3D     syspos      = new Point3D(syscheck.x, syscheck.y, syscheck.z);
                double      curdistance = Point3D.DistanceBetween(curpos, syspos);

                if (curdistance < mindistance)
                {
                    nearestsystem = syscheck;
                    mindistance   = curdistance;
                }
            }

            system   = nearestsystem;
            distance = mindistance;
        }
Esempio n. 7
0
 public void initpage()
 {
     try
     {
         ViewBag.ControllerName = "Power Admin Hosting";
         SystemClass sclass = new SystemClass();
         string      userID = sclass.GetLoggedUser();
         long        userid = long.Parse(userID);
         var         dbmain = new DBContext();
         if (userID != null && userID != "")
         {
             TBL_AUTH_ADMIN_USER currUser = dbmain.TBL_AUTH_ADMIN_USERS.SingleOrDefault(c => c.USER_ID == userid && c.ACTIVE_USER == true);
             if (currUser != null)
             {
                 Session["PowerAdminUserId"] = currUser.USER_ID;
                 // Session["UserName"] = currUser.UserName;
             }
         }
         if (Session["PowerAdminUserId"] == null)
         {
             //Response.Redirect("~/Login/LogOut");
             Response.Redirect(Url.Action("Index", "PowerAdminLogin", new { area = "PowerAdmin" }));
             return;
         }
         bool Islogin = false;
         if (Session["PowerAdminUserId"] != null)
         {
             Islogin = true;
             ViewBag.CurrentUserId = CurrentUser.USER_ID;
         }
         ViewBag.Islogin = Islogin;
     }
     catch (Exception e)
     {
         RedirectToAction("Exception", "ErrorHandler", new { area = "" });
         Console.WriteLine(e.InnerException);
         return;
     }
 }
Esempio n. 8
0
        public ActionResult Index(string returnUrl)
        {
            SystemClass sclass = new SystemClass();
            string      userID = sclass.GetLoggedUser();

            if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl))
            {
                ViewBag.ReturnURL = returnUrl;
            }
            if (Session["UserId"] != null)
            {
                //Response.RedirectToRoute("Dashboard", "Index");
                string username = Session["UserId"].ToString();
                var    db       = new DBContext();
                var    userinfo = db.TBL_MASTER_MEMBER.Where(x => x.UName == username).FirstOrDefault();

                if (userinfo.MEMBER_ROLE == 1)
                {
                    Response.Redirect(Url.Action("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                }
                else if (userinfo.MEMBER_ROLE == null)
                {
                    Response.Redirect(Url.Action("Index", "WhiteLevelAdmin", new { area = "Admin" }));
                }
                else if (userinfo.UNDER_WHITE_LEVEL == null)
                {
                    Response.RedirectToRoute("Dashboard", "Index");
                }
            }
            LoginViewModel model = new LoginViewModel();

            if (Request.Cookies["Login"] != null)
            {
                model.Email    = Request.Cookies["Login"].Values["EmailID"];
                model.Password = Request.Cookies["Login"].Values["Password"];
            }
            return(View(model));
        }
        private void checkbtn_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (voucherlistdg.SelectedValue == null)
            {
                Mouse.OverrideCursor = null;
                MessageBox.Show("Please select an item");
            }
            else
            {
                CheckDisbursement.AddNewCheckEntryWindow addcheck = new CheckDisbursement.AddNewCheckEntryWindow();
                Mouse.OverrideCursor    = null;
                addcheck.DisbursementID = (int)voucherlistdg.SelectedValue;

                if (SystemClass.CheckConnection())
                {
                    ImusCityHallEntities db          = new ImusCityHallEntities();
                    CDSSignatory         signatories = db.CDSSignatories.FirstOrDefault();
                    if (signatories == null)
                    {
                        MessageBox.Show("Please add report signatories");
                    }
                    else if (signatories.CityMayor.Equals(null) || signatories.CityTreasurer.Equals(null))
                    {
                        MessageBox.Show("Please add report signatories");
                    }
                    else
                    {
                        addcheck.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show(SystemClass.DBConnectionErrorMessage);
                }
            }
            Mouse.OverrideCursor = null;
        }
        private void deletebtn_Click(object sender, RoutedEventArgs e)
        {
            if (damgecheckdg.SelectedValue == null)
            {
                MessageBox.Show("Please select an item");
            }
            else
            {
                if (SystemClass.CheckConnection())
                {
                    ImusCityHallEntities db       = new ImusCityHallEntities();
                    int         damageCheckId     = (int)damgecheckdg.SelectedValue;
                    DamageCheck damageCheckDelete = db.DamageChecks.Find(damageCheckId);
                    db.DamageChecks.Remove(damageCheckDelete);
                    db.SaveChanges();
                    MessageBox.Show("Deleted damage check");
                    db = new ImusCityHallEntities();
                    List <DamageCheck> damageCheckList = new List <DamageCheck>();
                    foreach (var item in db.DamageChecks.Where(m => m.FundBankID == fundBankId))
                    {
                        var damageCheck = new DamageCheck()
                        {
                            DamageCheckId = item.DamageCheckId,
                            CheckNumber   = item.CheckNumber,
                            CreatedDate   = item.CreatedDate
                        };

                        damageCheckList.Add(damageCheck);
                    }
                    damgecheckdg.ItemsSource       = damageCheckList.OrderBy(m => m.CheckNumber);
                    damgecheckdg.SelectedValuePath = "DamageCheckId";
                }
                else
                {
                    MessageBox.Show(SystemClass.DBConnectionErrorMessage);
                }
            }
        }
 private void editbtn_Click(object sender, RoutedEventArgs e)
 {
     if (checklistdg.SelectedValue != null)
     {
         int id = (int)checklistdg.SelectedValue;
         if (SystemClass.CheckConnection())
         {
             ImusCityHallEntities db = new ImusCityHallEntities();
             if (db.Checks.Find(id).Status == (int)CheckStatus.Cancelled)
             {
                 MessageBox.Show("Checked is already cancelled and it cannot be edited");
             }
             else if (db.Checks.Find(id).Status == (int)CheckStatus.Released)
             {
                 MessageBox.Show("Checked is already released and it cannot be edited");
             }
             else if (db.Checks.Find(id).Status == (int)CheckStatus.Deleted)
             {
                 MessageBox.Show("Checked is already deleted and it cannot be edited");
             }
             else
             {
                 EditCheckWindow edit = new EditCheckWindow();
                 edit.CheckID = id;
                 edit.ShowDialog();
                 LoadItems();
             }
         }
         else
         {
             MessageBox.Show(SystemClass.DBConnectionErrorMessage);
         }
     }
     else
     {
         MessageBox.Show("Please select an entry");
     }
 }
Esempio n. 12
0
        public AssignTravelLogSystemForm(ISystem refsys, DateTime?visited = null)
        {
            InitializeComponent();
            SystemClass.GetSystemAndAlternatives(refsys, out _linkSystem, out _alternatives, out _namestatus);

            this.tbLogSystemName.Text  = refsys.name;
            this.tbVisitedDate.Text    = visited == null ? "-" : visited.ToString();
            this.tbLogCoordX.Text      = refsys.HasCoordinate ? refsys.x.ToString("0.00") : "?";
            this.tbLogCoordY.Text      = refsys.HasCoordinate ? refsys.y.ToString("0.00") : "?";
            this.tbLogCoordZ.Text      = refsys.HasCoordinate ? refsys.z.ToString("0.00") : "?";
            this.tbLogCoordX.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordY.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordZ.TextAlign = refsys.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;

            UpdateLinkedSystemList(_linkSystem);
            tbManualSystemName.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            tbManualSystemName.AutoCompleteSource = AutoCompleteSource.CustomSource;

            tbManualSystemName.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete);

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            theme.ApplyToForm(this);
        }
Esempio n. 13
0
        public void Set(SystemClass system)
        {
            if (TargetSystem == null || !TargetSystem.Equals(system))
            {
                TargetSystem = system;
                ClearDataGridViewDistancesRows();
            }

            if (TargetSystem == null)
            {
                return;
            }

            textBoxSystemName.Text = TargetSystem.name;
            labelStatus.Text       = "Enter Distances";
            labelStatus.BackColor  = Color.LightBlue;

            UnfreezeTrilaterationUI();
            dataGridViewDistances.Focus();

            PopulateSuggestedSystems();
            PopulateClosestSystems();
        }
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         ImusCityHallEntities db = new ImusCityHallEntities();
         var fund = from p in db.FundBanks
                    where p.IsActive == true
                    select new
         {
             ID   = p.FundBankID,
             Name = p.Bank.BankName + " - " + p.Fund.FundName
         };
         fundcb.ItemsSource       = fund.ToList();
         fundcb.DisplayMemberPath = "Name";
         fundcb.SelectedValuePath = "ID";
         startdatedp.SelectedDate = DateTime.Today.Date;
         enddatedp.SelectedDate   = DateTime.Today.Date;
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
Esempio n. 15
0
 public void LoadStatus()
 {
     if (SystemClass.CheckConnection())
     {
         try
         {
             using (var db = new ImusCityHallEntities())
             {
                 var find = db.EmployeeStatus.Find(StatusID);
                 txtName.Text = find.EmployeeStatusName;
                 txtCode.Text = find.EmployeeStatusCode;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
        private void UpdateTotalDistances()
        {
            double distance = 0;

            txtCmlDistance.Text = distance.ToString("0.00") + "LY";
            txtP2PDIstance.Text = distance.ToString("0.00") + "LY";
            if (dataGridViewRouteSystems.Rows.Count > 1)
            {
                SystemClass firstSC = null;
                SystemClass lastSC  = null;
                for (int i = 0; i < dataGridViewRouteSystems.Rows.Count; i++)
                {
                    if (firstSC == null && dataGridViewRouteSystems[0, i].Tag != null)
                    {
                        firstSC = (SystemClass)dataGridViewRouteSystems[0, i].Tag;
                    }
                    if (dataGridViewRouteSystems[0, i].Tag != null)
                    {
                        lastSC = (SystemClass)dataGridViewRouteSystems[0, i].Tag;
                    }
                    String value = dataGridViewRouteSystems[1, i].Value as string;
                    if (!String.IsNullOrWhiteSpace(value))
                    {
                        distance += Double.Parse(value);
                    }
                }
                txtCmlDistance.Text = distance.ToString("0.00") + "LY";
                distance            = 0;
                if (firstSC != null && lastSC != null)
                {
                    Point3D first = new Point3D(firstSC.x, firstSC.y, firstSC.z);
                    Point3D last  = new Point3D(lastSC.x, lastSC.y, lastSC.z);
                    distance            = Point3D.DistanceBetween(first, last);
                    txtP2PDIstance.Text = distance.ToString("0.00") + "LY";
                }
            }
        }
Esempio n. 17
0
    public bool isResult(int QuestionID = 0, int userId = 0)
    {
        try
        {
            if (userId == 0)
            {
                SystemClass objSystem = new SystemClass();
                userId = objSystem.getIDAccount();
            }

            if (userId == 0)
            {
                return(false);
            }


            SqlCommand Cmd = this.getSQLConnect();
            Cmd.CommandText = "SELECT ID FROM tblAnswerResult AS P WHERE P.QuestionID = @QuestionID AND USERID = @USERID";
            Cmd.Parameters.Add("QuestionID", SqlDbType.Int).Value = QuestionID;
            Cmd.Parameters.Add("USERID", SqlDbType.Int).Value     = userId;

            int ret = (int)Cmd.ExecuteScalar();

            this.SQLClose();

            if (ret != 0)
            {
                return(true);
            }
        }
        catch (Exception ex)
        {
            this.Message   = ex.Message;
            this.ErrorCode = ex.HResult;
        }
        return(false);
    }
 private void editbtn_Click(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         if (accountslistlb.SelectedValue != null)
         {
             MessageBox.Show("You are now in edit mode, changes will apply after you click the save button");
             fundcb.IsEnabled          = true;
             bankcb.IsEnabled          = true;
             accountnumbertb.IsEnabled = true;
             flooramounttb.IsEnabled   = true;
             savebtn.IsEnabled         = true;
             editbtn.IsEnabled         = false;
         }
         else
         {
             MessageBox.Show("Please select an account number in the list");
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
Esempio n. 19
0
        private void PopulateLocalWantedSystems()
        {
            wanted = WantedSystemClass.GetAllWantedSystems();

            if (wanted != null && wanted.Any())
            {
                foreach (WantedSystemClass sys in wanted)
                {
                    SystemClass star = SystemClassDB.GetSystem(sys.system);
                    if (star == null)
                    {
                        star = new SystemClassDB(sys.system);
                    }

                    var index = dataGridViewClosestSystems.Rows.Add("Local");
                    dataGridViewClosestSystems[1, index].Value = sys.system;
                    dataGridViewClosestSystems[1, index].Tag   = star;
                }
            }
            else
            {
                wanted = new List <WantedSystemClass>();
            }
        }
Esempio n. 20
0
        public void AddWantedSystem(string sysName)
        {
            if (wanted == null)
            {
                PopulateLocalWantedSystems();
            }
            else
            {
                // there can be multiple instances tied to the history form so this might already exist...
                List <WantedSystemClass> dbCheck = WantedSystemClass.GetAllWantedSystems();
                if (dbCheck != null && dbCheck.Where(s => s.system == sysName).Any()) // if we have wanted systems in the DB... and its there..
                {
                    return;
                }
            }

            WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault();  //duplicate?

            if (entry == null)
            {
                WantedSystemClass toAdd = new WantedSystemClass(sysName);       // make one..
                toAdd.Add();                                                    // add to db.

                wanted.Add(toAdd);

                ISystem star = SystemCache.FindSystem(sysName);
                if (star == null)
                {
                    star = new SystemClass(sysName);
                }

                var index = dataGridViewClosestSystems.Rows.Add("Local");
                dataGridViewClosestSystems[1, index].Value = sysName;
                dataGridViewClosestSystems[1, index].Tag   = star;
            }
        }
Esempio n. 21
0
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         try
         {
             using (var db = new ImusCityHallEntities())
             {
                 cbRank.ItemsSource       = db.EmployeeRanks.OrderBy(m => m.EmployeeRankName).ToList();
                 cbRank.DisplayMemberPath = "EmployeeRankName";
                 cbRank.SelectedValuePath = "EmployeeRankID";
                 txtName.Focus();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
Esempio n. 22
0
 private void resetpasswordbtn_Click(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         ImusCityHallEntities db = new ImusCityHallEntities();
         if (employeelistlb.SelectedValue == null)
         {
             MessageBox.Show("Please select an employee");
         }
         else
         {
             var        employee       = db.Employees.Find((int)employeelistlb.SelectedValue);
             AspNetUser aspuser        = db.AspNetUsers.FirstOrDefault(m => m.UserName == employee.EmployeeNo);
             var        passwordHasher = new Microsoft.AspNet.Identity.PasswordHasher();
             aspuser.PasswordHash = passwordHasher.HashPassword("imuscitygov");
             db.SaveChanges();
             MessageBox.Show("Employee account has been reset to" + Environment.NewLine + "Default Password: imuscitygov");
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
Esempio n. 23
0
        internal string GetNewSystems(SQLiteDBClass db)
        {
            string json;
            string date    = "2010-01-01 00:00:00";
            string lstsyst = db.GetSettingString("EDSMLastSystems", "2010-01-01 00:00:00");

            string retstr = "";


            Application.DoEvents();

            json = RequestSystems(lstsyst);

            db.GetAllSystems();

            List <SystemClass> listNewSystems = SystemClass.ParseEDSM(json, ref date);

            retstr = listNewSystems.Count.ToString() + " new systems from EDSM." + Environment.NewLine;
            Application.DoEvents();
            SystemClass.Store(listNewSystems);
            db.PutSettingString("EDSMLastSystems", date);

            return(retstr);
        }
Esempio n. 24
0
 private void deletebtn_Click(object sender, RoutedEventArgs e)
 {
     if (customerdg.SelectedValue == null)
     {
         MessageBox.Show("Please select a customer from the list");
     }
     else
     {
         if (SystemClass.CheckConnection())
         {
             int id = (int)customerdg.SelectedValue;
             ImusCityHallEntities db = new ImusCityHallEntities();
             ImusCityGovernmentSystem.Model.Customer customer = db.Customers.Find(id);
             customer.IsActive = false;
             db.SaveChanges();
             MessageBox.Show("Customer removed");
             LoadCustomer(searchtb.Text);
         }
         else
         {
             MessageBox.Show(SystemClass.DBConnectionErrorMessage);
         }
     }
 }
Esempio n. 25
0
        private void deleteAllWithKnownPositionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string sysName = "";

            for (int i = dataGridViewClosestSystems.RowCount - 1; i >= 0; i--)
            {
                DataGridViewRow r = dataGridViewClosestSystems.Rows[i];
                sysName = r.Cells[1].Value.ToString();
                if (r.Cells[0].Value.ToString() == "Local")
                {
                    SystemClass sys = getSystemForTrilateration(sysName);
                    if (sys.HasCoordinate)
                    {
                        WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault();
                        if (entry != null)
                        {
                            entry.Delete();
                            dataGridViewClosestSystems.Rows.Remove(r);
                            wanted.Remove(entry);
                        }
                    }
                }
            }
        }
Esempio n. 26
0
        public void DivisionUpdate()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    using (var db = new ImusCityHallEntities())
                    {
                        var find = db.Divisions.Find(DivisionID);
                        find.DivisionCode = txtCode.Text;
                        find.DivisionName = txtName.Text;
                        find.DepartmentID = (int)departmentcb.SelectedValue;
                        db.SaveChanges();

                        var audit = new AuditTrailModel
                        {
                            Activity   = "Updated an item in division list. DIV ID: " + DivisionID.ToString(),
                            ModuleName = this.GetType().Name,
                            EmployeeID = App.EmployeeID
                        };

                        SystemClass.InsertLog(audit);
                        MessageBox.Show("Division updated successfully", "System Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Esempio n. 27
0
        private void PopulateLocalWantedSystems()
        {
            wanted = WantedSystemClass.GetAllWantedSystems();

            if (wanted != null && wanted.Any())
            {
                foreach (WantedSystemClass sys in wanted)
                {
                    ISystem star = discoveryform.history.FindSystem(sys.system, discoveryform.galacticMapping, false);
                    if (star == null)
                    {
                        star = new SystemClass(sys.system);
                    }

                    var index = dataGridViewClosestSystems.Rows.Add("Local");
                    dataGridViewClosestSystems[1, index].Value = sys.system;
                    dataGridViewClosestSystems[1, index].Tag   = star;
                }
            }
            else
            {
                wanted = new List <WantedSystemClass>();
            }
        }
Esempio n. 28
0
        public void LoadIdentificationCards(int id)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db = new ImusCityHallEntities();
                gd.Clear();
                db = new ImusCityHallEntities();
                var identicationCards = db.IdentificationCardTypes.Where(m => m.IsActive == true).OrderBy(m => m.CardType).ToList();
                foreach (var dr in identicationCards)
                {
                    bool   selectedCard = false;
                    string cardNumber   = string.Empty;
                    if (db.CustomerIdentificationCards.Any(m => m.CustomerID == id && m.IdentificationCardTypeID == dr.IdentificationCardTypeID))
                    {
                        selectedCard = true;
                        cardNumber   = db.CustomerIdentificationCards.FirstOrDefault(m => m.CustomerID == id && m.IdentificationCardTypeID == dr.IdentificationCardTypeID).IdentificationNumber;
                    }
                    IdentificationCardModel i = new IdentificationCardModel()
                    {
                        Name       = dr.CardType,
                        Id         = dr.IdentificationCardTypeID,
                        IsSelected = selectedCard,
                        CardNumber = cardNumber
                    };
                    gd.Add(i);
                }

                customercardlb.ItemsSource       = gd;
                customercardlb.SelectedValuePath = "Id";
                customercardlb.Items.Refresh();
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
Esempio n. 29
0
        public AssignTravelLogSystemForm(TravelHistoryControl travelHistory, VisitedSystemsClass vsc)
        {
            InitializeComponent();
            this._travelHistory  = travelHistory;
            this._travelLogEntry = vsc;
            this._linkSystem     = vsc.curSystem;

            this.tbLogSystemName.Text  = vsc.Name;
            this.tbDateVisited.Text    = vsc.Time.ToString();
            this.tbLogCoordX.Text      = vsc.HasTravelCoordinates ? vsc.X.ToString("0.000") : "?";
            this.tbLogCoordY.Text      = vsc.HasTravelCoordinates ? vsc.Y.ToString("0.000") : "?";
            this.tbLogCoordZ.Text      = vsc.HasTravelCoordinates ? vsc.Z.ToString("0.000") : "?";
            this.tbLogCoordX.TextAlign = vsc.HasTravelCoordinates ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordY.TextAlign = vsc.HasTravelCoordinates ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordZ.TextAlign = vsc.HasTravelCoordinates ? HorizontalAlignment.Right : HorizontalAlignment.Center;

            UpdateLinkedSystemList(vsc.curSystem);
            tbManualSystemName.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            tbManualSystemName.AutoCompleteSource = AutoCompleteSource.CustomSource;
            AutoCompleteStringCollection autocomplete = new AutoCompleteStringCollection();

            SystemClass.GetSystemNames(ref autocomplete);
            tbManualSystemName.AutoCompleteCustomSource = autocomplete;
        }
        public void GetList()
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    RList = new List <RankList>();
                    using (var db = new ImusCityHallEntities())
                    {
                        var get = db.EmployeeRanks.OrderBy(m => m.EmployeeRankName).ToList();

                        foreach (var item in get)
                        {
                            RankList rl = new RankList();
                            rl.RankID   = item.EmployeeRankID;
                            rl.RankName = item.EmployeeRankName;
                            rl.RankCode = item.RankCode;
                            RList.Add(rl);
                        }
                        if (!String.IsNullOrEmpty(txtSearch.Text))
                        {
                            RList = RList.Where(m => m.RankName.ToUpper().Contains(txtSearch.Text)).ToList();
                        }
                        dgRankList.ItemsSource = RList.OrderByDescending(m => m.RankID);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }