Beispiel #1
0
    void InitializeSupplierAI()
    {
        GameObject newCompany = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/Company/Object/Player"));

        newCompany.transform.SetParent(CompanyManagerObject.transform);
        newCompany.GetComponent <CompanyValue>().isAI        = true;
        newCompany.GetComponent <CompanyValue>().Unevaluable = true;
        newCompany.GetComponent <CompanyValue>().TotalValue  = 0f;

        GameObject SupplierAI = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/AI/Object/RawMaterialSupplyAI"));

        SupplierAI.transform.SetParent(newCompany.transform);
        SupplierAI.name = "RawMaterialSupplyAI";
        SupplierAI.GetComponent <RawMaterialSupplyAI>().Name = "General Industry Co.";


        CompanyManager CompanyManagerCall = CompanyManagerObject.GetComponent <CompanyManager>();

        CompanyManagerCall.AddCompany("General Industry Co.", newCompany);
        newCompany.name = "General Industry Co.";
        //

        newCompany = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/Company/Object/Player"));
        newCompany.transform.SetParent(CompanyManagerObject.transform);
        newCompany.GetComponent <CompanyValue>().isAI        = true;
        newCompany.GetComponent <CompanyValue>().Unevaluable = true;
        newCompany.GetComponent <CompanyValue>().TotalValue  = 0f;

        SupplierAI = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/AI/Object/RawMaterialSupplyAI"));
        SupplierAI.transform.SetParent(newCompany.transform);
        SupplierAI.name = "RawMaterialSupplyAI";
        SupplierAI.GetComponent <RawMaterialSupplyAI>().Name = "Federal Agency of Industry";

        CompanyManagerCall = CompanyManagerObject.GetComponent <CompanyManager>();
        CompanyManagerCall.AddCompany("Federal Agency of Industry", newCompany);
        newCompany.name = "Federal Agency of Industry";
        //

        newCompany = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/Company/Object/Player"));
        newCompany.transform.SetParent(CompanyManagerObject.transform);
        newCompany.GetComponent <CompanyValue>().isAI        = true;
        newCompany.GetComponent <CompanyValue>().Unevaluable = true;
        newCompany.GetComponent <CompanyValue>().TotalValue  = 0f;

        //  SupplierAI = GameObject.Instantiate(Resources.Load<GameObject>("GameSystem/AI/Object/RawMaterialSupplyAI"));
        //  SupplierAI.transform.SetParent(newCompany.transform);
        //  SupplierAI.name = "RawMaterialSupplyAI";
        //  SupplierAI.GetComponent<RawMaterialSupplyAI>().Name = "Sasio";

        //  CompanyManagerCall = CompanyManagerObject.GetComponent<CompanyManager>();
        //  CompanyManagerCall.AddCompany("Sasio", newCompany);
        //  newCompany.name = "Sasio";
    }
Beispiel #2
0
        protected void addCategoryButton_Click(object sender, EventArgs e)
        {
            if (addCompanyNameTextBox.Text != "")
            {
                if (System.Text.RegularExpressions.Regex.IsMatch(addCompanyNameTextBox.Text, "\\D"))
                {
                    CompanyModel aCompany = new CompanyModel();
                    DateTime     date     = DateTime.Now;
                    aCompany.CompanyName = addCompanyNameTextBox.Text;
                    aCompany.DateTime    = date.ToString("dd-MM-yy");

                    string message = addCompany.AddCompany(aCompany);
                    outputLabel.Text           = message;
                    outputLabel.ForeColor      = Color.Red;
                    addCompanyNameTextBox.Text = "";

                    allCompanyGridView.DataSource = addCompany.GetAllCompany();
                    allCompanyGridView.DataBind();
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Oops!", "VaidationMsg()", true);
                }
            }
            else
            {
                outputLabel.Text      = "Please Input a Company Name";
                outputLabel.ForeColor = Color.Red;
            }
        }
        public int AddCompany(CompanysEntity model)
        {
            this.ClearBrokenRuleMessages();
            int id = mgr.AddCompany(model);

            this.AddBrokenRuleMessages(mgr.BrokenRuleMessages);
            return(id);
        }
Beispiel #4
0
        public void AddImageInformation(Company ctemp, Product ptemp, Images itemp)
        {
            CompanyManager cManager = new CompanyManager();
            ProductManager pManager = new ProductManager();
            ImageManager   iManager = new ImageManager();

            cManager.AddCompany(ctemp);
            pManager.AddProduct(ptemp);
            iManager.AddImage(itemp);
        }
Beispiel #5
0
        public void AddCompany(string Name, int OrganizationNr, string Notes)
        {
            if (ValidInputs(Name, OrganizationNr))
            {
                company newCompany = new company();

                newCompany.Name = Name;
                newCompany.OrganizationNumber = OrganizationNr;
                newCompany.Notes = Notes;
                newCompany.Id    = Guid.NewGuid();


                CompanyManager.AddCompany(newCompany);
            }
            Response.Redirect(Request.UrlReferrer.ToString());
        }
