예제 #1
0
    public void CalculateCurrentMood(Appraisal CurrentAppraisal)
    {
        if (CurrentAppraisal == null) {
            //DecayMood ();

            return;
        }

        //Calculate Virtual Emotion Center
        Mood VirtualEmotionCenter = CalculateVirtualEmotionCenter (CurrentAppraisal.CurrentEmotions);

        if (Mathf.Abs (VirtualEmotionCenter.Arousal) > Mathf.Abs (this.CurrentMood.Arousal) &&
                Mathf.Abs (VirtualEmotionCenter.Pleasure) > Mathf.Abs (this.CurrentMood.Pleasure) &&
                Mathf.Abs (VirtualEmotionCenter.Dominance) > Mathf.Abs (this.CurrentMood.Dominance)) {
            //Pull Phase
            PullPhase (VirtualEmotionCenter);
            Debug.Log ("PullPhase");
        } else {
            //Push Phase
            PushPhase (VirtualEmotionCenter);
            Debug.Log ("PushPhase");
        }

        Debug.Log ("Mood Changed To: " + CurrentMood.ToString ());

        //TODO - DO SOMETHING EMOTIONAL
        //...
        //...
        //...
    }
예제 #2
0
        public List <QuestionList> GetAllQuestionList()
        {
            List <QuestionList> QuestionLists = new List <QuestionList>();
            Appraisal           objApr        = new Appraisal();

            try
            {
                var QuestionsLists = objApr.GetAllQuestionList().ToList();
                foreach (QuestionsList itm in QuestionsLists.ToList())
                {
                    QuestionList oItem = new QuestionList();
                    oItem.questionId    = itm.questionId;
                    oItem.questionText  = itm.questionText;
                    oItem.dataType      = itm.dataType;
                    oItem.questionParam = itm.questionParam;
                    oItem.questionAbbr  = itm.questionAbbr;
                    oItem.controlType   = itm.controlType;
                    oItem.validation    = itm.validation;
                    oItem.editStageId   = itm.editStageId;
                    QuestionLists.Add(oItem);
                }
                return(QuestionLists);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public List <yearSectionMapping> GetYearSectionList(int?ID)
        {
            List <yearSectionMapping> lstYearSectin = new List <yearSectionMapping>();
            Appraisal objApr = new Appraisal();

            try
            {
                var YearSectionList = objApr.GetYearSectionList(ID).ToList();

                foreach (yearSectionsMapping itm in YearSectionList.ToList())
                {
                    yearSectionMapping oItem = new yearSectionMapping();
                    oItem.MappingId   = itm.MappingId;
                    oItem.YearID      = itm.YearID;
                    oItem.YearName    = itm.YearName;
                    oItem.SectionId   = itm.SectionId;
                    oItem.SectionName = itm.SectionName;
                    oItem.Order       = itm.Order;
                    oItem.isRequired  = itm.isRequired;
                    oItem.Stages      = itm.Stages;

                    lstYearSectin.Add(oItem);
                }

                return(lstYearSectin);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public List <finalMapping> GetYearQuestionList(int?yearId, int?sectionId)
        {
            List <finalMapping> lstYearSectionmapping = new List <finalMapping>();
            Appraisal           objApr = new Appraisal();

            try
            {
                var YearSectionList = objApr.GetYearQuestionList(yearId, sectionId).ToList();

                foreach (finalMappings itm in YearSectionList.ToList())
                {
                    finalMapping oItem = new finalMapping();
                    oItem.MappingId    = itm.MappingId;
                    oItem.QMappingId   = itm.QMappingId;
                    oItem.YearID       = itm.YearID;
                    oItem.YearName     = itm.YearName;
                    oItem.SectionId    = itm.SectionId;
                    oItem.SectionName  = itm.SectionName;
                    oItem.QuestionId   = itm.QuestionId;
                    oItem.QuestionName = itm.QuestionName;
                    oItem.Order        = itm.Order;
                    oItem.isRequired   = itm.isRequired;
                    oItem.Stages       = itm.Stages;

                    lstYearSectionmapping.Add(oItem);
                }

                return(lstYearSectionmapping);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
        public async Task <IActionResult> EditAppraisal(Appraisal appraisal)
        {
            var courseToUpdate = await _context.Appraisals.FindAsync(appraisal.Id);

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


            if (await TryUpdateModelAsync <Appraisal>(
                    courseToUpdate,
                    "",
                    a => a.Rating, a => a.UserStudentFk, a => a.SubjectFk
                    ))
            {
                courseToUpdate.Rating        = appraisal.Rating;
                courseToUpdate.UserStudentFk = appraisal.UserStudentFk;
                courseToUpdate.SubjectFk     = appraisal.SubjectFk;

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(ListAppraisal)));
            }
            return(View());
        }
 public ActionResult CreateAsync1([Bind(Exclude = "Rating")] Appraisal model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var item = DomainEntities.Appraisals.Find(m => m.EmployeeId == model.EmployeeId);
             if (item != null)
             {
                 return(new EmptyResult());
             }
             model.Rating = new System.Random().Next(1, 5);
             DomainEntities.Appraisals.Add(model);
             return(PartialView(model));
         }
         else
         {
             return(new EmptyResult());
         }
     }
     catch
     {
         return(new EmptyResult());
     }
 }
예제 #7
0
    public Appraisal GenerateRandomAppraisal()
    {
        //int choice = Random.Range(0, 5);

        //TODO REMOVE TEST CODE
        int choice = 0;

        Appraisal CurrentAppraisal = new Appraisal();
        Appraisal[] AppraisalOptions = new Appraisal[] {
            new Appraisal(-0.5f, -0.5f, 0.0f, 1.0f, 0), //Anger
            new Appraisal(-0.5f, 0.0f, 0.0f, 0.5f, 0), //Fear
            new Appraisal(-0.5f, -0.5f, 0.0f, 0.5f, 0), //Anger + Fear
            new Appraisal(0.0f, -0.5f, 0.0f, 1.0f, 1), //Shame
            new Appraisal(-0.5f, 0.0f, 0.0f, 0.0f, 0)}; //Relief

        CurrentAppraisal = AppraisalOptions[choice];

        string ListofEmotions = "";

        foreach(Emotion e in AppraisalOptions[choice].CurrentEmotions)
        {
            ListofEmotions += e.ToString() + ", ";
        }

        Debug.Log ("Generated Random Appraisal:\nEmotions: " + ListofEmotions + "D: " + AppraisalOptions[choice].Desirability
            + ", A: " + AppraisalOptions[choice].Appealingness + ", P: " + AppraisalOptions[choice].Praiseworthiness + ", L: " + AppraisalOptions[choice].Likelihood
            + ", CA: " + AppraisalOptions[choice].CausalAgent);

        return CurrentAppraisal;
    }
        public ActionResult Create([Bind(Exclude = "Rating")] Appraisal model)
        {
            try
            {
                //business validation rules

                if (ModelState.IsValid)
                {
                    var item = DomainEntities.Appraisals.Find(m => m.EmployeeId == model.EmployeeId);
                    if (item != null)
                    {
                        return(View(model));
                    }
                    model.Rating = new System.Random().Next(1, 5);
                    DomainEntities.Appraisals.Add(model);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(model));
                }
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult Edit(Appraisal model)
 {
     try
     {
         // TODO: Add update logic here
         if (ModelState.IsValid)
         {
             var item = DomainEntities.Appraisals.Find(m => m.EmployeeId == model.EmployeeId);
             if (item == null)
             {
                 return(View(model));
             }
             item.Appraisee  = model.Appraisee;
             item.Appraiser  = model.Appraiser;
             item.Rating     = model.Rating;
             item.Applicable = model.Applicable;
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(model));
         }
     }
     catch
     {
         return(View());
     }
 }
 public JsonResult CreateAsync([Bind(Exclude = "Rating")] Appraisal model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var item = DomainEntities.Appraisals.Find(m => m.EmployeeId == model.EmployeeId);
             if (item != null)
             {
                 return new JsonResult {
                            Data = false
                 }
             }
             ;
             model.Rating = new System.Random().Next(1, 5);
             DomainEntities.Appraisals.Add(model);
             return(new JsonResult {
                 Data = true
             });
         }
         else
         {
             return(new JsonResult {
                 Data = false
             });
         }
     }
     catch
     {
         return(new JsonResult {
             Data = false
         });
     }
 }
