public ActionResult Create(Personnel personnel, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //image upload
                    if (file == null || !isImageValid(file))
                    {
                        ModelState.AddModelError(string.Empty, string.Empty);
                    }
                    else
                    {
                        isActivePersonel(personnel);
                        db.Insert(personnel);

                        //Save Image File to Local
                        string imagePath = "~/Uploads/Images/" + "Image_" + personnel.ID + ".png";
                        saveImage(file, imagePath);

                        //Save Image Path to DB and Update Personnel
                        personnel.PhotoPath = imagePath;
                        db.Update(personnel);

                        return RedirectToAction("Index");
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return View(personnel);
        }
        // setup for a new Personnel object
        public PersonnelDialog()
        {
            InitializeComponent();
            person = new Personnel();
            buttonDelete.Visible = false;

            comboBoxType.SelectedIndex = 0;
        }
 static void Main()
 {
     Staff[] nojo = new Staff[100];
     nojo[0] = new Manager();
     nojo[1] = new Personnel();
     nojo[2] = new Account();
     nojo[3] = new Manager();
     nojo[4] = new Finance();
 }
Example #4
0
    /// <summary>
    /// 创建人员列表项
    /// </summary>
    public HistoryPersonsSearchUIItem CreatePersonItem(Personnel personnelT)
    {
        HistoryPersonsSearchUIItem item = Instantiate(searchItem);

        item.InitData(personnelT);
        item.transform.SetParent(personsGrid.transform);
        item.transform.localPosition = Vector3.zero;
        item.transform.localScale    = Vector3.one;
        //item.gameObject.SetActive(true);
        return(item);
    }
Example #5
0
        public static Resource ToPersonnelEntity(this Personnel model)
        {
            var entity = new Resource
            {
                IsActive     = true,
                IsDeleted    = false,
                ResourceType = Type.Personnel
            };

            return(model.UpdatePersonnelEntity(entity));
        }
Example #6
0
        public Personnel Update(Personnel personnel)
        {
            var request = NewRequest("personnel/{id}", Method.PUT);

            request.AddUrlSegment("id", personnel.PersonnelId.ToString());
            request.AddBody(personnel);

            var results = Execute <Personnel>(request);

            return(results.Data);
        }
Example #7
0
        public UpsertResult <Personnel> UpsertByExternalId(Personnel personnel)
        {
            var found = GetByExternalId(personnel.ExternalId);

            if (found != null)
            {
                personnel.PersonnelId = found.PersonnelId;
            }

            return(Upsert(personnel));
        }
Example #8
0
        /// <summary>
        /// Méthode qui crée une requête SQL puis l'envoie à la classe ConnexionBDD pour supprimer un membre du personnel de la base de données.
        /// </summary>
        /// <param name="personnel">Objet de type Personnel, correspondant au membre du personnel à supprimer.</param>
        public static void DelPersonnel(Personnel personnel)
        {
            string req = "delete from personnel where idpersonnel = @idpersonnel";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@idpersonnel", personnel.IdPersonnel);
            ConnexionBDD connection = ConnexionBDD.GetInstance(connectionString);

            connection.ReqUpdate(req, parameters);
            connection.Close();
        }
        public IHttpActionResult GetPersonnel(string id)
        {
            Personnel personnel = db.Personnels.Find(id);

            if (personnel == null)
            {
                return(NotFound());
            }

            return(Ok(personnel));
        }
Example #10
0
        public bool RemoveSinglePersonnel()
        {
            bool ret = (Personnel == Personnel.None);

            Personnel = Personnel switch
            {
                Personnel.HumanDouble => Personnel.HumanSingle,
                _ => Personnel.None
            };
            return(ret);
        }
Example #11
0
        /// <summary>
        /// Ajouter un <paramref name="pers"/> dans la table Personnel de la base de données.
        /// </summary>
        /// <returns>
        /// Nombre de lignes affectées
        /// </returns>
        /// <param name="pers">un objet personnel</param>
        public int ajouterPersonne(Personnel pers)
        {
            DbCommand cmd = db.CreerCommande();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "INSERT INTO Personnel(nom  , prénom , adresse_mail ) " +
                              "VALUES ('" + pers.nom + "', '"
                              + pers.prenom + "', '"
                              + pers.mail + "')";
            return(db.ExecuterRequete(cmd));
        }
Example #12
0
 public static Resource ToResource(this Personnel personnel)
 {
     return(new Resource
     {
         ResourceId = personnel.MarineId.GetHashCode(),
         Location = personnel.Location,
         Type = Enums.ResourceType.Personnel,
         Available = personnel.DateReturning < DateTime.Now,
         CertificationLevel = personnel.CertificationLevel
     });
 }
Example #13
0
 public static Creneau One(Personnel pers, DateTime date, DateTime heureDebut, DateTime heureFin)
 {
     try
     {
         return(CreneauDao.getOneCreneau(pers, date, heureDebut, heureFin));
     }
     catch (Exception ex)
     {
         throw new Exception("Impossible d'atteindre l'enregistrement", ex);
     }
 }
Example #14
0
        public BL_Result <Personnel> PersonnelUpdate(string db_name, BL_Result <Personnel> per)
        {
            Repository <Personnel> repo_personnel = new Repository <Personnel>(db_name);
            Personnel personnel = repo_personnel.Find(x => x.Id == per.Result.Id);

            if (personnel != null)
            {
                personnel.Name                     = per.Result.Name;
                personnel.Surname                  = per.Result.Surname;
                personnel.City                     = per.Result.City;
                personnel.Birthday                 = per.Result.Birthday;
                personnel.Tc_No                    = per.Result.Tc_No;
                personnel.SGK_No                   = per.Result.SGK_No;
                personnel.MilitaryStatus           = per.Result.MilitaryStatus;
                personnel.MaritalStatus            = per.Result.MaritalStatus;
                personnel.Phone                    = per.Result.Phone;
                personnel.Vehicle                  = per.Result.Vehicle;
                personnel.VehicleRegistrationPlate = per.Result.VehicleRegistrationPlate;
                personnel.NameOfRelative           = per.Result.NameOfRelative;
                personnel.SurnameOfRelative        = per.Result.SurnameOfRelative;
                personnel.PhoneOfRelative          = per.Result.PhoneOfRelative;
                personnel.Address                  = per.Result.Address;
                personnel.Company                  = per.Result.Company;
                personnel.S_Central                = per.Result.S_Central;
                personnel.Chief                    = per.Result.Chief;
                personnel.Position                 = per.Result.Position;
                personnel.StartingDate             = per.Result.StartingDate;
                personnel.Salary                   = per.Result.Salary;
                personnel.English_speak            = per.Result.English_speak;
                personnel.English_write            = per.Result.English_write;
                personnel.English_read             = per.Result.English_read;
                personnel.German_speak             = per.Result.German_speak;
                personnel.German_write             = per.Result.German_write;
                personnel.German_read              = per.Result.German_read;
                personnel.French_speak             = per.Result.French_speak;
                personnel.French_write             = per.Result.French_write;
                personnel.French_read              = per.Result.French_read;
                personnel.OtherLanguage            = per.Result.OtherLanguage;
                personnel.SchoolName               = per.Result.SchoolName;
                personnel.Section                  = per.Result.Section;
                personnel.SchoolGraduation         = per.Result.SchoolGraduation;
                personnel.Grade                    = per.Result.Grade;
                personnel.DiseaseState             = per.Result.DiseaseState;
                personnel.HealthSituation          = per.Result.HealthSituation;
                personnel.DrivingLicense           = per.Result.DrivingLicense;
                personnel.Shift                    = per.Result.Shift;
                personnel.Smoke                    = per.Result.Smoke;
                personnel.Alcohol                  = per.Result.Alcohol;
                personnel.ProfileImage             = per.Result.ProfileImage;
                personnel.CurrencyUnit             = per.Result.CurrencyUnit;
            }
            repo_personnel.Update(personnel);
            return(result_personnel);
        }
Example #15
0
        public int Update(Personnel record)
        {
            int result = 0;

            using (AppDBContext dbContext = new AppDBContext(_config))
            {
                dbContext.Entry(record).State = EntityState.Modified;
                result = dbContext.SaveChanges();
            }
            return(result);
        }
 /// <summary>
 /// 获取人员历史轨迹数据根据人员信息
 /// </summary>
 public List <Position> GetPositionsByPersonnel(Personnel p)
 {
     if (personnel_Points.ContainsKey(p))
     {
         return(personnel_Points[p]);
     }
     else
     {
         return(null);
     }
 }
        public async Task <IActionResult> Create([Bind("Id,Department,FirstName,FamilyName,Address,Dob,Gender,Position")] Personnel personnel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personnel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personnel));
        }
 private void isActivePersonel(Personnel personnel)
 {
     if (personnel.ExitDate.HasValue)
     {
         personnel.isActive = false;
     }
     else
     {
         personnel.isActive = true;
     }
 }
 public ActionResult <Personnel> Post([FromBody] Personnel newPers)
 {
     try
     {
         return(Ok(_service.Create(newPers)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 /// <summary>
 /// Constructeur de modification
 /// </summary>
 /// <param name="name">nom de la fenetre</param>
 /// <param name="p">personnel</param>
 public InputModifPersonnelForm(string name, Personnel p)
 {
     input         = false;
     this.modifCat = p.categoriePersonnel.id;
     this.Text     = name;
     InitializeComponent();
     this.nomBox.Text    = p.nom;
     this.prenomBox.Text = p.prenom;
     this.modifId        = p.id;
     loadCategories();
 }
Example #21
0
        public int Create(Personnel newP)
        {
            string sql = @"
        INSERT INTO personnel
        (jobId, contractorId)
        VALUES
        (@JobId, @ContractorId);
        SELECT LAST_INSERT_ID();";

            return(_db.ExecuteScalar <int>(sql, newP));
        }
Example #22
0
 public Absence VerifieDateUnique(Personnel personnel, DateTime dateDebut)
 {
     foreach (Absence absence in personnel.Absences)
     {
         if (absence.DateDebut.Date.Equals(dateDebut.Date))
         {
             return(absence);
         }
     }
     return(null);
 }
    /// <summary>
    /// 创建人员列表
    /// </summary>
    public HistoryPersonUIItem CreatePersonItem(Personnel personnelT, Color colorT)
    {
        HistoryPersonUIItem item = Instantiate(PersonItemPrefab);

        item.Init(personnelT, colorT);
        item.transform.SetParent(personsGrid.transform);
        item.transform.localPosition = Vector3.zero;
        item.transform.localScale    = Vector3.one;
        item.gameObject.SetActive(true);
        return(item);
    }
Example #24
0
        /**
         * Methodes pour aider aux tests
         * **/
        public static Personnel creerPersonnel(String nom, String prenom)
        {
            Personnel obj = new Personnel();

            obj.nom                = nom;
            obj.prenom             = prenom;
            obj.categoriePersonnel = CategoriePersonnelTest.creerCategoriePersonnel("TEST_PERSONNEL");
            Personnel resultat = PersonnelDAO.create(obj);

            return(resultat);
        }
        // GET api/Personnel/5
        public Personnel GetPersonnel(int id)
        {
            Personnel personnel = db.Personnel.Find(id);

            if (personnel == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(personnel);
        }
 /// <summary>
 /// 设置人员所在区域名称
 /// </summary>
 /// <param name="personnel"></param>
 /// <param name="nodeName"></param>
 public static void SetItemArea(Personnel personnel, string nodeName)
 {
     if (UIManage.Instance.isShowNewHistoryWindow)
     {
         MultHistoryPlayUINew.Instance.SetItemArea(personnel, nodeName);
     }
     else
     {
         MultHistoryPlayUI.Instance.SetItemArea(personnel, nodeName);
     }
 }
        /// <summary>
        /// suppression de toutes les absences lors de la suprression d'un personnel
        /// </summary>
        /// <param name="personnel"></param>
        public static void DelAbsencesPersonnel(Personnel personnel)
        {
            string req = "delete from absence where idpersonnel = @idpersonnel;";
            Dictionary <string, object> parameters = new Dictionary <string, object>
            {
                { "@idpersonnel", personnel.Idpersonnel },
            };
            ConnexionBDD conn = ConnexionBDD.GetInstance(stringConnect);

            conn.ReqUpdate(req, parameters);
        }
Example #28
0
        private void AddPersonnelButton_Click(object sender, EventArgs e)
        {
            Personnel newPersonnel = new Personnel();
            newPersonnel.FirstName = FirstNameTextBox.Text;
            newPersonnel.LastName = LastNameTextBox.Text;
            newPersonnel.HireDate = HireDateTimePicker.Value;
            newPersonnel.Position = PositionListBox.SelectedItem.ToString();

            _bindingSource.Add(newPersonnel);
            pnpPersonnel.Add(newPersonnel);
        }
Example #29
0
        /// <summary>
        /// Charge les données des affectations
        /// </summary>
        private void personnelDetailsGridViewLoad()
        {
            Personnel p = getCurrentPersonnel();

            if (p != null)
            {
                List <Cours>            coursAll = CoursDAO.findByPersonnel(p.id);
                BindingListView <Cours> bindingSourcePersonnelDetails = new BindingListView <Cours>(coursAll);
                personnelDetailsGridView.DataSource = bindingSourcePersonnelDetails;
            }
        }
Example #30
0
 public static Creneau One(Personnel pers)
 {
     try
     {
         return(CreneauDao.getOneCreneau(pers));
     }
     catch (Exception ex)
     {
         throw new Exception("Impossible d'atteindre l'enregistrement", ex);
     }
 }
Example #31
0
    // Use this for initialization
    IEnumerator Start()
    {
        officeList = new MyRooms();
        personList = new Personnel();
        list       = new List <GameObject>();
        string  url  = "http://localhost:5000/room/";
        WWWForm form = new WWWForm();

        form.AddField("username", "asd");
        form.AddField("password", "asd");
        var headers = form.headers;

        byte[] rawData = form.data;
        headers["Authorization"] = "kLVHntU5YCsQku6GPf1Ehz9cPJ4lwO7krUOgICtSOefIiJ2QGZkbrlXiAXPH";

        using (WWW www = new WWW(url, rawData, headers)) {
            yield return(www);

            if (www.error == null)
            {
                officeList = JsonUtility.FromJson <MyRooms>(www.text);

                foreach (MyRoomData room in officeList.rooms)
                {
                    GameObject newOffice = (GameObject)GameObject.Instantiate(officePrefab);
                    newOffice.transform.SetParent(contentPanel, false);

                    RoomPrefab prefab = newOffice.GetComponent <RoomPrefab>();
                    prefab.Setup(room);
                    list.Add(newOffice);
                }
            }
            else
            {
                Debug.Log("ERROR: " + www.error);
            }
        }

        url = "http://localhost:5000/personnel/";
        using (WWW www = new WWW(url, rawData, headers)) {
            yield return(www);

            if (www.error == null)
            {
                personList = JsonUtility.FromJson <Personnel>(www.text);
                navScript.GetPersonnelList(this.personList);
            }
            else
            {
                Debug.Log("ERROR: " + www.error);
            }
        }
    }
        private void Form3_Load(object sender, EventArgs e)
        {
            if (Main.Namee == "مسئول ثبت")
            {
                btn_sodor.Enabled = false;
            }
            Cmb_var_per.SelectedValue = "همه";
            Personnel personel = new Personnel();
            DataTable dt       = personel.getALLData();

            gridEX1.DataSource = dt;
        }
        public ActionResult Create(PersonnelViewModel model)
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            Personnel per = new Personnel();

            per.FirstName      = model.FirstNameP;
            per.LastName       = model.LastNameP;
            per.Identity       = model.Identity;
            per.Email          = model.Email;
            per.Notes          = model.Notes;
            per.CreatedAt      = DateTime.Now;
            per.LastModifiedAt = DateTime.Now;
            per.DeletedAt      = model.DeletedAt;
            per.Active         = model.Active;

            db.Personnel.Add(per);

            ViewBag.UserIdentity = new SelectList((from u in db.User select new { User_id = u.User_id, UserIdentity = u.UserIdentity }), "User_id", "UserIdentity", null);
            User usr = new User();

            usr.UserIdentity = model.UserIdentity;
            usr.Password     = "******";
            usr.Personnel    = per;

            db.User.Add(usr);

            Phone pho = new Phone();

            pho.PhoneNum_1 = model.PhoneNum_1;
            pho.Personnel  = per;

            db.Phone.Add(pho);

            PostOffices pos = new PostOffices();

            pos.PostalCode = model.PostalCode;
            pos.PostOffice = model.PostOffice;
            pos.Personnel  = per;

            db.PostOffices.Add(pos);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }//create
Example #34
0
        public int AddPersonnel(Personnel personnel)
        {
            Attendances attendances = new Attendances();

            attendances.PersonnelID      = personnel.ID;
            attendances.AttendanceStates = 1;
            db.Attendances.Add(attendances);
            db.Personnel.Add(personnel);
            int result = db.SaveChanges();

            return(result);
        }
    public static Personnel InsertTSW_Personnel(Personnel value)
    {
        Personnel retval =  new Personnel();
        SqlParameter[] param = new SqlParameter[] {
        new SqlParameter("@FromLive", value.FromLive),
        new SqlParameter("@TourID", value.TourID),
        new SqlParameter("@PersonnelID", value.PersonnelID),
        new SqlParameter("@TitleID", value.TitleID)
        };

        //I am pointing to the practice database
        using (SqlDataReader reader = SqlHelper.ExecuteReader(Helper.ConnectionString, CommandType.StoredProcedure, "ws_usp_AssignPersonnelToTour", param))
        {
            if (reader.Read())
            {
                retval = Read(reader);
            }
        }
        return retval;
    }
        //private HelpForm helpForm;

        public MDI_ParentForm(Login lgnForm, int loginId)
        {
            InitializeComponent();
            objects = new ObjectHolder();
            currentUser = objects.GetPersonnelById(loginId);
                      
            if (currentUser.IsAdmin)
            {
                isAdmin = true;
                lblUserName.Text = currentUser.FirstName + " " + currentUser.LastName + "  \n(Administrator)";
            }  
            else
            {
                lblUserName.Text = currentUser.FirstName + " " + currentUser.LastName + "  \n(User)";
            }
            this.loginForm = lgnForm;

            
            SetupTreeView();
        }
Example #37
0
        private void AddPersonnelButton_Click(object sender, EventArgs e)
        {
            Personnel newPersonnel = new Personnel();
            newPersonnel.FirstName = FirstNameTextBox.Text;
            newPersonnel.LastName = LastNameTextBox.Text;
            newPersonnel.Position = PositionListBox.SelectedItem.ToString();
            newPersonnel.HireDate = HireDatePicker.Value;

            myBindingSource.Add(newPersonnel);
            pnpPersonnel.Add(newPersonnel);

            PnpPersonnelDataGridView.Columns[6].Visible = false;
            PnpPersonnelDataGridView.Columns[7].Visible = false;
            PnpPersonnelDataGridView.Columns[8].Visible = false;
            PnpPersonnelDataGridView.Columns[9].Visible = false;
            PnpPersonnelDataGridView.Columns[10].Visible = false;
            PnpPersonnelDataGridView.Columns[11].Visible = false;
            PnpPersonnelDataGridView.Columns[12].Visible = false;
            PnpPersonnelDataGridView.Columns[13].Visible = false;
            PnpPersonnelDataGridView.Columns[14].Visible = false;
        }
    public static Personnel Read(SqlDataReader reader)
    {
        Personnel retval = new Personnel();

        for (int i = 0; i < reader.FieldCount; i++)
        {
            switch (reader.GetName(i))
            {
                case "TourID":
                    retval.TourID = Helper.ToInt32(reader[i]);
                    break;
                case "ReturnValue":
                    retval.ReturnValue = Helper.ToInt32(reader[i]);
                    break;
                case "ReturnString":
                    retval.ReturnString = Helper.ToString(reader[i]);
                    break;

            }
        }

        return retval;
    }
        // setup to edit input person
        public PersonnelDialog(Personnel person)
        {
            InitializeComponent();
            this.person = person;

            this.Text = "Edit Personnel";
            labelTitle.Text = "Edit Personnel";
            labelSubtitle.Text = "Edit details as needed";
            buttonCreate.Text = "Update";
            labelPassword.Text = "Change Password:";

            textBoxFirst.Text = person.FirstName;
            textBoxLast.Text = person.LastName;
            if (person.UserName == null)
            {
                comboBoxType.SelectedIndex = 0;
            }
            else
            {
                comboBoxType.SelectedIndex = person.IsAdmin ? 2 : 1;
                textBoxUsername.Text = person.UserName;
            }
            buttonCreate.Enabled = false;
        }
        // Delete Personnel Files
        private void deletePersonnelFiles(Personnel personnel)
        {
            string imagePath = System.IO.Path.Combine(HttpContext.Server.MapPath(personnel.PhotoPath));
            string adliSicilKaydiPath = System.IO.Path.Combine(HttpContext.Server.MapPath(personnel.AdliSicilKaydi));
            string saglikRaporuPath = System.IO.Path.Combine(HttpContext.Server.MapPath(personnel.SaglikRaporu));
            string diplomaPath = System.IO.Path.Combine(HttpContext.Server.MapPath(personnel.Diploma));

            if (System.IO.File.Exists(imagePath)) { System.IO.File.Delete(imagePath); }
            if (System.IO.File.Exists(adliSicilKaydiPath)) { System.IO.File.Delete(adliSicilKaydiPath); }
            if (System.IO.File.Exists(saglikRaporuPath)) { System.IO.File.Delete(saglikRaporuPath); }
            if (System.IO.File.Exists(diplomaPath)) { System.IO.File.Delete(diplomaPath); }
        }
        public ActionResult Uploads(Personnel personnel, List<HttpPostedFileBase> files)
        {
            try
            {
                Personnel getPerson = getPersonnel(personnel.ID);
                for (int i = 0; i < files.Count(); i++)
                {
                    if (files[i] != null)
                    {
                        SaveUploads(getPerson, files[i], i);
                    }
                }
                return RedirectToAction("Index");
            }
            catch (Exception)
            {

                throw;
            }
        }
 public ActionResult Edit(Personnel personnel, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         if ((file != null && isImageValid(file)))
         {
             personnel.PhotoPath = getPersonnel(personnel.ID).PhotoPath;
             deletePersonnelFiles(personnel.PhotoPath);
             saveImage( file, personnel.PhotoPath);
             return editPersonel(personnel);
         }
         else if (file == null)
         {
             personnel.PhotoPath = getPersonnel(personnel.ID).PhotoPath;
             return editPersonel(personnel);
         }
         else if (file != null && !isImageValid(file))
         {
             ModelState.AddModelError(String.Empty, String.Empty);
         }
     }
     else
     {
         personnel.PhotoPath = getPersonnel(personnel.ID).PhotoPath;
     }
     return View(personnel);
 }
Example #43
0
    // Use this for initialization
    void Start()
    {
        TimeTxt.paused = true;
        Debug.Log("timer . paused = " + TimeTxt.paused);
        //initialize rooms and employees 0-3
        for (int i = 0; i < 4; i++)
        {
            rm[i] = new Rooms(i+1);
            employee[i] = new Personnel();

            switch (i)
            {
                case 0:
                    rm[i].setBought(true);
                    rm[i].setCost(0);
                    employee[i].setHired(true);
                    employee[i].setEnergy(29);
                    employee[i].setChr(15);
                    employee[i].setComp(15);
                    employee[i].setCost(0);
                    employee[i].setDesc("HEY I LIVE IN MY PARENTS BASEMENT\n ARENT I SO F*****G COOL");
                    employee[i].setEXP(9);
                    employee[i].setName(playerName);
                    employee[i].setSkill(15);
                    break;
                case 1:
                    rm[i].setCost(200);
                    rm[i].setMaxEmp(2);
                    employee[i].setEnergy(29);
                    employee[i].setChr(15);
                    employee[i].setComp(15);
                    employee[i].setCost(250);
                    employee[i].setDesc("HEY I LIVE IN MY PARENTS BASEMENT\n ARENT I SO F*****G COOL");
                    employee[i].setEXP(9);
                    employee[i].setName("Goat Nigger");
                    employee[i].setSkill(15);
                    break;
                case 2:
                    rm[i].setCost(500);
                    rm[i].setMaxEmp(4);
                    employee[i].setEnergy(29);
                    employee[i].setChr(15);
                    employee[i].setComp(15);
                    employee[i].setCost(450);
                    employee[i].setDesc("HEY I LIVE IN MY PARENTS BASEMENT\n ARENT I SO F*****G COOL");
                    employee[i].setEXP(9);
                    employee[i].setName("Billy");
                    employee[i].setSkill(15);
                    break;
                case 3:
                    rm[i].setCost(800);
                    rm[i].setMaxEmp(6);
                    employee[i].setEnergy(29);
                    employee[i].setChr(15);
                    employee[i].setComp(15);
                    employee[i].setCost(1000);
                    employee[i].setDesc("HEY I LIVE IN MY PARENTS BASEMENT\n ARENT I SO F*****G COOL");
                    employee[i].setEXP(9);
                    employee[i].setName("Sally");
                    employee[i].setSkill(15);
                    break;
            }

            Debug.Log("employee element "+i+" in master gameObject       " + employee[i].ToString());
        }
        HQ = rm [0];
        //end of shit i added
        empHired = countEmployees(employee);

        money = 1000;
        progress = 0;
        totalEnergy = calcTotalEnergy(employee);
    }
    protected void btnBook_Click(object sender, EventArgs e)
    {
        //insert in TSW
        //For the hotel location check the times(time 1, time 2, time 3 it's being used military time) and also if the hotel location has enough presenters
        //Validate that the prospect doesn't exist by(email, name and telephone number)
        //DOB, Marital status,
        //emailid
        //phone numberid
        //Names(Guest1, Guest2)

        //MemberCompany item = new MemberCompany();

        //New Code 10/27/10 Check that the fields are not blanc
        if (ddlTourTime.SelectedValue == string.Empty || ddlTourTime.SelectedValue == string.Empty || ddlTourTime.SelectedValue == string.Empty)
        {

            lblValidation.Text = "Values cannot be blank.";
            return;
        }

        lblValidation.Text = "";
        TSWProspect itemProspect = new TSWProspect();
        TSWProspect itemProspectSrc = new TSWProspect();
        TSWProspect itemProspectType = new TSWProspect();
        TSWProspect itemProspectStatus = new TSWProspect();
        TSWTour itemTour = new TSWTour();
        TSWTour itemTourID = new TSWTour();
        Personnel itemPersonnel = new Personnel();
        Premiums itemPremiums = new Premiums();
        PreTourBooking itemPreTourBooking = new PreTourBooking();

        itemProspect.FromLive = m_FromLive;
        itemProspectSrc.FromLive = m_FromLive;
        itemProspectType.FromLive = m_FromLive;
        itemProspectStatus.FromLive = m_FromLive;
        itemTour.FromLive = m_FromLive;
        itemTourID.FromLive = m_FromLive;
        //dcitemProspect.HN =  SIHOTHotelCode; //Hotel Number from SIHOT
        itemProspect.HN = SiteId; //Hotel Number from SIHOT
        itemProspect.Salutation = hdnSalutation.Value;
        itemProspect.Title = hdnSalutation.Value;
        itemProspect.CN = lblFName.Text;
        itemProspect.SN = lblLastName.Text ;
        itemProspect.Address.Street1 = hdnStreet.Value;
        itemProspect.Address.City = hdnCity.Value;
        itemProspect.Address.State = hdnState.Value;
        itemProspect.Address.Country = hdnCountry.Value;
        itemProspect.Address.Zip = hdnZipCode.Value;
        itemProspect.Phone = hdnPhone1.Value;
        itemProspect.Phone2 = hdnPhone2.Value;
        itemProspect.Fax = hdnFax.Value;
        itemProspect.EMAIL = hdnEmail.Value;

        //throw new Exception(ddlMarital1.SelectedValue);
        itemProspect.MaritalID = Helper.ToInt32(ddlMarital1.SelectedValue);
        //throw new Exception(ddlMarital1.SelectedItem.Text);
        itemProspect.MaritalStatus = ddlMarital1.SelectedItem.Text;
        itemProspect.OccupationID=Helper.ToInt32(ddlOccupation.SelectedValue);
        itemProspect.Occupation=ddlOccupation.SelectedItem.Text;
        itemProspect.IncomeID = Helper.ToInt32(ddlIncome.SelectedValue);
        itemProspect.DOB=txtDOB.Text;

        //Get the SourceID thru stored procedure
        //ws_usp_GetProspectSourcePMSInterface

        itemProspectSrc= TSWProspectDB.GetProspectSource(itemProspect);
        itemProspect.ProspectSourceID = itemProspectSrc.ProspectSourceID;
        itemProspect.ProspectSourceDesc = itemProspectSrc.ProspectSourceDesc;
        //throw new Exception(itemProspect.SN + itemProspect.ProspectSourceID.ToString());

        //Get the ProspectTypeId thru stored procedure
        //ws_usp_GetProspectType
        //itemProspect= TSWProspectDB.GetProspectType(itemProspect.FromLive);
        //itemProspect.ProspectTypeDesc = "";
        itemProspectType= TSWProspectDB.GetProspectType(itemProspect);
        itemProspect.ProspectTypeID = itemProspectType.ProspectTypeID;
        itemProspect.ProspectTypeDesc = itemProspectType.ProspectTypeDesc;
        //Get the prospectStausID thru stored procedure
        //ws_usp_GetProspectStatus
           itemProspectStatus= TSWProspectDB.GetProspectStatus(itemProspect);
           itemProspect.ProspectStatusID = itemProspectStatus.ProspectStatusID;
           itemProspect.ProspectStatusDesc = itemProspectStatus.ProspectStatusDesc;
        //itemProspect.ProspectStatusID = 1;
        //itemProspect.ProspectStatusDesc = "";

        //Step 1. Validate that the prospect doesn't exist
        //SearchEmail and SerachPhone APIsol

        //The fields to validate are Phonenumber, email address, lastname and first name
        //Fill the options the existing ones and give them the chance to select and option in order to make an update later.

        //Code for MiniVacs
           if (lblprospectID.Text != string.Empty && lblTourID.Text!=string.Empty)
           {
        //Process MiniVacs requirements on the side
        //Use ProspectID and TourID already in place for the MiniVacs
        return;
           }

            if (ProspectId == 0 && itemProspect.SN.Trim() != string.Empty && itemProspect.CN.Trim() != string.Empty && (itemProspect.Phone.Trim() != string.Empty || itemProspect.EMAIL.Trim() != string.Empty)) //does't exist the prospect id. I can assign the value of the porspectId from the check dups prospects
            {

                //throw new Exception(ProspectId.ToString() + itemProspect.SN + itemProspect.CN + (itemProspect.Phone.Trim() != string.Empty).ToString() + (itemProspect.EMAIL.Trim() != string.Empty).ToString());

                int count = 0;
                TSWProspectList itemProspectList = TSWProspectDB.SearchUniqueProspect(itemProspect, out count); //check the four fields  this needs to change NOW

                if (count > 0 && count != null)
                {
                    //this needs to change NOW
                    rptDuplicates.DataSource = TSWProspectDB.GetDupsProspects(itemProspect);
                    rptDuplicates.DataBind();

                    //show the prospectId on top. The assignment of the prospectId happens in the the ItemDatabound of the repeater
                    lblprospectID.Text = Helper.ToString(ProspectId);
                    lblProspectDup.Text = "This prospect already exist in TSW and may have attended to the presentation in the past.";
                    PnlDups.Visible = true;
                    //return;
                    lblConfRNumber.Text = " <font color=red><b>" + ProspectId
        + " Pre-Existing ProspectId</b></font>";

                }
                else //if doesn't exist in the dups then Insert
                {
                    ProspectId = TSWProspectDB.InsertTSW_Prospect(itemProspect);
                    lblConfRNumber.Text = " <font color=red><b>" + ProspectId
                + "</b></font>";
                    if (ProspectId == 0)
                    {
                        lblConfRNumber.Text = "Error Creating Prospect";
                        return;
                    }
                }
            }

            else if (lblprospectID.Text == string.Empty)
                {

                    //*****************************************
                    //*****************************************
                    //*****************************************
                    //I still need to check the Search FName & LastName. Insert happens, this means that the prospect doesn't exit
                    //if (SearchEmail() != "true" && SearchPhone() != "true")
                    //{

                    //throw new Exception(itemProspect.ProspectTypeID + " " +  itemProspect.ProspectTypeDesc + " " + itemProspect.ProspectStatusID + " " + itemProspect.ProspectSourceID);

                    ProspectId = TSWProspectDB.InsertTSW_Prospect(itemProspect);
                //call the TUNA here TRANSUNION
                //call the TUNA here TRANSUNION
                    //if (m_FromLive == 1)
                    //{
                    //    ParseStringFWD_TOne_prod();
                        //SaveResults_TUNA_prod();
                    //}
                    //else
                    //{
                        //ParseStringFWD_TOne_test();
                    //    SaveResults_TUNA_test();
                    //}

                    //call the TUNA here TRANSUNION
                    //call the TUNA here TRANSUNION

                lblConfRNumber.Text = " <font color=red><b>" + ProspectId
                + "</b></font>";
                    if (ProspectId == 0)
                    {
                        lblConfRNumber.Text = "Error Creating Prospect";
                        return;
                    }

        }
        //the one that says about the prospect
        phNewProspect.Visible = true;

        //}
        //else
        //{
        ////Step 2.or make an update WebAPI_UpdateTourProspect
        //    lblConfRNumber.Text = " <font color=red><b>" + Helper.ToString(TSWProspectDB.UpdateTSW_Prospect(itemProspect)) + "</b></font>";
        //}
        //*****************************************
        //*****************************************
        //*****************************************
        //Step 3 Create the Tour webapibooked tour
        itemTour.FromLive = m_FromLive;
        itemTour.SiteID=SiteId;
        itemTour.ProspectId = ProspectId;
        itemTour.CampaignID = Helper.ToInt32(ddlCampaign.SelectedValue);

        //Get the tourTypeId New Member addition
        //TourTypeID:7866 TourType: 'Members'
        //case statement
        //throw new Exception(hdnDisplaySegment.Value);
        if (hdnDisplaySegment.Value.ToLower().Contains("members") == true)
        {
            itemTour.TourTypeDesc = "Members";
        }
        else
        {
            itemTour.TourTypeDesc = "In House";
        }

        //itemTour.TourTypeDesc = "In House";
        itemTourID = TSWTourDB.GetTourTypeID(itemTour);

        itemTour.TourTypeID = itemTourID.TourTypeID; //"In House=190" VALUE
        itemTour.TourLocationID = Helper.ToInt32(ddlTourLocation.SelectedValue);
        itemTour.TourDate=Helper.ToDateTime(txtTourDate.Text).Value;
        //itemTour.PreAssignedTo = ddlPromotorName.SelectedValue;
        itemTour.waveID=Helper.ToInt32(ddlTourTime.SelectedValue);
        //Response.Write(itemTour.SiteID + " " + itemTour.ProspectId + " " + itemTour.CampaignID + " " + itemTourID.TourTypeID + " " + itemTour.TourLocationID + " " + itemTour.TourDate + " " + itemTour.waveID);
           //Inserts the Tour in table t_tour. Return string "success or failure" and the tourid
          TSWTourList itemTourReturn = TSWTourDB.InsertTSW_Tour(itemTour);
         foreach (TSWTour item in itemTourReturn)
         {
          lblErrors.Text = "";
          if (item.ReturnValue !=0)
          {
              lblErrorsTour.Visible = true;
              lblErrorsTour.Text += "Error creating Tour: " + item.ReturnValue + ", " + item.ReturnString;
              lblErrors.Text += "Error creating Tour: " + item.ReturnValue + ", " + item.ReturnString;
              PnlError.Visible = true;
          }
          else
          {
              TourId = item.TourID;
              lblErrors.Text += "Tour Created Succesfully:" + TourId;
              PnlError.Visible = true;
          }
          }

        //lblConfRNumber.Text += "TourId AfterCreate: "+ Helper.ToString(TSWTourDB.InsertTSW_Tour(itemTour));

        //*****************************************
        //*****************************************
        //*****************************************
        //This number is generated from the previous line
        itemPersonnel.FromLive = m_FromLive;
        itemPersonnel.TourID = TourId;
        itemPersonnel.PersonnelID = Helper.ToInt32(ddlPromotorName.SelectedValue);
        itemPersonnel.TitleID = varTitleId;//46 Per Angel Torres it's ok to leave it like this

        //itemPersonnel.TitleID = Helper.ToInt32(TitleID);
        //step 4. Assign Personnel
        //Response.Write(itemPersonnel.TourID+ 1+ 1+1);
        Personnel itemRetunPersonnel= PersonnelDB.InsertTSW_Personnel(itemPersonnel);
        if (itemRetunPersonnel.ReturnValue <= 10)
        {
            //lblErrors.Text += "Error Creating Personnel" + itemRetunPersonnel.ReturnValue + itemRetunPersonnel.ReturnString;
            PnlError.Visible = true;
        }
        else
        {
            //lblErrors.Text += "Personnel Created Succesfully: " + itemRetunPersonnel.ReturnValue;
            //varPersonnelIdAssigned= itemRetunPersonnel.ReturnValue;
            PnlError.Visible = true;
        }
        //*****************************************
        //*****************************************
        //*****************************************
        //Step 5. Assign Premium Tours
         //loop for all the grid and premiums. I recommend to create an array and then save the array
        int varQty=0;
        foreach (RepeaterItem item in rptrPremiums.Items)
        {
            //varQty += Helper.ToInt32((TextBox)item.FindControl("txtPremQty"));
            varQty = Helper.ToInt32((string)((TextBox)item.FindControl("txtPremQty")).Text);
            //throw new Exception(varQty.ToString());
            if (varQty>0)
            {
                itemPremiums.FromLive = m_FromLive;
                itemPremiums.SiteID = SiteId;
                itemPremiums.SIHOTPerson.HN = Helper.ToInt32(hdnHNDirectFromSIHOT.Value);
                itemPremiums.SIHOTPerson.PCIID = parPCIID;
                itemPremiums.SIHOTPerson.RNO = paridRNO;
                itemPremiums.Personnel.PersonnelID = Helper.ToInt32(ddlPromotorName.SelectedValue); ;
                itemPremiums.PremInvID =Helper.ToInt32((string)((Literal)item.FindControl("litPremID")).Text);
                itemPremiums.CampaignID = Helper.ToInt32(ddlCampaign.SelectedValue);
                itemPremiums.TourID = TourId;

                itemPremiums.Quantity = Helper.ToInt32((string) ((TextBox) item.FindControl("txtPremQty")).Text);
                //Save the amount of the voucher
                //if (itemPremiums.Catalogs.PremInvTypeID==6)
                //{
                //if (Helper.ToDecimal((string)((TextBox)item.FindControl("txtPremAmt")).Text)!=0)
                    itemPremiums.Amount = Helper.ToDecimal((string)((TextBox)item.FindControl("txtPremAmt")).Text);
                //}

                itemPremiums.PremDate = Helper.ToDateTime(txtTourDate.Text);
                //itemPremiums.Note = valuefromdatagridnotes;
                itemPremiums.AuditUser = varSystemUser;
                itemPremiums.auditDate = Helper.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy"));
                itemPremiums.TourLocationID =Helper.ToInt32(ddlTourLocation.SelectedValue);

                Premiums itemRetunPremiums = PremiumsDB.InsertTSW_Premiums(itemPremiums);
                if (itemRetunPremiums.ReturnString != "Success")
                {
                    //lblErrors.Text += "Error Creating the Premium:" +
                    //    itemRetunPremiums.ReturnString + itemRetunPremiums.ReturnValue;
                    PnlError.Visible = true;
                }
                //else
                //{
                    //lblErrors.Text += "Premium Created Succesfully: " + itemRetunPremiums.ReturnValue;
                    //PnlError.Visible = true;
                    //Insert all the PremId generated from TSW in PMS Interface
                    //Verify that the inherid values are being taken witht the current values from the screen
                    //To be tested3/4/2010
                    //PremiumsDB.InsertPMS_Premiums(itemPremiums);
                //}
            }
        }

        //Step6. Save the Status, the prospectId, and tourid and disable the Premiums Grid
        if ((string)Session["AccessLevel"] != "Manager")
          {
          DisableRepeater();
          }

        itemPreTourBooking.ReservationNumber = Helper.ToInt32(lblReservation.Text);
        itemPreTourBooking.Status = "Booked";
        lblStatus.Text = "Booked";
        hdnStatus.Value = "Booked";

        itemPreTourBooking.FromLive = m_FromLive;
        if (TourId != 0)
            itemPreTourBooking.TourID = TourId;
        else
            itemPreTourBooking.TourID = 1111;

        itemPreTourBooking.ProspectID = ProspectId;
        itemPreTourBooking.PCIID = parPCIID;
        itemPreTourBooking.HN = Helper.ToInt32(hdnHNDirectFromSIHOT.Value);
        itemPreTourBooking.SubReservationNumber = Helper.ToInt32(hdnRSNO.Value);
        PreTourBookingDB.Update_PreBooked(itemPreTourBooking);

        btnBook.Visible = false;

        btnPremiums.Visible = false;

        phNewProspect.Visible = false;
        lblprospectID.Text=Helper.ToString(ProspectId);
        lblTourID.Text=Helper.ToString(TourId);
        DisableAll();
        lblErrors.Text = "<font color='blue'>To make changes use TSW.</font>";
        PnlError.Visible = true;

        //Save Notes in TSW Interface for the Booked Status
        if (TxtNotesBooked.Text != "")
        {
            SaveNotesTSW(ddlCommentType, TxtNotesBooked, false);
        }
        SaveAutomaticNotesPMS("Prospect has been Booked");

        ShowComments();

        //Shows THE PREMIUMS HISTORY
        LoadPremiums_TSW();
    }
        // Save Personnel's Files
        private void SaveUploads(Personnel personnel, HttpPostedFileBase file, int index)
        {
            string uploadFile;
            switch (index)
            {
                case 0:
                    uploadFile = "AdliSicilKaydi";
                    break;
                case 1:
                    uploadFile = "SaglikRaporu";
                    break;
                case 2:
                    uploadFile = "Diploma";
                    break;
                default:
                    uploadFile = "";
                    break;
            }

            string extension = System.IO.Path.GetExtension(file.FileName);
            string mapPath = "~/Uploads/" + uploadFile;
            string filePathForDb = uploadFile + "_" + personnel.ID + extension;

            //var fileName = System.IO.Path.GetFileName(file.FileName);
            var path = System.IO.Path.Combine(Server.MapPath(mapPath), filePathForDb);
            file.SaveAs(path);

            switch (index)
            {
                case 0:
                    personnel.AdliSicilKaydi = mapPath + "/" + filePathForDb;
                    break;
                case 1:
                    personnel.SaglikRaporu = mapPath + "/" + filePathForDb;
                    break;
                case 2:
                    personnel.Diploma = mapPath + "/" + filePathForDb;
                    break;
            }

            db.Update(personnel);
        }
Example #46
0
        /// <summary>
        /// Adds selected personnel to selected checkout. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCheckoutAddPersonnel_Click(object sender, EventArgs e)
        {
            //Create objects to hold selected checkout and selected personnel
            Checkout selectedCheckout = new Checkout();
            Personnel selectedPerson = new Personnel();

            //Assign selected checkout
            if (listBoxCheckoutCheckouts.SelectedIndex != -1)
            {
               foreach(Checkout checkout in objects.checkouts)
               {
                   if(checkout.Id == (int)listBoxCheckoutCheckouts.SelectedItem)
                   {
                       selectedCheckout = checkout;
                   }
               }
            }    
            
            //If there is already an existing personnel in this checkout, inform the user. Otherwise, assign the selected personnel to the checkout. 
            if (comboBoxCheckoutAddPersonnel.SelectedIndex != -1)
            {
                
                if(listBoxCheckoutPersonnel.Items.Count != 0)
                {
                    MessageBox.Show("Only one person can be assigned to a checkout");
                }

                else
                {
                    listBoxCheckoutPersonnel.Items.Add(selectedPerson.FirstName + " " + selectedPerson.LastName);
                    foreach (Personnel person in objects.personnel)
                    {
                        if (person.FirstName + " " + person.LastName == (string)comboBoxCheckoutAddPersonnel.SelectedItem)
                        {
                            selectedPerson = person;
                            selectedCheckout.Person = selectedPerson;
                            selectedCheckout.Save();
                            listBoxCheckoutPersonnel.Items.Clear();
                            listBoxCheckoutPersonnel.Items.Add(selectedPerson.FirstName + " " + selectedPerson.LastName);                            
                        }
                    }

                }
                

                
                
                ////Commenting out until confirming whether or not checkout should have more than one personnel.
                //if (listBoxCheckoutPersonnel.FindString(comboBoxCheckoutAddPersonnel.SelectedItem.ToString(), -1) == -1)
                //{
                //    listBoxCheckoutPersonnel.Items.Add(comboBoxCheckoutAddPersonnel.SelectedItem);
                //}

                //else
                //{
                //    MessageBox.Show("Selected personnel already in checkout", "Selection Error");
                //}

            }

            else
            {
                MessageBox.Show("Must select Personnel to add", "Select Personnel");
            }

        }
Example #47
0
 /// <summary>
 /// Create a New User
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddPerson_Click(object sender, EventArgs e)
 {
     Personnel newPerson = new Personnel();
     objects.personnel.Add(newPerson);
     listBoxPersonnel.Items.Add(newPerson.FirstName + " " + newPerson.LastName);
     listBoxPersonnel.SelectedIndex = listBoxPersonnel.Items.Count - 1;
     toggleDetailsEditing();
     tbFirstName.Focus();
 }
Example #48
0
 //calculates total energy to display on screen
 public int calcTotalEnergy(Personnel[] empList)
 {
     int totalEnergy= 0;
     for (int i = 0; i < empList.Length; i++)
     {
         if (empList[i].getHired())
             totalEnergy += empList[i].getEnergy();
     }
     return totalEnergy;
 }
Example #49
0
        /// <summary>
        /// Removes selected personnel from selected checkout. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCheckoutRemovePersonnel_Click(object sender, EventArgs e)
        {
            Checkout selectedCheckout = new Checkout();
            Personnel selectedPerson = new Personnel();

            if (listBoxCheckoutCheckouts.SelectedIndex != -1)
            {
                foreach (Checkout checkout in objects.checkouts)
                {
                    if (checkout.Id == (int)listBoxCheckoutCheckouts.SelectedItem)
                    {
                        selectedCheckout = checkout;
                    }
                }
            }

            foreach(Personnel person in objects.personnel)
            {
                if (person.FirstName + " " + person.LastName == (string)listBoxCheckoutPersonnel.SelectedItem)
                {
                    selectedPerson = person;                                        
                }
            }

            listBoxCheckoutPersonnel.Items.Clear();
            selectedCheckout.Person = null;            
            selectedCheckout.Save();           
            
        }
        /*******************************************************************************
        * LOAD FUNCTIONS to load objects from database with their basic data properties
        *******************************************************************************/

        private void loadPersonnel(SQLiteConnection conn)
        {
            SQLiteCommand command = new SQLiteCommand("SELECT ID, Username, Password, \"First Name\", \"Last Name\", isAdministrator, PermitLevel FROM personnel", conn);
            SQLiteDataReader reader = command.ExecuteReader();
            Personnel per;
            while (reader.Read())
            {
                per = new Personnel(reader.GetInt16(0), reader.IsDBNull(1) ? null : reader.GetString(1), reader.IsDBNull(2) ? null : reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetBoolean(5), reader.GetInt16(6));
                personnel.Add(per);
            }
        }
Example #51
0
 // counts number of employees employed
 public int countEmployees(Personnel[] empList)
 {
     int numEmp = 0;
     int length = empList.Length;
     for (int i = 0; i < length; i++)
     {
         if (empList[i].getHired())
         {
             numEmp++;
         }
     }
     return numEmp;
 }
Example #52
0
    // Use this for initialization
    void Start()
    {
        //initialize rooms and employees 0-3
        for (int i = 0; i < 4; i++)
        {
            rm[i] = new Rooms(i+1);
            employee[i] = new Personnel();

            switch (i)
            {
                case 0:
                    rm[i].setBought(true);
                    rm[i].setCost(0);
                    employee[i].setHired(true);
                    employee[i].setEnergy(15);
                    break;
                case 1:
                    rm[i].setCost(200);
                    rm[i].setMaxEmp(2);
                    break;
                case 2:
                    rm[i].setCost(500);
                    rm[i].setMaxEmp(4);
                    break;
                case 3:
                    rm[i].setCost(800);
                    rm[i].setMaxEmp(6);
                    break;
            }

        }
        HQ = rm [0];
        //end of shit i added

        money = 1000;
        progress = 0;
        totalEnergy = calcTotalEnergy(employee);
    }
 private ActionResult editPersonel(Personnel personnel)
 {
     try
     {
         isActivePersonel(personnel);
         db.Update(personnel);
         return RedirectToAction("Index");
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.Reset();
            openFileDialog.AddExtension = true;
            openFileDialog.DefaultExt = ".sqlite";
            openFileDialog.Filter = "SQLite files (*.sqlite) | *.sqlite";
            openFileDialog.Title = "Select backup";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                string path = openFileDialog.FileName;
                if (!DbSetupManager.EvaluateExternalDB(path))
                {
                    // problem with selected database
                    MessageBox.Show(
                        "Cannot restore from the file you selected.\n" +
                        "Only restore from backups created by KeyManager\n" +
                        "usually name 'KEYMANAGER_BACKUP_###.sqlite'\n" +
                        "with some number in place of the '###'.",
                        "Restore Cancelled"
                    );
                }
                else
                {
                    // looks good
                    result = MessageBox.Show(
                        "Are you sure you want to restore from backup?\n" +
                        "All current data will be overwritten.",
                        "Confirm Restore from Backup",
                        MessageBoxButtons.OKCancel
                    );
                    if (result == DialogResult.OK)
                    {
                        string dbpath = DbSetupManager.GetDBPath();
                        File.Delete(dbpath);
                        File.Copy(path, dbpath);

                        // reset it all!
                        objects = new ObjectHolder();
                        currentUser = objects.GetPersonnelById(1);
                        isAdmin = true;
                        SetupTreeView();

                        MessageBox.Show("Restore complete.");
                    }
                }
            }
        }
 private void isActivePersonel(Personnel personnel)
 {
     if (personnel.ExitDate.HasValue)
     {
         personnel.isActive = false;
     }
     else
     {
         personnel.isActive = true;
     }
 }
Example #56
0
 private void button5_Click(object sender, EventArgs e)
 {
     Personnel personnelForm = new Personnel();
     personnelForm.Show();
 }
Example #57
0
    void trainStaff(trainTypes trainType, ref Personnel emp)
    {
        int[] rand = new int[2];
        switch (trainType)
        {
            case trainTypes.selfStudy:
                rand[0] = Random.RandomRange(0, 3);
                chosenSkills[rand[0]] += 1;
                emp.setComp(emp.getComp() + chosenSkills[0]);
                emp.setSkill(emp.getSkill() + chosenSkills[1]);
                emp.setChr(emp.getChr() + chosenSkills[2]);
                emp.setEnergy(emp.getChr() + chosenSkills[3]);
                break;

            case trainTypes.tutor:
                emp.setComp(emp.getComp() + chosenSkills[0]);
                emp.setSkill(emp.getSkill() + chosenSkills[1]);
                emp.setChr(emp.getChr() + chosenSkills[2]);
                emp.setEnergy(emp.getChr() + chosenSkills[3]);
                break;

            case trainTypes.specTutor:
                rand[0] = Random.RandomRange(0, 3);
                chosenSkills[rand[0]] += 1;
                emp.setComp(emp.getComp() + chosenSkills[0]);
                emp.setSkill(emp.getSkill() + chosenSkills[1]);
                emp.setChr(emp.getChr() + chosenSkills[2]);
                emp.setEnergy(emp.getChr() + chosenSkills[3]);
                break;

            case trainTypes.uniCourse:
                rand[0] = Random.RandomRange(0, 3);
                rand[1] = Random.RandomRange(0, 3);
                chosenSkills[rand[0]] += 1;
                chosenSkills[rand[1]] += 1;
                emp.setComp(emp.getComp() + chosenSkills[0]);
                emp.setSkill(emp.getSkill() + chosenSkills[1]);
                emp.setChr(emp.getChr() + chosenSkills[2]);
                emp.setEnergy(emp.getChr() + chosenSkills[3]);
                break;
            case trainTypes.geniusDisciple:

                emp.setComp(emp.getComp() + chosenSkills[0]);
                emp.setSkill(emp.getSkill() + chosenSkills[1]);
                emp.setChr(emp.getChr() + chosenSkills[2]);
                emp.setEnergy(emp.getChr() + chosenSkills[3]);
                break;
        }
    }
        private void importFromCSVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.Reset();
            openFileDialog.AddExtension = true;
            openFileDialog.DefaultExt = "csv";
            openFileDialog.Filter = "CSV | *.csv";
            openFileDialog.Title = "Import from CSV";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                result = MessageBox.Show("Are you sure you wish to import? All current data will be overwritten", "Confirm Import", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    string status = (new CSV()).InsertCSV(openFileDialog.FileName);
                    if (status == "refuse")
                    {
                        MessageBox.Show("Import Cancelled. Can only import from a CSV created using KeyManager.", "Import Cancelled");
                    }
                    else if (status == "error")
                    {
                        MessageBox.Show("Encountered an Error while importing");
                    }
                    else
                    {
                        MessageBox.Show("Import Complete");

                        // reset it all!
                        objects = new ObjectHolder();
                        currentUser = objects.GetPersonnelById(1);
                        isAdmin = true;
                        SetupTreeView();
                    }
                }
            }
            
        }