Beispiel #6
0
    void InitializePlayerCompany()
    {
        GameObject newCompany = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/Company/Object/Player"));

        newCompany.transform.SetParent(CompanyManagerObject.transform);

        CompanyManager CompanyManagerCall = CompanyManagerObject.GetComponent <CompanyManager>();
        WorkerSelector WorkerSelectorCall = GameObject.Find("WorkerManager").GetComponent <WorkerSelector>();

        CompanyManagerCall.AddCompany(CompanyName, newCompany);
        CompanyManagerCall.PlayerCompanyName = CompanyName;
        newCompany.name = CompanyName;

        EconomyValue EconomyValueCall = CompanyManagerCall.GetPlayerCompanyValue().GetEconomyValue().GetComponent <EconomyValue>();

        EconomyValueCall.Balance = 40000;
        WorkerSelector.Worker CEO = WorkerSelectorCall.AddCustomWorker(null, 3, 0, 0, 0, 0, 0);
        CompanyManagerCall.GetPlayerCompanyValue().GetEmployeeValue().GetComponent <EmployeeValue>().HireEmployee(CEO);
        WorkerSelectorCall.UnHiredList.Remove(CEO);
    }
Beispiel #7
0
        public void AddAll(Images img, List <Product> pList, List <Company> cList, List <Connect1> c1List, List <Connect2> c2List, List <Connect3> c3List)
        {
            ImageManager    iManager  = new ImageManager();
            CompanyManager  cManager  = new CompanyManager();
            ProductManager  pManager  = new ProductManager();
            Connect1Manager c1Manager = new Connect1Manager();
            Connect2Manager c2Manager = new Connect2Manager();
            Connect3Manager c3Manager = new Connect3Manager();

            iManager.AddImage(img);
            for (int i = 0; i < pList.Count; i++)
            {
                pManager.AddProduct(pList[i]);
            }
            for (int i = 0; i < pList.Count; i++)
            {
                cManager.AddCompany(cList[i]);
            }
            c1Manager.AddConnect1(c1List);
            c2Manager.AddConnect2(c2List);
            c3Manager.AddConnect3(c3List);
        }
    protected void AddNewProspect(object sender, EventArgs e)
    {
        try
        {
            if (dd_NewRep.Text.Trim() == String.Empty || CompanyManager.CompanyName == null)
            {
                Util.PageMessage(this, "You must enter a company name and a rep!");
            }
            else if (CompanyManager.CompanyName != null && CompanyManager.CompanyName.Length > 150)
            {
                Util.PageMessage(this, "The company name must be no more than 150 characters!");
            }
            else
            {
                String prosDueDate   = null;
                String prosLHDueDate = null;
                String P1P2          = String.Empty;
                int    waiting       = 1;
                if (datepicker_NewProspectDue.SelectedDate != null) // List Due
                {
                    prosDueDate = Convert.ToDateTime(datepicker_NewProspectDue.SelectedDate).ToString("yyyy/MM/dd");
                    waiting     = 0;
                }
                if (datepicker_NewProspectLHDue.SelectedDate != null) // List Due
                {
                    prosLHDueDate = Convert.ToDateTime(datepicker_NewProspectLHDue.SelectedDate).ToString("yyyy/MM/dd");
                }

                if (dd_NewP1P2.SelectedItem.Text != String.Empty)
                {
                    P1P2 = dd_NewP1P2.SelectedItem.Text;
                }

                tb_NewNotes.Text = Util.DateStamp(tb_NewNotes.Text);
                // add username if not already exist
                if (tb_NewNotes.Text.Trim() != String.Empty && !tb_NewNotes.Text.EndsWith(")"))
                {
                    tb_NewNotes.Text += " (" + HttpContext.Current.User.Identity.Name + ")";
                }

                int  grade  = -1;
                bool insert = true;
                if (!Int32.TryParse(dd_NewGrade.SelectedItem.Text, out grade))
                {
                    insert = false;
                    Util.PageMessage(this, "Please select a grade from 1-10!");
                }

                if (insert)
                {
                    String iqry = "INSERT INTO db_prospectreport " +
                                  "(`pros_id`,`team_id`,`date`,`company`,`industry`,`sub_industry`,`p1p2`,`turnover`,`employees`,`rep`,`list_due`,`letter`," +
                                  "`grade`,`buyin`,`notes`,`working`,`listin`,`blown`,`hot`,`dateblown`,`datein`,`lhduedate`,`lha`,`benchmark_data`) " +
                                  "VALUES(NULL," +                                  // pros_id
                                  "@team_id, " +
                                  "CURRENT_TIMESTAMP, " +                           // date
                                  "@company, @industry, @sub_industry, @p1p2, @turnover, @employees, @rep, @list_due, @letter, @grade, " +
                                  "@buyin, @notes, @working, 0,0,@hot,null,null," + // listin, blown, hot, dateblown, datein
                                  "@lhduedate,@lha,@benchmark_data)";
                    String[] pn = new String[] { "@team_id",
                                                 "@company",
                                                 "@industry",
                                                 "@sub_industry",
                                                 "@p1p2",
                                                 "@turnover",
                                                 "@employees",
                                                 "@rep",
                                                 "@list_due",
                                                 "@letter",
                                                 "@grade",
                                                 "@buyin",
                                                 "@notes",
                                                 "@working",
                                                 "@hot",
                                                 "@lhduedate",
                                                 "@lha",
                                                 "@benchmark_data" };
                    Object[] pv = new Object[] { hf_team_id.Value,
                                                 CompanyManager.CompanyName,
                                                 CompanyManager.Industry,
                                                 CompanyManager.SubIndustry,
                                                 P1P2,
                                                 CompanyManager.Turnover + " " + CompanyManager.TurnoverDenomination,
                                                 CompanyManager.CompanySize,
                                                 dd_NewRep.SelectedItem.Text.Trim(),
                                                 prosDueDate,
                                                 dd_NewLetter.Text.Trim(),
                                                 grade,
                                                 null,
                                                 tb_NewNotes.Text.Trim(),
                                                 waiting,
                                                 cb_hot.Checked,
                                                 prosLHDueDate,
                                                 tb_lha.Text.Trim(),
                                                 tb_benchmark_data.Text.Trim() };
                    long pros_id = SQL.Insert(iqry, pn, pv);

                    // Add contacts and company
                    if (pros_id != -1)
                    {
                        long cpy_id = CompanyManager.AddCompany(pros_id, "Prospect", hf_office.Value);

                        // Update company reference (temp)
                        String uqry = "UPDATE db_prospectreport SET cpy_id=@cpy_id WHERE pros_id=@pros_id";
                        SQL.Update(uqry,
                                   new String[] { "@cpy_id", "@pros_id" },
                                   new Object[] { cpy_id, pros_id });

                        cm.UpdateContacts(cpy_id.ToString());
                    }

                    Util.WriteLogWithDetails("New prospect (" + CompanyManager.CompanyName + ") added in " + hf_office.Value + " - " + hf_team_name.Value + ".", "prospectreports_log");

                    Util.CloseRadWindow(this, CompanyManager.CompanyName, false);

                    if (cb_view_writeup.Checked)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('/dashboard/prospectreports/prospectwriteup.aspx?id=" + pros_id + "','_newtab');", true);
                    }
                }
            }
        }
        catch (Exception r)
        {
            if (Util.IsTruncateError(this, r))
            {
            }
            else
            {
                Util.PageMessage(this, "An error occured, please try again.");
                Util.WriteLogWithDetails("Error adding prospect " + r.Message + " " + r.StackTrace, "prospectreports_log");
            }
        }
    }