예제 #11
0
        /// <summary>
        ///     Communicates with DAL to Submit Candidates for Appraisal
        /// </summary>
        /// <param name="lstAppraisal"></param>
        /// <returns></returns>
        public bool SaveAppraisalList(List <ProbableList> lstAppraisal, string freezeComment, int loggedUser, string action)
        {
            var objApr = new Appraisal();

            foreach (var oItem in lstAppraisal)
            {
                var objAppr = new AppraiseeList();

                objAppr.App1id        = oItem.App1;
                objAppr.App2id        = oItem.App2;
                objAppr.EmployeeCode  = oItem.EC;
                objAppr.EmployeeCode  = oItem.EC;
                objAppr.EmployeeID    = oItem.EID;
                objAppr.EmployeeName  = oItem.EName;
                objAppr.GroupHeadID   = oItem.GHID;
                objAppr.GroupID       = oItem.GID;
                objAppr.IDFId         = oItem.IDF;
                objAppr.IDFEsc1       = oItem.IDFE1;
                objAppr.IDFEsc2       = oItem.IDFE2;
                objAppr.Rv1ID         = oItem.Rv1;
                objAppr.RV2id         = oItem.RV2;
                objAppr.FreezeComment = freezeComment;

                objApr.SaveAppraisalList(objAppr, loggedUser, action);
            }
            return(false);
        }
