Ejemplo n.º 1
0
    /// <summary>
    /// Clears the work room. Dont remember it in brain
    /// </summary>
    public void ClearWorkRoom()
    {
        //m_BrainMemory.ClearWorkRoom();

        //lw:Bug report Win64 Steam Version:V1.0.5 from SteamId 76561198032245399
        if (WorkRoom == null)
        {
            return;
        }

        WorkRoom.RemoveWorker(this);
        WorkRoom = null;
    }
Ejemplo n.º 2
0
        public bool AddWorkroom(string Name_, string Abbreviation_, string Type_)
        {
            bool result = true;

            try
            {
                if (Name_.Trim().Length == 0)
                {
                    throw new Exception("Workroom name length must be greater than 0.");
                }

                if (Abbreviation_.Trim().Length == 0)
                {
                    throw new Exception("Workroom abbreviation length must be greater than 0.");
                }

                if (Type_.Trim().Length == 0)
                {
                    throw new Exception("Workroom Type length must be greater than 0.");
                }

                WorkRoom newrow = new WorkRoom()
                {
                    Id = 0, Name = Name_, Abbreviation = Abbreviation_, Type = Type_
                };
                context.WorkRooms.Add(newrow);
                context.Database.Connection.Close();
                if (context.SaveChanges() < 1)
                {
                    throw new Exception("failed to save changes.");
                }
                else
                {
                    PrimaryKey = newrow.Id;
                }
            } catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                result       = false;
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }
            return(result);
        }