Beispiel #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Employee Wages Problem");

            //Use Case 1
            isPresent = new Random().Next(0, 2) == 1;

            if (isPresent)
            {
                Console.WriteLine("Employee is Present");
            }
            else
            {
                Console.WriteLine("Employee is Absent");
            }

            //Use Case 2
            wagePerHour = 20;
            fullDayHour = 8;
            Console.WriteLine("Daily Employee Wage is " + CalculateDailyWage(wagePerHour, fullDayHour));

            //Use Case 3
            partTimeHour = 8;
            Console.WriteLine("Part Time Employee Wage is " + CalculateDailyWage(wagePerHour, partTimeHour));

            //Use Case 4
            Console.WriteLine("Select \n1. Part Time \n2. Full Time");
            int choice = int.Parse(Console.ReadLine());

            switch (choice)
            {
            case 1:
                Console.WriteLine("Daily Employee Wage is " + CalculateDailyWage(wagePerHour, fullDayHour));
                break;

            case 2:
                Console.WriteLine("Part Time Employee Wage is " + CalculateDailyWage(wagePerHour, partTimeHour));
                break;

            default:
                Console.WriteLine("Invalid Selection");
                break;
            }

            //Use Case 5
            daysOfMonth = 20;
            Console.WriteLine("The Monthly Wage is " + CalculateMontlyWage(wagePerHour, fullDayHour, daysOfMonth));

            //Use Case 6 + Use Case 7 Refractor
            Console.WriteLine("The Employee Wage is " + ComputeEmployeeWage());


            //Use Case 8
            Console.WriteLine("\nEnter Company Name");
            string compName = Console.ReadLine();

            ComputeCompanyEmployeeWage(compName, 8, 4, 200);

            Console.WriteLine("\nEnter Company Name");
            compName = Console.ReadLine();
            ComputeCompanyEmployeeWage(compName, 7, 3, 200);

            //Use Case 9
            Company comp1 = new Company(100, 8, 4, "ABC");

            comp1.ComputeCompanyEmployeeWage();

            //Use Case 10
            Company comp2 = new Company(200, 10, 3, "BCD");
            Company comp3 = new Company(150, 9, 4, "EFG");

            CompanyManager companyManager = new CompanyManager();

            companyManager.AddCompany(comp1);
            companyManager.AddCompany(comp2);
            companyManager.AddCompany(comp3);

            Console.WriteLine();
            companyManager.ListCompanies();

            //Use Case 14
            Console.Write(comp1.GetDailyWage());

            Console.ReadLine();
        }