예제 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((Session["adminUserName"] == null) && (Session["adminUserRole"] == null))
     {
         Response.Redirect("../error.aspx");
     }
     if (!IsPostBack)
     {
         //先初始化学年下拉框的内容
         ListItem li = new ListItem("请选择", "");
         this.appraisalYear.Items.Add(li);
         Appraisal appraisal = new Appraisal();
         DataSet   ds        = appraisal.GetAppraisalYear();
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             DataRow dr = ds.Tables[0].Rows[i];
             li = new ListItem(dr["appraisalYear"].ToString(), dr["appraisalYear"].ToString());
             this.appraisalYear.Items.Add(li);
         }
         //再初始化学期下拉框的内容
         ListItem li2 = new ListItem("请选择", "");
         this.appraisalTerm.Items.Add(li2);
         DataSet ds2 = appraisal.GetAppraisalTerm();
         for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
         {
             DataRow dr = ds2.Tables[0].Rows[i];
             li2 = new ListItem(dr["appraisalTerm"].ToString(), dr["appraisalTerm"].ToString());
             this.appraisalTerm.Items.Add(li2);
         }
     }
 }
예제 #13
0
        public List <employee> EmployeeList(int?Id)
        {
            List <employee> lstEmployee = new List <employee>();
            Appraisal       objApr      = new Appraisal();

            try
            {
                var YearSectionList = objApr.EmployeeList(Id).ToList();

                foreach (Employee itm in YearSectionList.ToList())
                {
                    employee oItem = new employee();
                    oItem.EmployeeId   = itm.EmployeeId;
                    oItem.EmployeeCode = itm.EmployeeCode;
                    oItem.EmployeeName = itm.EmployeeName;
                    // oItem.RelationAbbr = itm.RelationAbbr;
                    oItem.RelationShip  = itm.RelationShip;
                    oItem.StageComplete = itm.StageComplete;
                    oItem.IsLinkActive  = itm.IsLinkActive;
                    oItem.reviewlink    = itm.reviewlink;
                    lstEmployee.Add(oItem);
                }

                return(lstEmployee);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IActionResult StartAppraisal(Appraisal appraisal)
        {
            var orgId = getOrg();

            if (appraisal == null)
            {
                return(View());
            }

            appraisal.Id             = Guid.NewGuid();
            appraisal.OrganisationId = orgId;
            appraisal.IsActive       = true;


            try
            {
                _context.Add(appraisal);
                _context.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
            }
            return(View());
        }
        public void TestGetPrivateDatasetByActivityId()
        {
            //var db = ServicesContext.Current;
            Appraisal ds = new Appraisal(18699);

            ds.Header.Allotment = "537";
            Assert.AreEqual(18699, ds.Header.ActivityId); //if the header loaded, the activity id will be set
        }
    public void GridViewBind()
    {
        Appraisal appraisal = new Appraisal();
        DataSet   ds        = appraisal.GetAllAppraisal();

        this.GridView1.DataSource = ds;
        this.GridView1.DataBind();
    }
예제 #17
0
        public AppraisalSection Section(int sectionId, int empID, int loggedUser)
        {
            var objApr           = new Appraisal();
            var appraisalSection = new AppraisalSection();

            appraisalSection = objApr.Section(sectionId, empID, loggedUser);

            return(appraisalSection);
        }
예제 #18
0
        protected float scoreAppraisal(Appraisal <T> appraisal)
        {
            var score = appraisal.transformedScore();

            if (Reasoner <T> .trace)
            {
                lastScores[appraisal] = score; // log last score
            }

            return(score);
        }
예제 #19
0
 public List <StaffAssessment> GetBy(Appraisal appraisal)
 {
     try
     {
         Func <STAFF_POTENTIAL_ASSESSMENT, bool> selector = sps => sps.Appraisal_Header_ID == appraisal.Id;
         return(base.GetModelsBy(selector));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #20
0
 // Use this for initialization
 void Start()
 {
     appraisal = GetComponent<Appraisal>();
     agentComponent = GetComponent<AgentComponent>();
     InitAppraisalStatus();
     if (explosion) {
         escapePos = transform.position * 2f - explosion.transform.position;
         escapePos.y = transform.position.y;
     }
     else
         Debug.Log("No Explosion gameobject");
 }
예제 #21
0
    public void Init(GameObject o)
    {
        appraisal = GetComponent<Appraisal>();
        agentComponent = GetComponent<AgentComponent>();
        beginTime = Time.time;
        InitAppraisalStatus();

        opponent = o;
        oAgentComponent = opponent.GetComponent<AgentComponent>();

        GetComponent<SteeringController>().orientationBehavior = OrientationBehavior.LookAtTarget; //rotation is updated according to opponent's direction
    }
예제 #22
0
    public void Init(GameObject o)
    {
        appraisal      = GetComponent <Appraisal>();
        agentComponent = GetComponent <AgentComponent>();
        beginTime      = Time.time;
        InitAppraisalStatus();

        opponent        = o;
        oAgentComponent = opponent.GetComponent <AgentComponent>();

        GetComponent <SteeringController>().orientationBehavior = OrientationBehavior.LookAtTarget; //rotation is updated according to opponent's direction
    }
예제 #23
0
 /// <summary>
 ///     Returns current active appraisal year. There should be always only single appraisal year active.
 /// </summary>
 /// <returns></returns>
 public Dictionary <int, string> GetAppraisalYear()
 {
     try
     {
         var objApr   = new Appraisal();
         var apprYear = objApr.GetAppraisalYear();
         return(apprYear);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="appraisalSectionPost"></param>
        /// <returns></returns>
        public AppraisalSectionPost GetAppraisalData(AppraisalSectionPost appraisalSection)
        {
            var objApr = new Appraisal();

            try
            {
                return(objApr.GetAppraisalData(appraisalSection));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #25
0
        // GET: Performance
        public ActionResult SelfAppraisal()
        {
            ViewBag.Employees = db.Employees.Select(p => new { Id = p.ID, Name = p.FirstName + " " + p.LastName, Number = p.EmployeeNumber, Department = p.OfficePosition.Department.DepartmentName, JobTitle = p.OfficePosition.Title, Supervisor = p.OfficePosition.SupervisorID });
            ViewBag.KPICodes  = db.AppraisalNonJobKPIs.Select(p => new { p.Code, p.Description, p.AppraisalClass });
            ViewBag.AppraisalNonJobKPICode = new SelectList(db.AppraisalNonJobKPIs, "Code", "Code");
            ViewBag.AppraisalPeriodCode    = new SelectList(db.AppraisalPeriods, "Code", "Description");
            ViewBag.AppraisalTypeCode      = new SelectList(db.AppraisalTypes, "Code", "Description");
            var model = new Appraisal();

            model.CreationDate = DateTime.UtcNow;
            model.No           = "APPR-" + String.Format("{0:D5}", db.Appraisals.Count() + 1);
            return(View(model));
        }
예제 #26
0
        private static Task SendAppraisalAsync(ISocketMessageChannel channel, Appraisal appraisal)
        {
            var embed = new EmbedBuilder
            {
                Author = new EmbedAuthorBuilder().WithName($"Total worth: {appraisal.Totals.Buy} buy, {appraisal.Totals.Sell} sell")
            };

            foreach (var item in appraisal.Items)
            {
                embed.Fields.Add(new EmbedFieldBuilder().WithName($"{item.TypeName} x{item.Quantity}").WithValue($"Buy: {item.Prices.Buy.Average} Sell: {item.Prices.Sell.Average}"));
            }

            return(channel.SendMessageAsync("", embed: embed.Build()));
        }
예제 #27
0
        public MenuItem Menu(int empId, int loggedUser)
        {
            try
            {
                var objApr = new Appraisal();

                var lstMenu = objApr.GetMenuList(empId, loggedUser);
                return(lstMenu);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="appraisalSectionPost"></param>
        /// <returns></returns>
        public VibrantHttpResponse saveAppraisalSection(AppraisalSectionPost appraisalSectionPost)
        {
            var objApr = new Appraisal();

            try
            {
                var response = objApr.saveAppraisalSection(appraisalSectionPost);
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #29
0
        public bool Add(Appraisal request)
        {
            var output   = false;
            var validate = _context.Appraisal.Where(x => x.name == request.name && x.courseTypeId == request.courseTypeId)
                           .FirstOrDefault();

            if (validate == null)
            {
                request.createdAt = DateTime.Now;
                _context.Appraisal.Add(request);
                Save();
                output = true;
            }
            return(output);
        }
예제 #30
0
    protected void Btn_AddRoom_Click(object sender, EventArgs e)
    {
        Appraisal appraisal = new Appraisal();

        appraisal.AppraisalYear = this.appraisalYear.Text;
        appraisal.AppraisalTerm = this.appraisalTerm.Text;
        if (appraisal.AddAppraisalRoom())
        {
            Response.Write("<script>alert('评比宿舍添加成功!');</script>");
        }
        else
        {
            Response.Write("<script>alert('" + appraisal.ErrMessage + "');</script>");
        }
    }
예제 #31
0
    protected void Btn_Query_Click(object sender, EventArgs e)
    {
        Appraisal appraisal     = new Appraisal();
        string    appraisalYear = this.appraisalYear.SelectedValue;
        string    appraisalTerm = this.appraisalTerm.SelectedValue;
        DataSet   ds            = appraisal.QueryAppraisalSet(appraisalYear, appraisalTerm);
        DataRow   dr            = ds.Tables[0].Rows[0];

        this.basicScoreH.Text  = dr["basicScoreH"].ToString();
        this.healthScale.Text  = dr["healthScale"].ToString();
        this.basicScoreI.Text  = dr["basicScoreI"].ToString();
        this.illegalScale.Text = dr["illegalScale"].ToString();
        this.totalScoreH.Text  = appraisal.QueryTotalScoreH(appraisalYear);
        this.totalScoreI.Text  = appraisal.QueryTotalScoreI(appraisalYear);
    }
예제 #32
0
    protected void Btn_Update_Click(object sender, EventArgs e)
    {
        Appraisal appraisal = new Appraisal();

        appraisal.AppraisalYear = this.appraisalYear.Text;
        appraisal.AppraisalTerm = this.appraisalTerm.Text;
        appraisal.BasicScoreH   = this.basicScoreH.Text;
        appraisal.HealthScale   = this.healthScale.Text;
        appraisal.BasicScoreI   = this.basicScoreI.Text;
        appraisal.IllegalScale  = this.illegalScale.Text;
        if (appraisal.UpdateCalc())
        {
            Response.Write("<script>alert('计算公式更新成功!');</script>");
        }
    }
예제 #33
0
 // Use this for initialization
 void Start()
 {
     appraisal      = GetComponent <Appraisal>();
     agentComponent = GetComponent <AgentComponent>();
     InitAppraisalStatus();
     if (explosion)
     {
         escapePos   = transform.position * 2f - explosion.transform.position;
         escapePos.y = transform.position.y;
     }
     else
     {
         Debug.Log("No Explosion gameobject");
     }
 }
예제 #34
0
        public async Task <IActionResult> CreateAppraisal(Appraisal appraisal)
        {
            if (ModelState.IsValid)
            {
                await _context.Appraisals.AddAsync(appraisal);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(ListAppraisal)));
            }
            else
            {
                return(View(appraisal));
            }
        }
예제 #35
0
    public void GenerateRandomAppraisal()
    {
        int choice = Random.Range(0, 5);

        Appraisal[] AppraisalOptions = new Appraisal[] {
            new Appraisal(-0.5f, -0.5f, 0.0f, 1.0f, 0), //Anger
            new Appraisal(-0.5f, 0.0f, 0.0f, 0.5f, 0), //Fear
            new Appraisal(-0.5f, -0.5f, 0.0f, 0.5f, 0), //Anger + Fear
            new Appraisal(0.0f, -0.5f, 0.0f, 1.0f, 1), //Shame
            new Appraisal(-0.5f, 0.0f, 0.0f, 0.0f, 0)}; //Relief

        this.CurrentAppraisal = AppraisalOptions[choice];
        this.isCurrentAppraisalDirty = true;

        string ListofEmotions = "";

        foreach(Emotion e in AppraisalOptions[choice].CurrentEmotions)
        {
            ListofEmotions += e.ToString() + ", ";
        }

        Debug.Log ("Generated Random Appraisal:\nEmotions: " + ListofEmotions + "D: " + AppraisalOptions[choice].Desirability
            + ", A: " + AppraisalOptions[choice].Appealingness + ", P: " + AppraisalOptions[choice].Praiseworthiness + ", L: " + AppraisalOptions[choice].Likelihood
            + ", CA: " + AppraisalOptions[choice].CausalAgent);
    }
예제 #36
0
 void OnEnable()
 {
     appraisal = target as Appraisal;
 }
예제 #37
0
    // Use this for initialization
    void Start()
    {
        appraisal = GetComponent<Appraisal>();
        agentComponent = GetComponent<AgentComponent>();
        affectComponent = GetComponent<AffectComponent>();
        InitAppraisalStatus();

        Leader = this.transform.parent.GetComponent<LeaderComponent>().leader;

        UpdateAttractor();

        if(agentComponent.id % 4 == 0) {
            bannerCarrier = true;
            banner = (GameObject)Instantiate(UnityEngine.Resources.Load("banner"));
        }
    }
예제 #38
0
    // Use this for initialization
    void Start()
    {
        appraisal = GetComponent<Appraisal>();
        agentComponent = GetComponent<AgentComponent>();
        affectComponent = GetComponent<AffectComponent>();
        steering = GetComponent<SteeringController>();

         //   navmeshAgent.radius -= 0.1f; //smaller than regular size
        //navmeshAgent.speed += 0.6f; //faster than regular speed
        agentComponent.walkingSpeed = steering.maxSpeed;

        counterPos = GameObject.Find("counter").transform.position;
        cashier = GameObject.Find("cashier");
        storeEntrance = GameObject.Find("storeEntrance");

        acquiredObjCnt = 0;
        desiredObjCnt = (int)(5f * affectComponent.personality[(int)OCEAN.E] + 6f); //correlated to extroversion [1 11]

        InitAppraisalStatus();
    }
예제 #39
0
        public override Appraisal get_Appraisal(long IDNivel, IDbConnection conn) {
            Appraisal ret = new Appraisal();
            ret.pertinencia_Nivel = string.Empty;
            ret.pertinencia_Ponderacao = string.Empty;
            ret.pertinencia_FreqUso = string.Empty;
            ret.densidade_Tipo = string.Empty;
            ret.densidade_Grau = string.Empty;
            ret.densidade_InfoRel = new List<Appraisal_InfoRelacionada>();
            ret.enqdr_Legal_Diploma = string.Empty;
            ret.enqdr_Legal_RefTblSeleccao = string.Empty;
            ret.destino_Final = string.Empty;
            ret.prazo_Conservacao = string.Empty;
            ret.auto_eliminacao = string.Empty;
            ret.observacoes = string.Empty;

            try {
                string query = string.Format(@"
                    SELECT tp.Ponderacao AS pert_ponderacao, tp.Designacao AS pert_Nivel, 
                    av.Frequencia,
                    td.Designacao AS densidade_designacao, 
                    tsd.Designacao AS subDensidade_designacao,
                    av.RefTabelaAvaliacao,
                    CASE
                    WHEN av.Preservar is null THEN ''
                    WHEN av.Preservar = 1 THEN 'Conservação'
                    WHEN av.Preservar = 0 THEN 'Eliminação'
                    END AS DestinoFinal,
                    av.PrazoConservacao,
                    ae.Designacao,
                    av.Observacoes

                    FROM Nivel n
                    INNER JOIN FRDBase frd ON frd.IDNivel = n.ID AND frd.isDeleted = 0 
                    INNER JOIN SFRDAvaliacao av ON av.IDFRDBase = frd.ID AND av.isDeleted = 0
                    LEFT JOIN AutoEliminacao ae ON ae.ID = av.IDAutoEliminacao AND ae.isDeleted = 0
                    LEFT JOIN TipoPertinencia tp ON tp.ID = av.IDPertinencia AND tp.isDeleted = 0
                    LEFT JOIN TipoDensidade td ON td.ID = av.IDDensidade
                    LEFT JOIN TipoSubDensidade tsd ON tsd.ID = av.IDSubdensidade
                    WHERE n.ID = {0}  AND n.isDeleted = 0 ", IDNivel);

                SqlCommand command = new SqlCommand(query, (SqlConnection)conn);
                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read()) {
                    // ponderacao: pert_ponderacao
                    if (!reader.IsDBNull(0))
                        ret.pertinencia_Ponderacao = reader.GetString(0).Trim();
                    // nivel: pert_designacao
                    if (!reader.IsDBNull(1))
                        ret.pertinencia_Nivel = reader.GetString(1).Trim();
                    // Frequencia
                    if (!reader.IsDBNull(2))
                        ret.pertinencia_FreqUso = reader.GetDecimal(2).ToString().Trim();
                    // densidade_Tipo: densidade_designacao
                    if (!reader.IsDBNull(3))
                        ret.densidade_Tipo = reader.GetString(3).Trim();
                    // densidade_Grau: subDensidade_designacao
                    if (!reader.IsDBNull(4))
                        ret.densidade_Grau = reader.GetString(4).Trim();
                    // Enqdr Legal: RefTblSeleccao
                    if (!reader.IsDBNull(5))
                        ret.enqdr_Legal_RefTblSeleccao = reader.GetInt32(5).ToString().Trim();
                    // Destino final:
                    ret.destino_Final = reader.GetString(6).Trim();
                    // Prazo conservacao:
                    if (!reader.IsDBNull(7) && reader.GetInt16(7) > 0)
                        ret.prazo_Conservacao = reader.GetInt16(7).ToString().Trim();
                    // Num. do auto de eliminacao:
                    if (!reader.IsDBNull(8))
                        ret.auto_eliminacao = reader.GetString(8).Trim();
                    // Observacoes:
                    if (!reader.IsDBNull(9))
                        ret.observacoes = reader.GetString(9).Trim();

                }
                reader.Close();

                // Lista de informacao relacionada:
                query = string.Format(@"
                    SELECT nd.Designacao,
                    td.Designacao AS Desig_Tipo_Densidade, 
                    tsd.Designacao AS Desig_Grau_Densidade,
                    avr.Ponderacao
                    FROM Nivel n
                    INNER JOIN NivelDesignado nd ON nd.ID = n.ID AND nd.isDeleted = 0
                    INNER JOIN FRDBase frd ON frd.IDNivel = n.ID AND frd.isDeleted = 0
                    INNER JOIN SFRDAvaliacaoRel avr ON avr.IDFRDBase = frd.ID AND avr.isDeleted = 0
                    INNER JOIN TipoDensidade td ON td.ID = avr.Densidade AND td.isDeleted = 0
                    INNER JOIN TipoSubDensidade tsd ON tsd.ID = avr.SubDensidade AND tsd.isDeleted = 0
                    WHERE n.ID = {0}  AND n.isDeleted = 0 ", IDNivel);

                command.CommandText = query;
                reader = command.ExecuteReader();
                while (reader.Read()) {
                    Appraisal_InfoRelacionada val = new Appraisal_InfoRelacionada();
                    val.densidade_InfoRel_Titulo = reader.GetString(0).Trim();
                    if (!reader.IsDBNull(1))
                        val.densidade_InfoRel_Tipo = reader.GetString(1).Trim();
                    if (!reader.IsDBNull(2))
                        val.densidade_InfoRel_Grau = reader.GetString(2).Trim();
                    if (!reader.IsDBNull(3))
                        val.densidade_InfoRel_Ponderacao = reader.GetDecimal(3).ToString().Trim();
                    ret.densidade_InfoRel.Add(val);
                }
                reader.Close();

                // Enquadramento legal para o enqdr_Legal_Diploma:
                query = string.Format(@"
                    SELECT dic.Termo
                    FROM Nivel n
                    INNER JOIN FRDBase frd ON frd.IDNivel = n.ID AND frd.isDeleted = 0
                    INNER JOIN IndexFRDCA idx ON idx.IDFRDBase = frd.ID AND Selector = 1 AND idx.isDeleted = 0
                    INNER JOIN ControloAut ca ON ca.ID = idx.IDControloAut AND ca.isDeleted = 0
                    INNER JOIN ControloAutDicionario cad ON cad.IDControloAut = idx.IDControloAut AND cad.IDTipoControloAutForma = 1 AND cad.isDeleted = 0
                    INNER JOIN Dicionario dic ON dic.ID = cad.IDDicionario AND dic.isDeleted = 0
                    WHERE n.ID = {0}  AND n.isDeleted = 0 ", IDNivel);

                command.CommandText = query;
                reader = command.ExecuteReader();
                if (reader.Read()) {
                    if (!reader.IsDBNull(0))
                        ret.enqdr_Legal_Diploma = reader.GetString(0).Trim();
                }
                reader.Close();
            }
            catch (Exception ex) { Trace.WriteLine(ex); throw; }

            return ret;
        }
예제 #40
0
    public void GenerateCompletelyRandomAppraisal()
    {
        Appraisal RandomAppraisal = new Appraisal (Random.Range (-1.0f, 1.0f),
                Random.Range (-1.0f, 1.0f),
                Random.Range (-1.0f, 1.0f),
                Random.Range (0.0f, 1.01f),
                Random.Range (0, 2));

        //Appraisal RandomAppraisal = new Appraisal ( -0.5f, 0.0f, 0.0f, 0.0f, 0);

        this.CurrentAppraisal = RandomAppraisal;
        this.isCurrentAppraisalDirty = true;

        string ListofEmotions = "";

        foreach(Emotion e in RandomAppraisal.CurrentEmotions)
        {
            ListofEmotions += e.ToString() + ", ";
        }

        Debug.Log ("Generated Random Appraisal:\nEmotions: " + ListofEmotions + "D: " + RandomAppraisal.Desirability
            + ", A: " + RandomAppraisal.Appealingness + ", P: " + RandomAppraisal.Praiseworthiness + ", L: " + RandomAppraisal.Likelihood
            + ", CA: " + RandomAppraisal.CausalAgent);
    }